Commit ff408adb authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

zb: use test-env logger for tests



Make RUST_LOG work across various crates (including async ones) during
test.

We probably want to have log::trace in our code as well to help debugging.
Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent 8ea3d49a
......@@ -43,6 +43,8 @@ zbus_polkit = { path = "../zbus_polkit", version = "1" }
doc-comment = "0.3.3"
futures-util = "0.3.8" # activate default features
ntest = "0.7.1"
env_logger = "*"
test-env-log = "0.2.6"
[package.metadata.docs.rs]
all-features = true
......
......@@ -120,6 +120,7 @@ mod tests {
use super::Address;
use crate::Error;
use std::str::FromStr;
use test_env_log::test;
#[test]
fn parse_dbus_addresses() {
......
......@@ -933,6 +933,7 @@ impl From<crate::Connection> for Connection {
mod tests {
use futures_util::stream::TryStreamExt;
use std::os::unix::net::UnixStream;
use test_env_log::test;
use super::*;
......
......@@ -144,6 +144,7 @@ where
mod tests {
use nix::unistd::Uid;
use std::os::unix::net::UnixStream;
use test_env_log::test;
use super::*;
......
......@@ -601,6 +601,7 @@ mod tests {
use super::*;
use futures_util::future::FutureExt;
use std::{future::ready, sync::Arc};
use test_env_log::test;
#[test]
fn signal_stream() {
......
......@@ -289,6 +289,7 @@ impl From<azync::Connection> for Connection {
#[cfg(test)]
mod tests {
use std::{os::unix::net::UnixStream, thread};
use test_env_log::test;
use crate::{Connection, Error, Guid};
#[test]
......
......@@ -604,6 +604,7 @@ mod tests {
convert::TryInto,
sync::{Arc, Mutex},
};
use test_env_log::test;
#[test]
fn error_from_zerror() {
......
......@@ -72,6 +72,7 @@ impl FromStr for Guid {
#[cfg(test)]
mod tests {
use crate::Guid;
use test_env_log::test;
#[test]
fn generate() {
......
......@@ -808,6 +808,7 @@ impl FromStr for Command {
#[cfg(test)]
mod tests {
use std::os::unix::net::UnixStream;
use test_env_log::test;
use super::*;
......
......@@ -214,6 +214,7 @@ mod tests {
use enumflags2::BitFlags;
use ntest::timeout;
use test_env_log::test;
use zvariant::{Fd, OwnedObjectPath, OwnedValue, Type};
......
......@@ -614,6 +614,7 @@ impl fmt::Display for Message {
mod tests {
use super::{Fds, Message, MessageError};
use std::os::unix::io::AsRawFd;
use test_env_log::test;
use zvariant::Fd;
#[test]
......
......@@ -323,6 +323,7 @@ mod tests {
use crate::{MessageField, MessageFields, MessageHeader, MessagePrimaryHeader, MessageType};
use std::{convert::TryFrom, error::Error, result::Result};
use test_env_log::test;
use zvariant::{ObjectPath, Signature};
#[test]
......
......@@ -548,6 +548,7 @@ mod tests {
use ntest::timeout;
use serde::{Deserialize, Serialize};
use test_env_log::test;
use zvariant::derive::Type;
use crate::{
......
......@@ -280,6 +280,7 @@ impl<'p, 'a: 'p> From<azync::Proxy<'a>> for Proxy<'p> {
mod tests {
use super::*;
use std::sync::{Arc, Mutex};
use test_env_log::test;
#[test]
fn signal() {
......
......@@ -140,6 +140,7 @@ pub trait ProxyDefault {
mod tests {
use super::*;
use crate::Connection;
use test_env_log::test;
#[test]
fn builder() {
......
......@@ -173,6 +173,7 @@ mod tests {
use super::Connection;
use crate::message::Message;
use std::os::unix::net::UnixStream;
use test_env_log::test;
#[test]
fn raw_send_receive() {
......
......@@ -160,6 +160,7 @@ mod tests {
rc::Rc,
sync::{Arc, Mutex},
};
use test_env_log::test;
fn multiple_signal_iface_test() -> std::result::Result<u32, Box<dyn std::error::Error>> {
#[dbus_proxy(interface = "org.freedesktop.zbus.MultiSignal")]
......
......@@ -286,6 +286,7 @@ impl std::str::FromStr for Node {
#[cfg(test)]
mod tests {
use std::{error::Error, str::FromStr};
use test_env_log::test;
use super::Node;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment