From a2201e669877dcf4800f6f181f095789606c565a Mon Sep 17 00:00:00 2001 From: pdliyan Date: Thu, 7 Sep 2023 10:29:15 +0800 Subject: [PATCH] change the way loading stack_argument bpf bytes. --- test/integration-test/src/lib.rs | 2 ++ .../src/tests/stack_argument.rs | 20 +++---------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/test/integration-test/src/lib.rs b/test/integration-test/src/lib.rs index 08911a4e..1c8e2f9d 100644 --- a/test/integration-test/src/lib.rs +++ b/test/integration-test/src/lib.rs @@ -11,6 +11,8 @@ pub const TEXT_64_64_RELOC: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/text_64_64_reloc.o")); pub const LOG: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/log")); +pub const STACK_ARGUMENT: &[u8] = + include_bytes_aligned!(concat!(env!("OUT_DIR"), "/stack_argument")); pub const MAP_TEST: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/map_test")); pub const NAME_TEST: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/name_test")); pub const PASS: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/pass")); diff --git a/test/integration-test/src/tests/stack_argument.rs b/test/integration-test/src/tests/stack_argument.rs index 1a244849..fb8109bf 100644 --- a/test/integration-test/src/tests/stack_argument.rs +++ b/test/integration-test/src/tests/stack_argument.rs @@ -5,6 +5,8 @@ use bytes::BytesMut; use log::warn; use tokio::task; +use crate::STACK_ARGUMENT; + pub struct Args { a_0: u64, a_1: u64, @@ -17,20 +19,6 @@ pub struct Args { a_7: i64, } -impl Args { - fn new() -> Self { - Self { - a_0: 0, - a_1: 0, - a_2: 0, - a_3: 0, - a_4: 0, - a_5: 0, - a_6: 0, - a_7: 0, - } - } -} #[no_mangle] #[inline(never)] pub extern "C" fn trigger_stack_argument( @@ -48,9 +36,7 @@ pub extern "C" fn trigger_stack_argument( #[tokio::test] async fn stack_argument() { - let bytes = - include_bytes_aligned!("../../../../target/bpfel-unknown-none/release/stack_argument"); - let mut bpf = Bpf::load(bytes).unwrap(); + let mut bpf = Bpf::load(crate::STACK_ARGUMENT).unwrap(); if let Err(e) = BpfLogger::init(&mut bpf) { warn!("failed to initialize eBPF logger: {}", e);