diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-01 11:19:19 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-01 11:19:19 +0300 |
| commit | 55aa404fc93deeff27205b3cc9af407ab071be4b (patch) | |
| tree | 8e35e1cdfce0e3057920f5697babb942c00cd673 /integrationtests | |
| parent | 96065ab5c13295f0c2ec810cf540c229c41e2647 (diff) | |
test(integration): add Misc family tracing coverage
Add a misc-basic ioworkload scenario and an end-to-end integration test
for the previously-uncovered Misc syscall family.
The scenario exercises only the safe, unprivileged, non-blocking,
side-effect-free Misc syscalls: getcpu (raw SYS_GETCPU), uname /
sys_newuname (unix.Uname), sysinfo (unix.Sysinfo), vmsplice into a
self-created and self-drained pipe with a tiny buffer, and alarm(0) to
cancel any pending alarm. Code comments document why the remaining Misc
syscalls are intentionally excluded (CAP_SYS_ADMIN / global host
mutation, CAP_SYS_RAWIO / x86-only, Linux 6.13+ availability,
runtime-managed, or not user-callable).
misc_test.go asserts enter_getcpu, enter_newuname, and enter_sysinfo are
each traced at least once for the ioworkload process, restricting tracing
to the issued syscalls and keeping the existing PID/comm hermetic guards.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/misc_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/integrationtests/misc_test.go b/integrationtests/misc_test.go new file mode 100644 index 0000000..81767b4 --- /dev/null +++ b/integrationtests/misc_test.go @@ -0,0 +1,35 @@ +package integrationtests + +import "testing" + +// miscTraceArgs restricts tracing to the Misc-family syscalls the misc-basic +// workload issues, so the captured output is dominated by those calls. +// Note: the tracer names the uname tracepoint after the underlying kernel +// syscall sys_newuname, i.e. "newuname" (not "uname"). vmsplice and alarm are +// issued too, but the must-haves below are the three pure-read calls whose +// tracepoints are guaranteed to fire deterministically. +var miscTraceArgs = []string{ + "-trace-syscalls", + "getcpu,newuname,sysinfo,vmsplice,alarm", +} + +// TestMiscBasic verifies the Misc syscall family is traced end-to-end. The +// misc-basic workload issues getcpu, uname (sys_newuname), sysinfo, vmsplice +// (into a self-drained pipe), and alarm(0) — all unprivileged, non-blocking, +// and free of global side effects. Each required syscall must appear as an +// enter event attributed to the ioworkload process. +func TestMiscBasic(t *testing.T) { + h := newTestHarness(t) + result, pid, err := h.RunWithIorArgs("misc-basic", defaultDuration, miscTraceArgs) + if err != nil { + t.Fatalf("run scenario misc-basic: %v", err) + } + + AssertNoUnexpectedPID(t, result, pid) + AssertNoUnexpectedComm(t, result, "ioworkload") + AssertEventsPresent(t, result, []ExpectedEvent{ + {Tracepoint: "enter_getcpu", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_newuname", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_sysinfo", Comm: "ioworkload", MinCount: 1}, + }) +} |
