1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Shared test helpers for `monitor` submodules.
//!
//! Helpers that two or more sibling test modules need — e.g.
//! [`name_from_str`] used by both `bpf_map::tests` and
//! `dump::tests` — live here to avoid duplicate copies that drift.
//! `#[cfg(test)] pub(crate)` so descendants of `crate::monitor` can
//! reach in (siblings cannot see each other's private `tests`
//! modules; a shared parent module is the only path).
use BPF_OBJ_NAME_LEN;
use ;
/// Pack a `&str` into the inline name representation
/// (`name_bytes`, `name_len`) used by
/// [`super::bpf_map::BpfMapInfo`]. Truncates to
/// `BPF_OBJ_NAME_LEN` when the input exceeds that — matches the
/// kernel's own bookkeeping (`bpf_obj_name_cpy` in
/// `kernel/bpf/syscall.c` rejects names longer than the field, but
/// for tests we silently truncate so call sites can use whatever
/// length is convenient without precomputing the cap).
pub
/// Two-CPU sample whose load is balanced under every default
/// monitor check: `nr_running=2` on both CPUs, small
/// `local_dsq_depth`, advancing `rq_clock`. Used as the
/// "no-violation baseline" by `thresholds_tests`,
/// `validity_tests`, `event_rates_tests`, and
/// `schedstat_tests` — keeping it in one place avoids drift
/// between copies that would silently change what "balanced"
/// means across test modules.
pub