From 4cd2c4e818a1438bf63d1ca05a6cf134f39bc06b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 22 Feb 2026 22:31:35 +0200 Subject: Add copy_file_range support and tracepoint attach tests --- integrationtests/attach_tracepoints_test.go | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 integrationtests/attach_tracepoints_test.go (limited to 'integrationtests/attach_tracepoints_test.go') diff --git a/integrationtests/attach_tracepoints_test.go b/integrationtests/attach_tracepoints_test.go new file mode 100644 index 0000000..89db494 --- /dev/null +++ b/integrationtests/attach_tracepoints_test.go @@ -0,0 +1,59 @@ +package integrationtests + +import "testing" + +func TestAttachTracepointsIncludeFilter(t *testing.T) { + h := newTestHarness(t) + + // Only load openat tracepoints so write events from the workload are not captured. + result, pid, err := h.RunWithIorArgs("open-rdonly-write", defaultDuration, []string{ + "-tps", "^sys_enter_openat$,^sys_exit_openat$", + }) + if err != nil { + t.Fatalf("run scenario open-rdonly-write with include filter: %v", err) + } + + AssertNoUnexpectedPID(t, result, pid) + AssertNoUnexpectedComm(t, result, "ioworkload") + AssertEventsPresent(t, result, []ExpectedEvent{ + { + PathContains: "rdonlyfile.txt", + Tracepoint: "enter_openat", + Comm: "ioworkload", + MinCount: 1, + }, + }) + AssertEventsAbsent(t, result, []ExpectedEvent{ + { + PathContains: "rdonlyfile.txt", + Tracepoint: "enter_write", + Comm: "ioworkload", + }, + }) +} + +func TestAttachTracepointsExcludeByInclusion(t *testing.T) { + h := newTestHarness(t) + + // Negative case: include only write tracepoints; openat must not be captured. + result, pid, err := h.RunWithIorArgs("open-rdonly-write", defaultDuration, []string{ + "-tps", "^sys_enter_write$,^sys_exit_write$", + }) + if err != nil { + t.Fatalf("run scenario open-rdonly-write with write-only include filter: %v", err) + } + + AssertNoUnexpectedPID(t, result, pid) + AssertNoUnexpectedComm(t, result, "ioworkload") + AssertEventsPresent(t, result, []ExpectedEvent{ + { + Tracepoint: "enter_write", + MinCount: 1, + }, + }) + AssertEventsAbsent(t, result, []ExpectedEvent{ + { + Tracepoint: "enter_openat", + }, + }) +} -- cgit v1.2.3