diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-01 10:31:53 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-01 10:31:53 +0300 |
| commit | 8549884d1d957821b75dfbd5a4ff746667095f17 (patch) | |
| tree | c486c6643a86beceafd428a7e8b2d312162426f1 /integrationtests | |
| parent | 1b59bbe42c13a2a60667dff51dc02e0c350434d7 (diff) | |
test(integration): add pwritev/pwritev2 retbytes coverage
Add write-side positional vectored coverage to close the remaining gap
in the pwrite64-family byte-accounting validation. The retbytes/readwrite
integration suite already exercised pwrite64 (scalar) and the read-side
preadv/preadv2, but the WRITE_CLASSIFIED byte attribution for the
vectored positional writes pwritev/pwritev2 was only covered by unit
tests, not end-to-end.
New ioworkload scenarios:
- readwrite-pwritev: issues pwritev (syscall.SYS_PWRITEV) writing a known
two-iovec payload at offset 0 to a temp file.
- readwrite-pwritev2: issues pwritev2 via the explicit syscall number
(328 amd64 / 287 arm64, mirroring preadv2SyscallNr) with offset 0 and
no flags.
New integration tests assert enter_pwritev/enter_pwritev2 fired and that
the attributed retbytes equal the exact iovec total, validating
WRITE_CLASSIFIED end-to-end. Both pass as root.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/readwrite_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/integrationtests/readwrite_test.go b/integrationtests/readwrite_test.go index c1efbb4..f4f528a 100644 --- a/integrationtests/readwrite_test.go +++ b/integrationtests/readwrite_test.go @@ -66,6 +66,45 @@ func TestReadwritePwrite(t *testing.T) { }, 1) } +func TestReadwritePwritev(t *testing.T) { + // pwritev is the positional vectored write sibling of pwrite64/writev and is + // WRITE_CLASSIFIED, so a successful write must attribute the iovec total + // (sum of both buffers) end-to-end. + const payloadLen = uint64(len("pwritev ") + len("test data")) + result, _ := runScenarioResult(t, "readwrite-pwritev", []ExpectedEvent{ + { + PathContains: "pwritevfile.txt", + Tracepoint: "enter_pwritev", + Comm: "ioworkload", + MinCount: 1, + }, + }) + assertEventBytesAtLeast(t, result, ExpectedEvent{ + PathContains: "pwritevfile.txt", + Tracepoint: "enter_pwritev", + Comm: "ioworkload", + }, payloadLen) +} + +func TestReadwritePwritev2(t *testing.T) { + // pwritev2 is the positional vectored write variant with flags; like pwritev + // it is WRITE_CLASSIFIED and must attribute the iovec total end-to-end. + const payloadLen = uint64(len("pwritev2 ") + len("test data")) + result, _ := runScenarioResult(t, "readwrite-pwritev2", []ExpectedEvent{ + { + PathContains: "pwritev2file.txt", + Tracepoint: "enter_pwritev2", + Comm: "ioworkload", + MinCount: 1, + }, + }) + assertEventBytesAtLeast(t, result, ExpectedEvent{ + PathContains: "pwritev2file.txt", + Tracepoint: "enter_pwritev2", + Comm: "ioworkload", + }, payloadLen) +} + func TestReadwritePreadv(t *testing.T) { // preadv is the positional vectored read sibling of pread64/readv and is // READ_CLASSIFIED, so a successful read must attribute the payload bytes |
