From b7a63e9964a865441b4e0791a19b5a7bbfa2eff4 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 1 Jun 2026 10:35:18 +0300 Subject: test(integration): add SysV shm tracing coverage The SysV shared-memory family (shmget/shmat/shmdt/shmctl) had no end-to-end integration coverage. Add an ioworkload `sysv-shm-basic` scenario that, without privileges, runs shmget(IPC_PRIVATE) -> shmat -> write into the mapped segment -> shmdt -> shmctl(IPC_RMID), always issuing IPC_RMID (via defer) so no kernel segment leaks. Add TestSysVShmBasic asserting enter_shmget/enter_shmat/enter_shmdt/ enter_shmctl are each traced with a positive (paired enter/exit) duration. msg/sem coverage is scoped out and tracked as a follow-up task (7i0). Co-Authored-By: Claude Opus 4.8 --- integrationtests/ipc_sysv_test.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 integrationtests/ipc_sysv_test.go (limited to 'integrationtests') diff --git a/integrationtests/ipc_sysv_test.go b/integrationtests/ipc_sysv_test.go new file mode 100644 index 0000000..6983c08 --- /dev/null +++ b/integrationtests/ipc_sysv_test.go @@ -0,0 +1,38 @@ +package integrationtests + +import "testing" + +// sysvShmTraceArgs restricts tracing to the SysV shared-memory family so the +// captured output is dominated by the lifecycle calls the workload issues. +var sysvShmTraceArgs = []string{ + "-trace-syscalls", + "shmget,shmat,shmdt,shmctl", +} + +// TestSysVShmBasic verifies the SysV shared-memory family is traced end-to-end. +// The workload runs shmget(IPC_PRIVATE) -> shmat -> write -> shmdt -> +// shmctl(IPC_RMID); each call must appear as an enter event, and each must have +// a positive duration (proving the enter/exit pair was correlated by the +// tracer). The workload always issues IPC_RMID, so no kernel segment leaks. +func TestSysVShmBasic(t *testing.T) { + h := newTestHarness(t) + result, pid, err := h.RunWithIorArgs("sysv-shm-basic", defaultDuration, sysvShmTraceArgs) + if err != nil { + t.Fatalf("run scenario sysv-shm-basic: %v", err) + } + + AssertNoUnexpectedPID(t, result, pid) + AssertNoUnexpectedComm(t, result, "ioworkload") + AssertEventsPresent(t, result, []ExpectedEvent{ + {Tracepoint: "enter_shmget", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_shmat", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_shmdt", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_shmctl", Comm: "ioworkload", MinCount: 1}, + }) + + // Each syscall must have been correlated to its exit (positive duration), + // proving the enter/exit pair was traced rather than just the enter. + for _, tp := range []string{"enter_shmget", "enter_shmat", "enter_shmdt", "enter_shmctl"} { + assertEventDurationPositive(t, result, ExpectedEvent{Tracepoint: tp, Comm: "ioworkload"}) + } +} -- cgit v1.2.3