diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-06 09:16:11 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-06 09:16:11 +0300 |
| commit | e44475525894cb5a184e7fecd449c258f204f189 (patch) | |
| tree | cf2c3d69e1671c80f215d56cf2fa69ab1997e85d /integrationtests | |
| parent | fc4d0a4332ba72d9ecbb46b1233bd39fac80812f (diff) | |
test(chmod): add end-to-end coverage for chmod/fchmod/fchmodat family
chmod/fchmod/fchmodat/fchmodat2 previously had no integration coverage:
no scenario in cmd/ioworkload/ and no test in integrationtests/. All four
are correctly classified (chmod KindPathname args[0]; fchmodat/fchmodat2
KindPathname args[1]; fchmod KindFd args[0]; all FamilyFS, all UNCLASSIFIED
ret) but nothing exercised them end-to-end.
Add a chmod-basic scenario that, on a temp file the caller owns (so all
calls are unprivileged), issues raw chmod(path, 0640), fchmodat(AT_FDCWD,
path, 0644, 0), fchmod(fd, 0644), and best-effort fchmodat2(AT_FDCWD, path,
0640, 0) (raw syscall 452, ENOSYS tolerated on kernels < 6.6). Raw syscalls
are used so each distinct tracepoint fires rather than glibc redirecting
chmod to fchmodat.
TestChmodBasic asserts enter_chmod and enter_fchmodat capture the file path
(chmodfile.txt) and enter_fchmod fires (KindFd, no path). fchmodat2 is not
asserted since it is version-gated, though it does fire on current kernels.
Mirrors the utime coverage (scenario_utime.go / utime_test.go).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/chmod_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/integrationtests/chmod_test.go b/integrationtests/chmod_test.go new file mode 100644 index 0000000..7c08be8 --- /dev/null +++ b/integrationtests/chmod_test.go @@ -0,0 +1,32 @@ +package integrationtests + +import "testing" + +// TestChmodBasic verifies ior captures the chmod permission-change family +// end-to-end. chmod and fchmodat take a real filesystem path (args[0] and +// args[1] respectively), so both must be path-classified (KindPathname) and +// the file path captured. fchmod operates on an open fd (KindFd) and carries +// no path, so we only assert the tracepoint fired. fchmodat2 is best-effort +// (ENOSYS on kernels < 6.6) and not asserted; the running kernel is 6.x+, so +// it does fire in practice, but the older siblings are the stable assertions. +func TestChmodBasic(t *testing.T) { + runScenario(t, "chmod-basic", []ExpectedEvent{ + { + PathContains: "chmodfile.txt", + Tracepoint: "enter_chmod", + Comm: "ioworkload", + MinCount: 1, + }, + { + PathContains: "chmodfile.txt", + Tracepoint: "enter_fchmodat", + Comm: "ioworkload", + MinCount: 1, + }, + { + Tracepoint: "enter_fchmod", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} |
