summaryrefslogtreecommitdiff
path: root/integrationtests/link_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-21 21:20:30 +0200
committerPaul Buetow <paul@buetow.org>2026-02-21 21:20:30 +0200
commit69395ffff024254b114eeba543af68cc6ca77f0c (patch)
tree77d8dea1d2bab810e66ae7fb19bccc1d56efe970 /integrationtests/link_test.go
parent04500a92433396ca17cb879f4a40e4399dc06ff9 (diff)
Add negative integration tests for link syscalls (task 348)
Add three negative scenarios and tests: - link-enoent: hard link to nonexistent source (ENOENT) via raw SYS_LINK - link-symlink-eexist: symlink where target already exists (EEXIST) via raw SYS_SYMLINK - link-readlinkat-einval: readlinkat on non-symlink file (EINVAL) via SYS_READLINKAT All use raw syscalls to hit exact tracepoints. ior captures on syscall entry, so even failed syscalls have their arguments recorded. Amp-Thread-ID: https://ampcode.com/threads/T-019c81a2-693b-716f-9ed2-25a674f1fc9a Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'integrationtests/link_test.go')
-rw-r--r--integrationtests/link_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/integrationtests/link_test.go b/integrationtests/link_test.go
index fcebffb..4f92f6e 100644
--- a/integrationtests/link_test.go
+++ b/integrationtests/link_test.go
@@ -57,3 +57,36 @@ func TestLinkReadlinkat(t *testing.T) {
},
})
}
+
+func TestLinkEnoent(t *testing.T) {
+ runScenario(t, "link-enoent", []ExpectedEvent{
+ {
+ PathContains: "link-enoent-missing.txt",
+ Tracepoint: "enter_link",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+}
+
+func TestLinkSymlinkEexist(t *testing.T) {
+ runScenario(t, "link-symlink-eexist", []ExpectedEvent{
+ {
+ PathContains: "symlink-eexist.txt",
+ Tracepoint: "enter_symlink",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+}
+
+func TestLinkReadlinkatEinval(t *testing.T) {
+ runScenario(t, "link-readlinkat-einval", []ExpectedEvent{
+ {
+ PathContains: "readlinkat-einval.txt",
+ Tracepoint: "enter_readlinkat",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+}