diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-21 21:03:33 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-21 21:03:33 +0200 |
| commit | 44a5deb87bef82fe88a40bbeac634d841709b290 (patch) | |
| tree | b0f8b3af65476603c7a2313ca5ae9e2279810b93 /integrationtests/close_test.go | |
| parent | be7f8fc048fd92eb806159de5bdb3a3becea3c16 (diff) | |
Add negative integration tests for close syscalls
Add three negative scenarios to verify ior captures tracepoints even when
close syscalls fail:
- close-invalid-fd: close an fd (99999) that was never opened (EBADF)
- close-double-close: open a file, close it, close same fd again (EBADF)
- close-range-empty: close_range on high fd range with no open fds
Task: 348
Amp-Thread-ID: https://ampcode.com/threads/T-019c8190-c9ae-776e-b00d-476207d8c10e
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'integrationtests/close_test.go')
| -rw-r--r-- | integrationtests/close_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/integrationtests/close_test.go b/integrationtests/close_test.go index d91a37d..3689fb8 100644 --- a/integrationtests/close_test.go +++ b/integrationtests/close_test.go @@ -23,3 +23,39 @@ func TestCloseRange(t *testing.T) { }, }) } + +func TestCloseInvalidFd(t *testing.T) { + runScenario(t, "close-invalid-fd", []ExpectedEvent{ + { + Tracepoint: "enter_close", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} + +func TestCloseDoubleClose(t *testing.T) { + runScenario(t, "close-double-close", []ExpectedEvent{ + { + PathContains: "doubleclosefile.txt", + Tracepoint: "enter_close", + Comm: "ioworkload", + MinCount: 1, + }, + { + Tracepoint: "enter_close", + Comm: "ioworkload", + MinCount: 2, + }, + }) +} + +func TestCloseRangeEmpty(t *testing.T) { + runScenario(t, "close-range-empty", []ExpectedEvent{ + { + Tracepoint: "enter_close_range", + Comm: "ioworkload", + MinCount: 1, + }, + }) +} |
