summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-06 09:10:36 +0300
committerPaul Buetow <paul@buetow.org>2026-06-06 09:10:36 +0300
commitfc4d0a4332ba72d9ecbb46b1233bd39fac80812f (patch)
tree687d09dcd900b2df6560992dc0bd1999f972dd85
parentade74696f89dc98b3472bbacd9f36860ca83e3c5 (diff)
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 <noreply@anthropic.com>
-rw-r--r--integrationtests/copy_file_range_test.go12
1 files changed, 11 insertions, 1 deletions
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) {