diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-21 21:08:23 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-21 21:08:23 +0200 |
| commit | 70ccf3c69fec44833b15d93be754f1fadd25614c (patch) | |
| tree | 3341c28498600a2d18cfdea1ab8abfddb0be52fd /integrationtests/dup_test.go | |
| parent | 44a5deb87bef82fe88a40bbeac634d841709b290 (diff) | |
Add negative integration tests for dup syscalls
Add three negative test scenarios for dup syscalls:
- dup-invalid-fd: dup on invalid fd 99999 (EBADF)
- dup2-same-fd: dup2(fd, fd) no-op case (POSIX documented behavior)
- dup3-invalid-flags: dup3 with 0xBAD flags (EINVAL)
All verify ior captures the tracepoint even when the syscall fails,
since BPF reads arguments on syscall entry before execution.
Task: 348
Amp-Thread-ID: https://ampcode.com/threads/T-019c8196-6186-7054-a4e5-640fce69e493
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'integrationtests/dup_test.go')
| -rw-r--r-- | integrationtests/dup_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/integrationtests/dup_test.go b/integrationtests/dup_test.go index 6289465..4a15168 100644 --- a/integrationtests/dup_test.go +++ b/integrationtests/dup_test.go @@ -34,3 +34,35 @@ func TestDupDup3(t *testing.T) { }, }) } + +func TestDupInvalidFd(t *testing.T) { + runScenario(t, "dup-invalid-fd", []ExpectedEvent{ + { + Tracepoint: "enter_dup", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestDup2SameFd(t *testing.T) { + runScenario(t, "dup2-same-fd", []ExpectedEvent{ + { + PathContains: "dup2samefile.txt", + Tracepoint: "enter_dup2", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestDup3InvalidFlags(t *testing.T) { + runScenario(t, "dup3-invalid-flags", []ExpectedEvent{ + { + PathContains: "dup3flagsfile.txt", + Tracepoint: "enter_dup3", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} |
