summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-23 10:34:37 +0200
committerPaul Buetow <paul@buetow.org>2026-02-23 10:34:37 +0200
commita1eb580aa5b80e913dc722ccf97e42c6987152e8 (patch)
tree845b3da7d8d6a0d11e28dea1b82bbf39e0e401b4 /integrationtests
parent9e7b820cfacb50299720b9d391de907d6f3fbdec (diff)
Add getcwd tracing support and stabilize comm propagation test
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/cmd/ioworkload/scenario_dir.go30
-rw-r--r--integrationtests/cmd/ioworkload/scenarios.go1
-rw-r--r--integrationtests/dir_test.go11
3 files changed, 42 insertions, 0 deletions
diff --git a/integrationtests/cmd/ioworkload/scenario_dir.go b/integrationtests/cmd/ioworkload/scenario_dir.go
index 0c48d54..282c903 100644
--- a/integrationtests/cmd/ioworkload/scenario_dir.go
+++ b/integrationtests/cmd/ioworkload/scenario_dir.go
@@ -6,6 +6,7 @@ import (
"path/filepath"
"runtime"
"syscall"
+ "time"
"unsafe"
)
@@ -83,6 +84,35 @@ func dirChdir() error {
return nil
}
+// dirGetcwd changes into a temp directory and calls getcwd(2) directly.
+func dirGetcwd() error {
+ origDir, err := os.Getwd()
+ if err != nil {
+ return fmt.Errorf("getwd: %w", err)
+ }
+
+ dir, cleanup, err := makeTempDir("dir-getcwd")
+ if err != nil {
+ return err
+ }
+ defer cleanup()
+ defer syscall.Chdir(origDir)
+
+ if err := syscall.Chdir(dir); err != nil {
+ return fmt.Errorf("chdir: %w", err)
+ }
+
+ buf := make([]byte, 4096)
+ _, _, errno := syscall.Syscall(syscall.SYS_GETCWD, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)), 0)
+ runtime.KeepAlive(buf)
+ if errno != 0 {
+ return fmt.Errorf("getcwd: %w", errno)
+ }
+ // Keep cwd unchanged long enough for ior to process enter/exit pairing.
+ time.Sleep(300 * time.Millisecond)
+ return nil
+}
+
// dirGetdents opens a directory and reads its entries via getdents64(2).
func dirGetdents() error {
dir, cleanup, err := makeTempDir("dir-getdents")
diff --git a/integrationtests/cmd/ioworkload/scenarios.go b/integrationtests/cmd/ioworkload/scenarios.go
index f9a8e47..a1c32f7 100644
--- a/integrationtests/cmd/ioworkload/scenarios.go
+++ b/integrationtests/cmd/ioworkload/scenarios.go
@@ -60,6 +60,7 @@ var scenarios = map[string]func() error{
"dir-basic": dirBasic,
"dir-mkdirat": dirMkdirat,
"dir-chdir": dirChdir,
+ "dir-getcwd": dirGetcwd,
"dir-getdents": dirGetdents,
"dir-mkdir-eexist": dirMkdirEexist,
"dir-chdir-enoent": dirChdirEnoent,
diff --git a/integrationtests/dir_test.go b/integrationtests/dir_test.go
index 585f03f..d759abd 100644
--- a/integrationtests/dir_test.go
+++ b/integrationtests/dir_test.go
@@ -35,6 +35,17 @@ func TestDirChdir(t *testing.T) {
})
}
+func TestDirGetcwd(t *testing.T) {
+ runScenario(t, "dir-getcwd", []ExpectedEvent{
+ {
+ PathContains: "dir-getcwd",
+ Tracepoint: "enter_getcwd",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+}
+
func TestDirGetdents(t *testing.T) {
runScenario(t, "dir-getdents", []ExpectedEvent{
{