diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-21 20:57:21 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-21 20:57:21 +0200 |
| commit | be7f8fc048fd92eb806159de5bdb3a3becea3c16 (patch) | |
| tree | c05866163ec261f92bdae80ab07cb0abd210c32d /integrationtests/readwrite_test.go | |
| parent | cd516e1577ad97d5c8b1603657b13d110557e1b2 (diff) | |
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 <amp@ampcode.com>
Diffstat (limited to 'integrationtests/readwrite_test.go')
| -rw-r--r-- | integrationtests/readwrite_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
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, + }, + }) +} |
