From 08cb9dfe46f843114feb42cc9ffa599717ebcc32 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Feb 2026 21:44:11 +0200 Subject: Add negative integration tests for truncate syscalls (task 348) Add two negative test scenarios: - truncate-enoent: SYS_TRUNCATE on nonexistent file, expects ENOENT - truncate-ftruncate-ebadf: SYS_FTRUNCATE on invalid fd 99999, expects EBADF Both verify ior captures tracepoints even when syscalls fail. Amp-Thread-ID: https://ampcode.com/threads/T-019c81b7-9641-763e-b99e-20a0d3552005 Co-authored-by: Amp --- integrationtests/truncate_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'integrationtests/truncate_test.go') diff --git a/integrationtests/truncate_test.go b/integrationtests/truncate_test.go index 9b94eed..7d3f12e 100644 --- a/integrationtests/truncate_test.go +++ b/integrationtests/truncate_test.go @@ -23,3 +23,24 @@ func TestTruncateFtruncate(t *testing.T) { }, }) } + +func TestTruncateEnoent(t *testing.T) { + runScenario(t, "truncate-enoent", []ExpectedEvent{ + { + PathContains: "truncate-enoent-missing.txt", + Tracepoint: "enter_truncate", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestTruncateFtruncateEbadf(t *testing.T) { + runScenario(t, "truncate-ftruncate-ebadf", []ExpectedEvent{ + { + Tracepoint: "enter_ftruncate", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} -- cgit v1.2.3