diff --git a/test/integration-test/Cargo.toml b/test/integration-test/Cargo.toml index 4d1a466b..71ea64dd 100644 --- a/test/integration-test/Cargo.toml +++ b/test/integration-test/Cargo.toml @@ -10,6 +10,7 @@ assert_matches = { workspace = true } aya = { workspace = true } aya-log = { workspace = true } aya-obj = { workspace = true } +bytes.workspace = true libc = { workspace = true } log = { workspace = true } netns-rs = { workspace = true } diff --git a/test/integration-test/src/tests.rs b/test/integration-test/src/tests.rs index dd8565b0..b6cb63e7 100644 --- a/test/integration-test/src/tests.rs +++ b/test/integration-test/src/tests.rs @@ -6,3 +6,4 @@ mod log; mod rbpf; mod relocations; mod smoke; +mod stack_argument; diff --git a/test/integration-test/src/tests/stack_argument.rs b/test/integration-test/src/tests/stack_argument.rs index 503b18ac..1a244849 100644 --- a/test/integration-test/src/tests/stack_argument.rs +++ b/test/integration-test/src/tests/stack_argument.rs @@ -1,9 +1,9 @@ use aya::{ include_bytes_aligned, maps::AsyncPerfEventArray, programs::UProbe, util::online_cpus, Bpf, }; -use integration_test_macros::tokio_integration_test; +use bytes::BytesMut; use log::warn; -use tokio::{signal, task}; +use tokio::task; pub struct Args { a_0: u64, @@ -46,7 +46,7 @@ pub extern "C" fn trigger_stack_argument( ) { } -#[tokio_integration_test] +#[tokio::test] async fn stack_argument() { let bytes = include_bytes_aligned!("../../../../target/bpfel-unknown-none/release/stack_argument"); @@ -66,6 +66,7 @@ async fn stack_argument() { let mut perf_array = AsyncPerfEventArray::try_from(bpf.take_map("EVENTS").unwrap())?; for cpu_id in online_cpus()? { let mut buf = perf_array.open(cpu_id, None)?; + perf_buffers.push(perf_array.open(cpu_id, None)?); task::spawn(async move { let mut buffers = (0..10) @@ -73,8 +74,8 @@ async fn stack_argument() { .collect::>(); loop { - let events = buf.read_events(&mut buffer).await.unwrap(); - for buf in buffers.iter_mut().task(events.read) { + let events = buf.read_events(&mut buffers).await.unwrap(); + for buf in buffers.iter_mut().take(events.read) { let ptr = buf.as_ptr() as *const Args; let data = unsafe { ptr.read_unaligned() }; assert_eq!(data.a_0, 0);