From be7f8fc048fd92eb806159de5bdb3a3becea3c16 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Feb 2026 20:57:21 +0200 Subject: Add negative integration tests for readwrite syscalls (task 348) Add four negative scenarios that verify ior captures tracepoints even when syscalls fail: - readwrite-wronly-read: read from O_WRONLY fd (EBADF) - readwrite-rdonly-write: write to O_RDONLY fd (EBADF) - readwrite-pread-invalid: pread64 with negative offset (EINVAL) - readwrite-pwrite-invalid: pwrite64 with negative offset (EINVAL) Amp-Thread-ID: https://ampcode.com/threads/T-019c818c-ec91-7673-a5ba-e9b2ba53379b Co-authored-by: Amp --- integrationtests/readwrite_test.go | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'integrationtests/readwrite_test.go') diff --git a/integrationtests/readwrite_test.go b/integrationtests/readwrite_test.go index 3770ae1..e7492ec 100644 --- a/integrationtests/readwrite_test.go +++ b/integrationtests/readwrite_test.go @@ -62,3 +62,47 @@ func TestReadwriteWritev(t *testing.T) { }, }) } + +func TestReadwriteWronlyRead(t *testing.T) { + runScenario(t, "readwrite-wronly-read", []ExpectedEvent{ + { + PathContains: "wronlyfile.txt", + Tracepoint: "enter_read", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestReadwriteRdonlyWrite(t *testing.T) { + runScenario(t, "readwrite-rdonly-write", []ExpectedEvent{ + { + PathContains: "rdonlywritefile.txt", + Tracepoint: "enter_write", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestReadwritePreadInvalid(t *testing.T) { + runScenario(t, "readwrite-pread-invalid", []ExpectedEvent{ + { + PathContains: "preadinvalid.txt", + Tracepoint: "enter_pread64", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestReadwritePwriteInvalid(t *testing.T) { + runScenario(t, "readwrite-pwrite-invalid", []ExpectedEvent{ + { + PathContains: "pwriteinvalid.txt", + Tracepoint: "enter_pwrite64", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} -- cgit v1.2.3