summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-01 10:35:18 +0300
committerPaul Buetow <paul@buetow.org>2026-06-01 10:35:18 +0300
commitb7a63e9964a865441b4e0791a19b5a7bbfa2eff4 (patch)
treee09353be8156e2c4e0877d69476dc52fad2adea3 /integrationtests
parent8549884d1d957821b75dfbd5a4ff746667095f17 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/ipc_sysv_test.go38
1 files changed, 38 insertions, 0 deletions
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"})
+ }
+}