summaryrefslogtreecommitdiff
path: root/integrationtests/copy_file_range_test.go
blob: b8e81a6cdc73fcfe7b2a3014789cbe6024486326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package integrationtests

import "testing"

func TestCopyFileRangeBasic(t *testing.T) {
	result, _ := runScenarioResult(t, "copy-file-range-basic", []ExpectedEvent{
		{
			PathContains: "copyrangesrc.txt",
			Tracepoint:   "enter_copy_file_range",
			Comm:         "ioworkload",
			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) {
	runScenario(t, "copy-file-range-bad-dst-fd", []ExpectedEvent{
		{
			PathContains: "copyrangeebadfsrc.txt",
			Tracepoint:   "enter_copy_file_range",
			Comm:         "ioworkload",
			MinCount:     1,
		},
	})
}