diff options
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/readwrite_test.go | 19 | ||||
| -rw-r--r-- | integrationtests/retbytes_test.go | 35 |
2 files changed, 54 insertions, 0 deletions
diff --git a/integrationtests/readwrite_test.go b/integrationtests/readwrite_test.go index 4e8cbef..69f60ea 100644 --- a/integrationtests/readwrite_test.go +++ b/integrationtests/readwrite_test.go @@ -228,3 +228,22 @@ func assertEventBytesReasonable(t *testing.T, result TestResult, exp ExpectedEve t.Fatalf("expected event not found while asserting byte range: %+v", exp) } } + +func assertEventDurationPositive(t *testing.T, result TestResult, exp ExpectedEvent) { + t.Helper() + var matched bool + var totalDuration uint64 + for _, rec := range result.Records { + if !matchesExpectation(rec, exp) { + continue + } + matched = true + totalDuration += rec.Cnt.Duration + } + if !matched { + t.Fatalf("expected event not found while asserting duration: %+v", exp) + } + if totalDuration == 0 { + t.Fatalf("duration for %+v is zero", exp) + } +} diff --git a/integrationtests/retbytes_test.go b/integrationtests/retbytes_test.go new file mode 100644 index 0000000..2e2ea1d --- /dev/null +++ b/integrationtests/retbytes_test.go @@ -0,0 +1,35 @@ +package integrationtests + +import "testing" + +func TestRetbytesPhaseA(t *testing.T) { + const payloadLen = uint64(18) + + result, _ := runScenarioResult(t, "retbytes-phase-a", []ExpectedEvent{ + {Tracepoint: "enter_sendto", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_recvfrom", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_sendmsg", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_recvmsg", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_sendfile64", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_splice", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_tee", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_process_vm_writev", Comm: "ioworkload", MinCount: 1}, + {Tracepoint: "enter_process_vm_readv", Comm: "ioworkload", MinCount: 1}, + }) + + for _, tracepoint := range []string{ + "enter_sendto", + "enter_recvfrom", + "enter_sendmsg", + "enter_recvmsg", + "enter_sendfile64", + "enter_splice", + "enter_tee", + "enter_process_vm_writev", + "enter_process_vm_readv", + } { + exp := ExpectedEvent{Tracepoint: tracepoint, Comm: "ioworkload"} + assertEventBytesAtLeast(t, result, exp, payloadLen) + assertEventDurationPositive(t, result, exp) + } +} |
