default_post_vm_periodic_fired

Function default_post_vm_periodic_fired 

Source
pub fn default_post_vm_periodic_fired(result: &VmResult) -> Result<()>
Expand description

Default post_vm callback emitted by #[ktstr_test] when the attribute omits post_vm = .... Asserts that at least one periodic snapshot produced REAL BPF state during the workload window WHEN periodic was configured (num_snapshots > 0); when periodic was disabled (num_snapshots == 0), the helper is a no-op and returns Ok.

This is the smoke-floor for any periodic-configured test: “the test produced meaningful data.” Importantly, the floor reads SnapshotBridge::periodic_real_count — NOT VmResult::periodic_fired. The latter counts every periodic boundary the coordinator attempted, INCLUDING placeholder rows from rendezvous timeouts; a scheduler that attaches but produces nothing but placeholders would pass the periodic_fired >= 1 floor and obscure the broken-scheduler diagnosis. The real-count floor catches that case (placeholder-only fills surface as zero) while tolerating the realistic single-snapshot timeout flake (one real capture among N is enough to pass the floor).

Tests that need stronger assertions (per-snapshot field reads, per-phase ratios, etc.) supply their own post_vm = my_checker instead.

The macro routes this fn pointer into KtstrTestEntry::post_vm so the runner’s existing dispatch path applies it identically to an author-supplied callback.