summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-21 20:39:06 +0200
committerPaul Buetow <paul@buetow.org>2026-02-21 20:39:06 +0200
commit1a121009a7d3927c688fe7dac82cac45b043965d (patch)
tree48e6c1904f7a04db8e41565a3ea687742ea4d74e /integrationtests
parent6e12cd09899cf8f3d3cd10abf3e8ea15acf1f8e0 (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')
-rw-r--r--integrationtests/cmd/ioworkload/scenarios.go15
-rw-r--r--integrationtests/open_test.go2
-rw-r--r--integrationtests/rename_test.go6
3 files changed, 15 insertions, 8 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.
diff --git a/integrationtests/open_test.go b/integrationtests/open_test.go
index 3f07ae3..917ce79 100644
--- a/integrationtests/open_test.go
+++ b/integrationtests/open_test.go
@@ -17,7 +17,7 @@ func TestOpenCreat(t *testing.T) {
runScenario(t, "open-creat", []ExpectedEvent{
{
PathContains: "creatfile.txt",
- Tracepoint: "enter_openat",
+ Tracepoint: "enter_creat",
Comm: "ioworkload",
MinCount: 1,
},
diff --git a/integrationtests/rename_test.go b/integrationtests/rename_test.go
index 8e3238d..0ae1d47 100644
--- a/integrationtests/rename_test.go
+++ b/integrationtests/rename_test.go
@@ -5,7 +5,7 @@ import "testing"
func TestRenameBasic(t *testing.T) {
runScenario(t, "rename-basic", []ExpectedEvent{
{
- PathContains: "oldname.txt",
+ PathContains: "newname.txt",
Tracepoint: "enter_rename",
Comm: "ioworkload",
MinCount: 1,
@@ -16,7 +16,7 @@ func TestRenameBasic(t *testing.T) {
func TestRenameRenameat(t *testing.T) {
runScenario(t, "rename-renameat", []ExpectedEvent{
{
- PathContains: "renameat-old.txt",
+ PathContains: "renameat-new.txt",
Tracepoint: "enter_renameat",
Comm: "ioworkload",
MinCount: 1,
@@ -27,7 +27,7 @@ func TestRenameRenameat(t *testing.T) {
func TestRenameRenameat2(t *testing.T) {
runScenario(t, "rename-renameat2", []ExpectedEvent{
{
- PathContains: "renameat2-old.txt",
+ PathContains: "renameat2-new.txt",
Tracepoint: "enter_renameat2",
Comm: "ioworkload",
MinCount: 1,