diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-23 21:57:35 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-23 21:57:35 +0200 |
| commit | c58ef78b4a79a5cbc9531a74c6e3965ea4c00bc2 (patch) | |
| tree | 29944a45cf7d00d781a232020b327203b1a72b75 /integrationtests/cmd/ioworkload/scenario_stat.go | |
| parent | aa19be8c624a6adc3ecbf11a6ee0506a5c7d34fe (diff) | |
Harden integration workloads against dropped event flakes
Diffstat (limited to 'integrationtests/cmd/ioworkload/scenario_stat.go')
| -rw-r--r-- | integrationtests/cmd/ioworkload/scenario_stat.go | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/integrationtests/cmd/ioworkload/scenario_stat.go b/integrationtests/cmd/ioworkload/scenario_stat.go index ce9807d..154d8b8 100644 --- a/integrationtests/cmd/ioworkload/scenario_stat.go +++ b/integrationtests/cmd/ioworkload/scenario_stat.go @@ -226,11 +226,14 @@ func statEnoent() error { return fmt.Errorf("path bytes: %w", err) } var stat syscall.Stat_t - _, _, errno := syscall.Syscall(syscall.SYS_STAT, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(&stat)), 0) - runtime.KeepAlive(pathBytes) - runtime.KeepAlive(&stat) - if errno == 0 { - return fmt.Errorf("expected ENOENT, but stat succeeded") + // Retry a few times to reduce dropped-event flakiness under high parallelism. + for i := 0; i < 5; i++ { + _, _, errno := syscall.Syscall(syscall.SYS_STAT, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(&stat)), 0) + runtime.KeepAlive(pathBytes) + runtime.KeepAlive(&stat) + if errno == 0 { + return fmt.Errorf("expected ENOENT, but stat succeeded") + } } return nil } @@ -252,10 +255,12 @@ func statAccessEnoent() error { if err != nil { return fmt.Errorf("path bytes: %w", err) } - _, _, errno := syscall.Syscall(syscall.SYS_ACCESS, uintptr(unsafe.Pointer(pathBytes)), rOK, 0) - runtime.KeepAlive(pathBytes) - if errno == 0 { - return fmt.Errorf("expected ENOENT, but access succeeded") + for i := 0; i < 5; i++ { + _, _, errno := syscall.Syscall(syscall.SYS_ACCESS, uintptr(unsafe.Pointer(pathBytes)), rOK, 0) + runtime.KeepAlive(pathBytes) + if errno == 0 { + return fmt.Errorf("expected ENOENT, but access succeeded") + } } return nil } @@ -265,10 +270,12 @@ func statAccessEnoent() error { // tracepoint because it is recorded on syscall entry. func statFstatEbadf() error { var stat syscall.Stat_t - _, _, errno := syscall.Syscall(syscall.SYS_FSTAT, 99999, uintptr(unsafe.Pointer(&stat)), 0) - runtime.KeepAlive(&stat) - if errno == 0 { - return fmt.Errorf("expected EBADF, but fstat succeeded") + for i := 0; i < 5; i++ { + _, _, errno := syscall.Syscall(syscall.SYS_FSTAT, 99999, uintptr(unsafe.Pointer(&stat)), 0) + runtime.KeepAlive(&stat) + if errno == 0 { + return fmt.Errorf("expected EBADF, but fstat succeeded") + } } return nil } |
