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.
This commit is contained in:
Brskt
2026-04-21 22:43:55 +02:00
committed by Tamir Duberstein
parent 9c82966729
commit 3bcefca57b
3 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -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")]
+1 -1
View File
@@ -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;
}
}
};
+3 -3
View File
@@ -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"