diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-06 09:43:50 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-06 09:43:50 +0300 |
| commit | 4292b4ef116ec72b66f3c19f8a9a00458d441b79 (patch) | |
| tree | ef88511e8261174cda9dbc44ead2f82f6aace967 /integrationtests/utime_test.go | |
| parent | 494c277bd4937c0c8a4fce4f53401053036925b1 (diff) | |
test(utime): add end-to-end coverage for futimesat and utimensat
utime_test.go previously covered only utime/utimes/ENOENT. Add scenarios
and tests for the dirfd-relative siblings futimesat(2) and utimensat(2),
which take a dirfd at args[0] and the pathname at args[1]. Both scenarios
use raw syscalls with AT_FDCWD as the dirfd so the exact enter_futimesat
and enter_utimensat tracepoints fire, and the tests assert PathContains
the filename, proving ior captures the path from args[1] (after the
dirfd). Classification/tracing were already verified by audits qt/f10;
this is pure coverage.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/utime_test.go')
| -rw-r--r-- | integrationtests/utime_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/integrationtests/utime_test.go b/integrationtests/utime_test.go index b1e6fdc..7bedcba 100644 --- a/integrationtests/utime_test.go +++ b/integrationtests/utime_test.go @@ -30,6 +30,36 @@ func TestUtimeUtimes(t *testing.T) { }) } +// 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. |
