From 783c551f8e7f293b723e44386e50c4739075e2d4 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 31 May 2026 10:27:26 +0300 Subject: test(openat2): add end-to-end integration coverage for openat2 openat2(2) is the one open-family syscall with a structurally distinct argument layout: flags/mode live inside the open_how struct (args[2]), not as a plain int, and args[3] is the struct size. The tracer correctly reads the path from args[1] and omits flags (ev->flags = -1) rather than misreading the struct ptr/size, and registers the returned fd->path mapping via the shared handleOpenExit path. This was verified by inspection but had no integration scenario, unlike open/openat/creat/ open_by_handle_at. Add an open-openat2 ioworkload scenario issuing the raw openat2 syscall (Go has no wrapper and routes Open through openat) and a TestOpenOpenat2 integration test asserting the enter_openat2 tracepoint captures the path. Verified passing as root. Co-Authored-By: Claude Opus 4.8 --- integrationtests/open_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'integrationtests') diff --git a/integrationtests/open_test.go b/integrationtests/open_test.go index 98419ad..6bdb396 100644 --- a/integrationtests/open_test.go +++ b/integrationtests/open_test.go @@ -16,6 +16,22 @@ func TestOpenBasic(t *testing.T) { }) } +// TestOpenOpenat2 exercises the raw openat2(2) syscall. openat2 differs from +// open/openat in that its flags/mode live inside an open_how struct (args[2]), +// not a plain int; the path is still at args[1]. This test verifies ior reads +// the path from args[1] (not the dirfd at args[0] nor the struct ptr at args[2]) +// and that the enter_openat2 tracepoint is captured end-to-end. +func TestOpenOpenat2(t *testing.T) { + runScenario(t, "open-openat2", []ExpectedEvent{ + { + PathContains: "openat2file.txt", + Tracepoint: "enter_openat2", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + func TestOpenCreat(t *testing.T) { runScenario(t, "open-creat", []ExpectedEvent{ { -- cgit v1.2.3