From 065389bac04c71a5dd5f44b2cfe5fe801bafabab Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Feb 2026 21:35:09 +0200 Subject: Add negative integration tests for stat syscalls (task 348) Add three negative test scenarios for stat-family syscalls: - stat-enoent: SYS_STAT on nonexistent file (ENOENT) - stat-access-enoent: SYS_ACCESS on nonexistent file (ENOENT, since tests run as root and EACCES is bypassed) - stat-fstat-ebadf: SYS_FSTAT on invalid fd 99999 (EBADF) Each scenario verifies that ior captures the tracepoint on syscall entry even when the syscall fails. Amp-Thread-ID: https://ampcode.com/threads/T-019c81af-d01d-75db-8a92-37951fb1503c Co-authored-by: Amp --- integrationtests/stat_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'integrationtests/stat_test.go') diff --git a/integrationtests/stat_test.go b/integrationtests/stat_test.go index e38171a..400e61a 100644 --- a/integrationtests/stat_test.go +++ b/integrationtests/stat_test.go @@ -78,3 +78,35 @@ func TestStatFaccessat(t *testing.T) { }, }) } + +func TestStatEnoent(t *testing.T) { + runScenario(t, "stat-enoent", []ExpectedEvent{ + { + PathContains: "stat-enoent-missing.txt", + Tracepoint: "enter_newstat", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestStatAccessEnoent(t *testing.T) { + runScenario(t, "stat-access-enoent", []ExpectedEvent{ + { + PathContains: "access-enoent-missing.txt", + Tracepoint: "enter_access", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestStatFstatEbadf(t *testing.T) { + runScenario(t, "stat-fstat-ebadf", []ExpectedEvent{ + { + Tracepoint: "enter_newfstat", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} -- cgit v1.2.3