From 3bcefca57b4286f868373bd4c8aeba35babebdad Mon Sep 17 00:00:00 2001 From: Brskt Date: Tue, 21 Apr 2026 22:43:55 +0200 Subject: [PATCH] integration-test: use bool for lpm_trie ran flag Mirror the stack_trace test's `TestResult::ran: bool`; the field only distinguishes a recorded result from a zero-initialised slot. --- test/integration-common/src/lib.rs | 3 ++- test/integration-ebpf/src/lpm_trie.rs | 2 +- test/integration-test/src/tests/lpm_trie.rs | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/integration-common/src/lib.rs b/test/integration-common/src/lib.rs index f23c6756..b0ad3ace 100644 --- a/test/integration-common/src/lib.rs +++ b/test/integration-common/src/lib.rs @@ -152,7 +152,8 @@ pub mod lpm_trie { #[derive(Clone, Copy, Default)] pub struct TestResult { pub value: u32, - pub ran: u32, + /// Distinguishes a recorded result from a zero-initialised slot. + pub ran: bool, } #[cfg(feature = "user")] diff --git a/test/integration-ebpf/src/lpm_trie.rs b/test/integration-ebpf/src/lpm_trie.rs index 93d926f2..72b124ad 100644 --- a/test/integration-ebpf/src/lpm_trie.rs +++ b/test/integration-ebpf/src/lpm_trie.rs @@ -39,7 +39,7 @@ macro_rules! define_lpm_trie_test { if let Some(val) = $routes_map.get(key) { (*ptr).value = *val; } - (*ptr).ran = 1; + (*ptr).ran = true; } } }; diff --git a/test/integration-test/src/tests/lpm_trie.rs b/test/integration-test/src/tests/lpm_trie.rs index 9543d8a1..964cc586 100644 --- a/test/integration-test/src/tests/lpm_trie.rs +++ b/test/integration-test/src/tests/lpm_trie.rs @@ -44,21 +44,21 @@ fn lpm_trie_basic(prog_name: &str, routes_map: &str, results_map: &str) { let results = Array::<_, TestResult>::try_from(bpf.map(results_map).unwrap()).unwrap(); let TestResult { ran, value } = results.get(&LPM_MATCH_SLOT, 0).unwrap(); - assert_eq!(ran, 1, "LPM-match probe did not run"); + assert!(ran, "LPM-match probe did not run"); assert_eq!( value, 7, "longest-prefix-match should return the /24 value, not the /16" ); let TestResult { ran, value } = results.get(&NO_MATCH_SLOT, 0).unwrap(); - assert_eq!(ran, 1, "no-match probe did not run"); + assert!(ran, "no-match probe did not run"); assert_eq!( value, 0, "get() should return None for a key outside the trie" ); let TestResult { ran, value } = results.get(&REMOVE_SLOT, 0).unwrap(); - assert_eq!(ran, 1, "after-remove probe did not run"); + assert!(ran, "after-remove probe did not run"); assert_eq!( value, 42, "after removing the /24, longest-prefix-match should fall back to the /16"