diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-21 21:25:27 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-21 21:25:27 +0200 |
| commit | b443f001cce8662a7fdccd4e0e7f707f7b2b47b8 (patch) | |
| tree | 017138e189d77bd537a9d4a0d22f28fb2aa5147e /integrationtests/unlink_test.go | |
| parent | 69395ffff024254b114eeba543af68cc6ca77f0c (diff) | |
Add negative integration tests for unlink syscalls (task 348)
Add three negative test scenarios for unlink syscall family:
- unlink-enoent: SYS_UNLINK on nonexistent file (ENOENT)
- unlink-rmdir-notempty: SYS_RMDIR on non-empty directory (ENOTEMPTY)
- unlink-unlinkat-enoent: SYS_UNLINKAT on nonexistent file (ENOENT)
All scenarios use raw syscalls to hit exact tracepoints and verify
ior captures them on entry even when the kernel returns an error.
Amp-Thread-ID: https://ampcode.com/threads/T-019c81a6-6612-7247-9d54-6da5b63a38b4
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'integrationtests/unlink_test.go')
| -rw-r--r-- | integrationtests/unlink_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/integrationtests/unlink_test.go b/integrationtests/unlink_test.go index 942f43d..3e61991 100644 --- a/integrationtests/unlink_test.go +++ b/integrationtests/unlink_test.go @@ -34,3 +34,36 @@ func TestUnlinkRmdir(t *testing.T) { }, }) } + +func TestUnlinkEnoent(t *testing.T) { + runScenario(t, "unlink-enoent", []ExpectedEvent{ + { + PathContains: "unlink-enoent-missing.txt", + Tracepoint: "enter_unlink", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestUnlinkRmdirNotempty(t *testing.T) { + runScenario(t, "unlink-rmdir-notempty", []ExpectedEvent{ + { + PathContains: "rmdir-notempty", + Tracepoint: "enter_rmdir", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestUnlinkUnlinkatEnoent(t *testing.T) { + runScenario(t, "unlink-unlinkat-enoent", []ExpectedEvent{ + { + PathContains: "unlinkat-enoent-missing.txt", + Tracepoint: "enter_unlinkat", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} |
