Skip to content

Commit

Permalink
change the way loading stack_argument bpf bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdliyan committed Sep 7, 2023
1 parent e807cb7 commit a2201e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
2 changes: 2 additions & 0 deletions test/integration-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
20 changes: 3 additions & 17 deletions test/integration-test/src/tests/stack_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand All @@ -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);
Expand Down

0 comments on commit a2201e6

Please sign in to comment.