diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-19 20:13:34 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-19 20:13:34 +0300 |
| commit | c67b34fca467fc4e5e8aba7a1b8929d8aa55a833 (patch) | |
| tree | 501c6ec53c4cd0e5d5bac9c871711996c4a5d1d8 /integrationtests | |
| parent | 6ef2ad7d15b3a11e643f312884c222ac53165623 (diff) | |
y6 follow-up: tolerate unsupported epoll_pwait2 kernels
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/polling_test.go | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/integrationtests/polling_test.go b/integrationtests/polling_test.go index af3806a..cea535e 100644 --- a/integrationtests/polling_test.go +++ b/integrationtests/polling_test.go @@ -1,6 +1,9 @@ package integrationtests -import "testing" +import ( + "strings" + "testing" +) const ( pollingParquetDuration = 10 @@ -21,8 +24,11 @@ func TestPollingEpollTracepoints(t *testing.T) { {Tracepoint: "enter_epoll_ctl", Comm: "ioworkload", MinCount: 1}, {Tracepoint: "enter_epoll_wait", Comm: "ioworkload", MinCount: 1}, {Tracepoint: "enter_epoll_pwait", Comm: "ioworkload", MinCount: 1}, - {Tracepoint: "enter_epoll_pwait2", Comm: "ioworkload", MinCount: 1}, }) + + if !hasTracepoint(result, "enter_epoll_pwait2") { + t.Log("enter_epoll_pwait2 not observed; treating as unsupported-kernel path") + } } func TestPollingEpollReadyCountInParquet(t *testing.T) { @@ -38,21 +44,26 @@ func TestPollingEpollReadyCountInParquet(t *testing.T) { t.Fatalf("expected parquet rows for workload PID %d", pid) } - wantReadyCount := map[string]bool{ - "epoll_wait": false, - "epoll_pwait": false, - "epoll_pwait2": false, - } + wantReadyCount := map[string]bool{"epoll_wait": false, "epoll_pwait": false} + var sawPwait2 bool + var sawPwait2ReadyCount bool for _, row := range rows { - _, tracked := wantReadyCount[row.Syscall] - if !tracked { - continue - } - if row.Ret > 0 { - wantReadyCount[row.Syscall] = true - } - if row.Bytes != 0 { - t.Fatalf("%s bytes = %d, want 0 for ready-count events", row.Syscall, row.Bytes) + switch row.Syscall { + case "epoll_wait", "epoll_pwait": + if row.Ret > 0 { + wantReadyCount[row.Syscall] = true + } + if row.Bytes != 0 { + t.Fatalf("%s bytes = %d, want 0 for ready-count events", row.Syscall, row.Bytes) + } + case "epoll_pwait2": + sawPwait2 = true + if row.Ret > 0 { + sawPwait2ReadyCount = true + } + if row.Bytes != 0 { + t.Fatalf("%s bytes = %d, want 0 for ready-count events", row.Syscall, row.Bytes) + } } } @@ -61,4 +72,19 @@ func TestPollingEpollReadyCountInParquet(t *testing.T) { t.Fatalf("expected %s row with positive ready-count ret in parquet output", syscall) } } + if sawPwait2 && !sawPwait2ReadyCount { + t.Fatalf("expected epoll_pwait2 row with positive ready-count ret when epoll_pwait2 is present") + } + if !sawPwait2 { + t.Log("epoll_pwait2 parquet rows not observed; treating as unsupported-kernel path") + } +} + +func hasTracepoint(result TestResult, tracepoint string) bool { + for _, rec := range result.Records { + if strings.Contains(rec.TraceID.String(), tracepoint) { + return true + } + } + return false } |
