integration-tests: enable logs

Use test_log::test so setting RUST_LOG=aya=debug works and it's easier
to debug failures.
pull/818/head
Alessandro Decina 11 months ago committed by vadorovsky
parent 2227223a96
commit d679a973ca

@ -91,6 +91,7 @@ rustversion = { version = "1.0.0", default-features = false }
syn = { version = "2", default-features = false } syn = { version = "2", default-features = false }
tempfile = { version = "3", default-features = false } tempfile = { version = "3", default-features = false }
test-case = { version = "3.1.0", default-features = false } test-case = { version = "3.1.0", default-features = false }
test-log = { version = "0.2.13", default-features = false }
testing_logger = { version = "0.1.1", default-features = false } testing_logger = { version = "0.1.1", default-features = false }
thiserror = { version = "1", default-features = false } thiserror = { version = "1", default-features = false }
tokio = { version = "1.24.0", default-features = false } tokio = { version = "1.24.0", default-features = false }

@ -10,6 +10,7 @@ assert_matches = { workspace = true }
aya = { workspace = true } aya = { workspace = true }
aya-log = { workspace = true } aya-log = { workspace = true }
aya-obj = { workspace = true } aya-obj = { workspace = true }
env_logger = { workspace = true }
epoll = { workspace = true } epoll = { workspace = true }
futures = { workspace = true, features = ["std"] } futures = { workspace = true, features = ["std"] }
libc = { workspace = true } libc = { workspace = true }
@ -19,6 +20,7 @@ object = { workspace = true, features = ["elf", "read_core", "std"] }
rand = { workspace = true, features = ["std", "std_rng"] } rand = { workspace = true, features = ["std", "std_rng"] }
rbpf = { workspace = true } rbpf = { workspace = true }
test-case = { workspace = true } test-case = { workspace = true }
test-log = { workspace = true, features = ["log"] }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] } tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }
[build-dependencies] [build-dependencies]

@ -1,4 +1,5 @@
use aya::{maps::Array, programs::UProbe, Bpf}; use aya::{maps::Array, programs::UProbe, Bpf};
use test_log::test;
const RESULT_BUF_LEN: usize = 1024; const RESULT_BUF_LEN: usize = 1024;

@ -1,4 +1,5 @@
use object::{Object, ObjectSymbol}; use object::{Object, ObjectSymbol};
use test_log::test;
#[test] #[test]
fn test_maps() { fn test_maps() {

@ -16,6 +16,7 @@ use aya::{
Bpf, Bpf,
}; };
use aya_obj::programs::XdpAttachType; use aya_obj::programs::XdpAttachType;
use test_log::test;
const MAX_RETRIES: usize = 100; const MAX_RETRIES: usize = 100;
const RETRY_DURATION: Duration = Duration::from_millis(10); const RETRY_DURATION: Duration = Duration::from_millis(10);

@ -6,6 +6,7 @@ use std::{
use aya::{programs::UProbe, Bpf}; use aya::{programs::UProbe, Bpf};
use aya_log::BpfLogger; use aya_log::BpfLogger;
use log::{Level, Log, Record}; use log::{Level, Log, Record};
use test_log::test;
#[no_mangle] #[no_mangle]
#[inline(never)] #[inline(never)]
@ -37,7 +38,7 @@ struct CapturedLog<'a> {
pub target: Cow<'a, str>, pub target: Cow<'a, str>,
} }
#[tokio::test] #[test(tokio::test)]
async fn log() { async fn log() {
let mut bpf = Bpf::load(crate::LOG).unwrap(); let mut bpf = Bpf::load(crate::LOG).unwrap();

@ -3,6 +3,7 @@ use std::collections::HashMap;
use assert_matches::assert_matches; use assert_matches::assert_matches;
use aya_obj::{generated::bpf_insn, programs::XdpAttachType, Object, ProgramSection}; use aya_obj::{generated::bpf_insn, programs::XdpAttachType, Object, ProgramSection};
use test_log::test;
#[test] #[test]
fn run_with_rbpf() { fn run_with_rbpf() {

@ -1,4 +1,5 @@
use aya::{programs::UProbe, Bpf}; use aya::{programs::UProbe, Bpf};
use test_log::test;
#[test] #[test]
fn relocations() { fn relocations() {

@ -17,6 +17,7 @@ use aya::{
}; };
use aya_obj::generated::BPF_RINGBUF_HDR_SZ; use aya_obj::generated::BPF_RINGBUF_HDR_SZ;
use rand::Rng as _; use rand::Rng as _;
use test_log::test;
use tokio::{ use tokio::{
io::unix::AsyncFd, io::unix::AsyncFd,
time::{sleep, Duration}, time::{sleep, Duration},
@ -175,7 +176,7 @@ pub extern "C" fn ring_buf_trigger_ebpf_program(arg: u64) {
// to fill the ring_buf. We just ensure that the number of events we see is sane given // to fill the ring_buf. We just ensure that the number of events we see is sane given
// what the producer sees, and that the logic does not hang. This exercises interleaving // what the producer sees, and that the logic does not hang. This exercises interleaving
// discards, successful commits, and drops due to the ring_buf being full. // discards, successful commits, and drops due to the ring_buf being full.
#[tokio::test(flavor = "multi_thread")] #[test(tokio::test(flavor = "multi_thread"))]
async fn ring_buf_async_with_drops() { async fn ring_buf_async_with_drops() {
let WithData( let WithData(
RingBufTest { RingBufTest {
@ -282,7 +283,7 @@ async fn ring_buf_async_with_drops() {
); );
} }
#[tokio::test(flavor = "multi_thread")] #[test(tokio::test(flavor = "multi_thread"))]
async fn ring_buf_async_no_drop() { async fn ring_buf_async_no_drop() {
let WithData( let WithData(
RingBufTest { RingBufTest {
@ -380,7 +381,7 @@ fn ring_buf_epoll_wakeup() {
} }
// This test is like the above test but uses tokio and AsyncFd instead of raw epoll. // This test is like the above test but uses tokio and AsyncFd instead of raw epoll.
#[tokio::test] #[test(tokio::test)]
async fn ring_buf_asyncfd_events() { async fn ring_buf_asyncfd_events() {
let RingBufTest { let RingBufTest {
ring_buf, ring_buf,

@ -3,6 +3,7 @@ use aya::{
util::KernelVersion, util::KernelVersion,
Bpf, BpfLoader, Bpf, BpfLoader,
}; };
use test_log::test;
use crate::utils::NetNsGuard; use crate::utils::NetNsGuard;

@ -6,6 +6,7 @@ use aya::{
Bpf, Bpf,
}; };
use object::{Object, ObjectSection, ObjectSymbol, SymbolSection}; use object::{Object, ObjectSection, ObjectSymbol, SymbolSection};
use test_log::test;
use crate::utils::NetNsGuard; use crate::utils::NetNsGuard;

Loading…
Cancel
Save