diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-13 12:26:44 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-13 12:26:44 +0200 |
| commit | 0d4354bab36c95cd4e8125d2d7b5b66de4ae5d11 (patch) | |
| tree | 0989e1c43610588501eea80589678546a9b30fe1 | |
| parent | 14c15ff8387f5829a2afde5a0792d2e254a452aa (diff) | |
test: stabilize integration error-path workloads
| -rw-r--r-- | integrationtests/cmd/ioworkload/scenario_fcntl.go | 19 | ||||
| -rw-r--r-- | integrationtests/cmd/ioworkload/scenario_stat.go | 7 |
2 files changed, 18 insertions, 8 deletions
diff --git a/integrationtests/cmd/ioworkload/scenario_fcntl.go b/integrationtests/cmd/ioworkload/scenario_fcntl.go index 0d8e642..0c97002 100644 --- a/integrationtests/cmd/ioworkload/scenario_fcntl.go +++ b/integrationtests/cmd/ioworkload/scenario_fcntl.go @@ -96,9 +96,11 @@ func fcntlDupfdCloexec() error { // The syscall fails with EBADF, but ior should capture the enter_fcntl // tracepoint because it is recorded on syscall entry. func fcntlInvalidFd() error { - _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, 99999, syscall.F_GETFL, 0) - if errno == 0 { - return fmt.Errorf("expected fcntl on invalid fd to fail") + for i := 0; i < 5; i++ { + _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, 99999, syscall.F_GETFL, 0) + if errno == 0 { + return fmt.Errorf("expected fcntl on invalid fd to fail") + } } return nil } @@ -120,10 +122,13 @@ func fcntlDupfdMax() error { } defer syscall.Close(fd) - // Use a minfd far beyond any realistic RLIMIT_NOFILE. - _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_DUPFD, 1<<30) - if errno == 0 { - return fmt.Errorf("expected fcntl F_DUPFD with extreme minfd to fail") + // Retry the failing fcntl a few times to avoid a single one-shot call + // racing early trace capture under parallel integration load. + for i := 0; i < 5; i++ { + _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_DUPFD, 1<<30) + if errno == 0 { + return fmt.Errorf("expected fcntl F_DUPFD with extreme minfd to fail") + } } return nil } diff --git a/integrationtests/cmd/ioworkload/scenario_stat.go b/integrationtests/cmd/ioworkload/scenario_stat.go index 154d8b8..5d242c7 100644 --- a/integrationtests/cmd/ioworkload/scenario_stat.go +++ b/integrationtests/cmd/ioworkload/scenario_stat.go @@ -5,6 +5,7 @@ import ( "path/filepath" "runtime" "syscall" + "time" "unsafe" ) @@ -13,6 +14,7 @@ const ( rOK = 0x4 // R_OK statxBasicMask = 0x07ff // STATX_BASIC_STATS atFDCwd = -100 // AT_FDCWD + statRetryDelay = 20 * time.Millisecond ) // statBasic creates a file and stats it via raw SYS_STAT (newstat). @@ -270,12 +272,15 @@ func statAccessEnoent() error { // tracepoint because it is recorded on syscall entry. func statFstatEbadf() error { var stat syscall.Stat_t - for i := 0; i < 5; i++ { + for i := 0; i < 20; 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") } + if i < 19 { + time.Sleep(statRetryDelay) + } } return nil } |
