From c36cb85503ce96a589a2dd38c1279b31c87164f2 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Feb 2026 21:31:16 +0200 Subject: Add negative integration tests for dir syscalls (task 348) Add three negative test scenarios for directory operations: - dir-mkdir-eexist: SYS_MKDIR on existing directory (EEXIST) - dir-chdir-enoent: SYS_CHDIR to nonexistent directory (ENOENT) - dir-getdents-ebadf: SYS_GETDENTS64 with invalid fd (EBADF) All use raw syscalls to hit exact tracepoints. Tests verify ior captures events even when syscalls fail (entry-side capture). Amp-Thread-ID: https://ampcode.com/threads/T-019c81ab-0d62-726e-b859-91b4898be6fe Co-authored-by: Amp --- integrationtests/dir_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'integrationtests/dir_test.go') diff --git a/integrationtests/dir_test.go b/integrationtests/dir_test.go index 67bbe93..585f03f 100644 --- a/integrationtests/dir_test.go +++ b/integrationtests/dir_test.go @@ -45,3 +45,35 @@ func TestDirGetdents(t *testing.T) { }, }) } + +func TestDirMkdirEexist(t *testing.T) { + runScenario(t, "dir-mkdir-eexist", []ExpectedEvent{ + { + PathContains: "mkdir-eexist-subdir", + Tracepoint: "enter_mkdir", + Comm: "ioworkload", + MinCount: 2, + }, + }) +} + +func TestDirChdirEnoent(t *testing.T) { + runScenario(t, "dir-chdir-enoent", []ExpectedEvent{ + { + PathContains: "chdir-enoent-missing", + Tracepoint: "enter_chdir", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestDirGetdentsEbadf(t *testing.T) { + runScenario(t, "dir-getdents-ebadf", []ExpectedEvent{ + { + Tracepoint: "enter_getdents64", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} -- cgit v1.2.3