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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
package integrationtests
import "testing"
// TestUtimeBasic verifies that ior captures the enter_utime tracepoint with the
// real file path. utime(2) takes a genuine filesystem path at args[0]
// ("filename"), so it must be path-classified (KindPathname), just like its
// siblings utimensat/futimesat.
func TestUtimeBasic(t *testing.T) {
runScenario(t, "utime-basic", []ExpectedEvent{
{
PathContains: "utimefile.txt",
Tracepoint: "enter_utime",
Comm: "ioworkload",
MinCount: 1,
},
})
}
// TestUtimeUtimes verifies the microsecond-resolution sibling utimes(2) is
// likewise path-classified and its filename path captured.
func TestUtimeUtimes(t *testing.T) {
runScenario(t, "utime-utimes", []ExpectedEvent{
{
PathContains: "utimesfile.txt",
Tracepoint: "enter_utimes",
Comm: "ioworkload",
MinCount: 1,
},
})
}
// TestUtimeFutimesat verifies the dirfd-relative sibling futimesat(2) is
// path-classified and its filename captured from args[1] (after the dirfd at
// args[0]). The scenario passes AT_FDCWD as the dirfd, so a hit on the file
// name proves ior reads the path from the second arg, not the first.
func TestUtimeFutimesat(t *testing.T) {
runScenario(t, "utime-futimesat", []ExpectedEvent{
{
PathContains: "futimesatfile.txt",
Tracepoint: "enter_futimesat",
Comm: "ioworkload",
MinCount: 1,
},
})
}
// TestUtimeUtimensat verifies the nanosecond-resolution sibling utimensat(2) is
// path-classified and its filename captured from args[1] (after the dirfd at
// args[0]). As with futimesat, AT_FDCWD is passed as the dirfd, so matching the
// file name confirms the path is read from the second arg.
func TestUtimeUtimensat(t *testing.T) {
runScenario(t, "utime-utimensat", []ExpectedEvent{
{
PathContains: "utimensatfile.txt",
Tracepoint: "enter_utimensat",
Comm: "ioworkload",
MinCount: 1,
},
})
}
// TestUtimeEnoent verifies the path is still captured on the error path:
// utime(2) on a missing file fails with ENOENT, but ior records enter_utime
// because the filename is read on syscall entry.
func TestUtimeEnoent(t *testing.T) {
runScenario(t, "utime-enoent", []ExpectedEvent{
{
PathContains: "utime-enoent-missing.txt",
Tracepoint: "enter_utime",
Comm: "ioworkload",
MinCount: 1,
},
})
}
|