From fc4d0a4332ba72d9ecbb46b1233bd39fac80812f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Jun 2026 09:10:36 +0300 Subject: test(copy_file_range): assert TRANSFER_CLASSIFIED copied byte count end-to-end TestCopyFileRangeBasic previously asserted only the enter event and source path (copyrangesrc.txt) but not the copied byte count on the TRANSFER_CLASSIFIED exit, unlike sibling sendfile64/splice/tee coverage in retbytes_test.go. The basic scenario copies exactly the 32-byte payload "copy_file_range integration data" in a single copy_file_range(2) call, so the exit byte count is deterministic. Switch to runScenarioResult and add assertEventBytesEqual(...,32) plus assertEventDurationPositive to lock in the transfer attribution (FamilyFS, fd_in@args[0], ret TransferClassified). Coverage hardening only; no defect. Co-Authored-By: Claude Opus 4.8 --- integrationtests/copy_file_range_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/integrationtests/copy_file_range_test.go b/integrationtests/copy_file_range_test.go index d87c5af..b8e81a6 100644 --- a/integrationtests/copy_file_range_test.go +++ b/integrationtests/copy_file_range_test.go @@ -3,7 +3,7 @@ package integrationtests import "testing" func TestCopyFileRangeBasic(t *testing.T) { - runScenario(t, "copy-file-range-basic", []ExpectedEvent{ + result, _ := runScenarioResult(t, "copy-file-range-basic", []ExpectedEvent{ { PathContains: "copyrangesrc.txt", Tracepoint: "enter_copy_file_range", @@ -11,6 +11,16 @@ func TestCopyFileRangeBasic(t *testing.T) { MinCount: 1, }, }) + + // copy_file_range is TRANSFER_CLASSIFIED: a successful call reports + // ctx->ret > 0, the number of bytes copied from fd_in to fd_out. The + // basic scenario copies exactly the 32-byte payload + // ("copy_file_range integration data") in a single call, so the exit + // byte count is deterministic and must equal 32. Locking in the exact + // count guards the transfer attribution (FamilyFS, fd_in@args[0]). + exp := ExpectedEvent{Tracepoint: "enter_copy_file_range", Comm: "ioworkload"} + assertEventBytesEqual(t, result, exp, 32) + assertEventDurationPositive(t, result, exp) } func TestCopyFileRangeBadDstFd(t *testing.T) { -- cgit v1.2.3