From 8549884d1d957821b75dfbd5a4ff746667095f17 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 1 Jun 2026 10:31:53 +0300 Subject: 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 --- integrationtests/readwrite_test.go | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'integrationtests/readwrite_test.go') 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 -- cgit v1.2.3