diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-21 20:39:06 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-21 20:39:06 +0200 |
| commit | 1a121009a7d3927c688fe7dac82cac45b043965d (patch) | |
| tree | 48e6c1904f7a04db8e41565a3ea687742ea4d74e /integrationtests/cmd | |
| parent | 6e12cd09899cf8f3d3cd10abf3e8ea15acf1f8e0 (diff) | |
Fix integration test expectations to test actual syscall outcomes (task 349)
- rename_test.go: Fix PathContains to use destination names (newname.txt,
renameat-new.txt, renameat2-new.txt) since name_events use Newname as
the path in ior output, not the source name
- open_test.go: Change expected tracepoint from enter_openat to enter_creat
- scenarios.go: Use raw SYS_CREAT instead of Go's syscall.Creat which
wraps openat on amd64, so the creat tracepoint is actually exercised
- Created task 350 for close_range path resolution bug found during review
Amp-Thread-ID: https://ampcode.com/threads/T-019c8178-1c1f-7509-9ac9-bd48b970945b
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'integrationtests/cmd')
| -rw-r--r-- | integrationtests/cmd/ioworkload/scenarios.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/integrationtests/cmd/ioworkload/scenarios.go b/integrationtests/cmd/ioworkload/scenarios.go index 1ca7328..cb9f455 100644 --- a/integrationtests/cmd/ioworkload/scenarios.go +++ b/integrationtests/cmd/ioworkload/scenarios.go @@ -85,7 +85,9 @@ func openBasic() error { return syscall.Close(fd) } -// openCreat uses the creat syscall to create a file. +// openCreat creates a file via raw SYS_CREAT. +// Go's syscall.Creat wraps Open which delegates to openat on amd64, +// so we use the raw syscall to actually exercise the creat tracepoint. func openCreat() error { dir, cleanup, err := makeTempDir("open-creat") if err != nil { @@ -94,11 +96,16 @@ func openCreat() error { defer cleanup() path := filepath.Join(dir, "creatfile.txt") - fd, err := syscall.Creat(path, 0o644) + pathBytes, err := syscall.BytePtrFromString(path) if err != nil { - return fmt.Errorf("creat: %w", err) + return fmt.Errorf("path bytes: %w", err) } - return syscall.Close(fd) + fd, _, errno := syscall.Syscall(syscall.SYS_CREAT, uintptr(unsafe.Pointer(pathBytes)), 0o644, 0) + runtime.KeepAlive(pathBytes) + if errno != 0 { + return fmt.Errorf("creat: %w", errno) + } + return syscall.Close(int(fd)) } // readwriteBasic opens a file, writes data, seeks to start, reads it back. |
