1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
package integrationtests
import "testing"
func TestAttachTracepointsIncludeFilter(t *testing.T) {
enableParallelIfRequested(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) {
enableParallelIfRequested(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",
},
})
}
|