diff options
Diffstat (limited to 'integrationtests/cmd')
| -rw-r--r-- | integrationtests/cmd/ioworkload/main.go | 5 | ||||
| -rw-r--r-- | integrationtests/cmd/ioworkload/scenario_link.go | 24 | ||||
| -rw-r--r-- | integrationtests/cmd/ioworkload/scenario_open.go | 13 |
3 files changed, 26 insertions, 16 deletions
diff --git a/integrationtests/cmd/ioworkload/main.go b/integrationtests/cmd/ioworkload/main.go index 3ed9cb2..1261c9f 100644 --- a/integrationtests/cmd/ioworkload/main.go +++ b/integrationtests/cmd/ioworkload/main.go @@ -11,7 +11,10 @@ import ( "time" ) -const startupDelay = 2 * time.Second +// Give ior enough time to attach tracepoints before scenarios emit syscalls. +// Under parallel integration load, 2s can be too short and cause missed +// first-call events for single-shot scenarios. +const startupDelay = 5 * time.Second func main() { scenario := flag.String("scenario", "", "I/O scenario to execute") diff --git a/integrationtests/cmd/ioworkload/scenario_link.go b/integrationtests/cmd/ioworkload/scenario_link.go index bb16984..beb49a0 100644 --- a/integrationtests/cmd/ioworkload/scenario_link.go +++ b/integrationtests/cmd/ioworkload/scenario_link.go @@ -5,6 +5,7 @@ import ( "path/filepath" "runtime" "syscall" + "time" "unsafe" ) @@ -212,17 +213,22 @@ func linkEnoent() error { return fmt.Errorf("dst path bytes: %w", err) } - _, _, errno := syscall.Syscall( - syscall.SYS_LINK, - uintptr(unsafe.Pointer(srcBytes)), - uintptr(unsafe.Pointer(dstBytes)), - 0, - ) + // Issue the same failing syscall a few times to make capture robust even + // under heavy parallel integration load. + for i := 0; i < 3; i++ { + _, _, errno := syscall.Syscall( + syscall.SYS_LINK, + uintptr(unsafe.Pointer(srcBytes)), + uintptr(unsafe.Pointer(dstBytes)), + 0, + ) + if errno == 0 { + return fmt.Errorf("expected ENOENT, but link succeeded") + } + time.Sleep(20 * time.Millisecond) + } runtime.KeepAlive(srcBytes) runtime.KeepAlive(dstBytes) - if errno == 0 { - return fmt.Errorf("expected ENOENT, but link succeeded") - } return nil } diff --git a/integrationtests/cmd/ioworkload/scenario_open.go b/integrationtests/cmd/ioworkload/scenario_open.go index d86e53b..7a1f15a 100644 --- a/integrationtests/cmd/ioworkload/scenario_open.go +++ b/integrationtests/cmd/ioworkload/scenario_open.go @@ -228,8 +228,9 @@ func openByHandleAtSyscall(mountFD int, handle []byte, flags int) (int, error) { return int(fd), nil } -// openDurationGap creates two openat syscalls separated by a deliberate sleep. -// Integration tests use this to assert durationToPrev captures inter-syscall gaps. +// openDurationGap performs two openat syscalls for the same path and flags, +// separated by a deliberate sleep. Integration tests use this to assert that +// durationToPrev captures inter-syscall gaps for the same event key. func openDurationGap() error { dir, cleanup, err := makeTempDir("open-duration-gap") if err != nil { @@ -237,8 +238,9 @@ func openDurationGap() error { } defer cleanup() - first := filepath.Join(dir, "gap-first.txt") - fd1, err := syscall.Open(first, syscall.O_RDWR|syscall.O_CREAT, 0o644) + path := filepath.Join(dir, "gap-shared.txt") + + fd1, err := syscall.Open(path, syscall.O_RDWR|syscall.O_CREAT, 0o644) if err != nil { return fmt.Errorf("open first: %w", err) } @@ -248,8 +250,7 @@ func openDurationGap() error { time.Sleep(800 * time.Millisecond) - second := filepath.Join(dir, "gap-second.txt") - fd2, err := syscall.Open(second, syscall.O_RDWR|syscall.O_CREAT, 0o644) + fd2, err := syscall.Open(path, syscall.O_RDWR|syscall.O_CREAT, 0o644) if err != nil { return fmt.Errorf("open second: %w", err) } |
