diff --git a/test/integration-test/src/tests/relocations.rs b/test/integration-test/src/tests/relocations.rs index 98adf044..d4c44e3f 100644 --- a/test/integration-test/src/tests/relocations.rs +++ b/test/integration-test/src/tests/relocations.rs @@ -1,36 +1,12 @@ -use std::collections::HashSet; - use aya::{programs::UProbe, util::KernelVersion, Ebpf, EbpfLoader}; -use aya_obj::generated::bpf_map_type; use test_log::test; -enum DisableMapRelocation<'a> { - ByType(bpf_map_type), - ByName(&'a str), -} - -#[test] -fn test_ignored_map_relocation_by_type() { - let mut ebpf = relocation_load_and_attach( - "test_ignored_map_relocation", - crate::IGNORE_MAP, - DisableMapRelocation::ByType(bpf_map_type::BPF_MAP_TYPE_RINGBUF), - ); - - let perf = ebpf.take_map("PERFBUF"); - - let ring = ebpf.take_map("RINGBUF"); - - assert!(perf.is_some()); - assert!(ring.is_none()); -} - #[test] -fn test_ignored_map_relocation_by_name() { +fn ignored_map_relocation_by_name() { let mut ebpf = relocation_load_and_attach( "test_ignored_map_relocation", crate::IGNORE_MAP, - DisableMapRelocation::ByName("RINGBUF"), + "RINGBUF", ); let perf = ebpf.take_map("PERFBUF"); @@ -76,24 +52,13 @@ fn text_64_64_reloc() { fn relocation_load_and_attach( name: &str, bytes: &[u8], - disable_type: DisableMapRelocation, + disable_map_name: &str, ) -> Ebpf { - let mut ebpf = match disable_type { - DisableMapRelocation::ByType(bmt) => { - let mut set = HashSet::new(); - set.insert(bmt); - EbpfLoader::new() - .ignore_maps_by_type(set) - .set_global("RINGBUF_SUPPORTED", &0, true) - .load(bytes) - .unwrap() - } - DisableMapRelocation::ByName(name) => EbpfLoader::new() - .ignore_maps_by_name(&[name]) - .set_global("RINGBUF_SUPPORTED", &0, true) - .load(bytes) - .unwrap(), - }; + let mut ebpf = EbpfLoader::new() + .ignore_maps_by_name(&[disable_map_name]) + .set_global("RINGBUF_SUPPORTED", &0, true) + .load(bytes) + .unwrap(); let prog: &mut UProbe = ebpf.program_mut(name).unwrap().try_into().unwrap(); prog.load().unwrap();