mirror of https://github.com/aya-rs/aya
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
630 B
Rust
24 lines
630 B
Rust
3 years ago
|
use aya::include_bytes_aligned;
|
||
|
use object::{Object, ObjectSymbol};
|
||
|
|
||
2 years ago
|
#[test]
|
||
2 years ago
|
fn test_maps() {
|
||
2 years ago
|
let bytes = include_bytes_aligned!("../../../target/bpfel-unknown-none/release/map_test");
|
||
2 years ago
|
let obj_file = object::File::parse(bytes).unwrap();
|
||
3 years ago
|
if obj_file.section_by_name("maps").is_none() {
|
||
2 years ago
|
panic!("No 'maps' ELF section");
|
||
3 years ago
|
}
|
||
|
let mut found = false;
|
||
|
for sym in obj_file.symbols() {
|
||
|
if let Ok(name) = sym.name() {
|
||
|
if name == "BAR" {
|
||
|
found = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if !found {
|
||
2 years ago
|
panic!("No symbol 'BAR' in ELF file")
|
||
3 years ago
|
}
|
||
|
}
|