aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/seccomp/seccomp_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-13 18:49:58 +0900
committerOphestra <cat@gensokyo.uk>2025-10-13 18:51:35 +0900
commit123d7fbfd5a2955dc5042c0a85211e376d5a8e65 (patch)
tree7e03e35309083b81873f3cf1939d2f4d27d41659 /container/seccomp/seccomp_test.go
parent7638a44fa613f23434318bdf136723aa010e8638 (diff)
container/seccomp: remove export pipe
This was only useful when wrapping bwrap. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/seccomp/seccomp_test.go')
-rw-r--r--container/seccomp/seccomp_test.go71
1 files changed, 0 insertions, 71 deletions
diff --git a/container/seccomp/seccomp_test.go b/container/seccomp/seccomp_test.go
deleted file mode 100644
index c19f2c49..00000000
--- a/container/seccomp/seccomp_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package seccomp_test
-
-import (
- "errors"
- "runtime"
- "syscall"
- "testing"
-
- "hakurei.app/container/seccomp"
-)
-
-func TestLibraryError(t *testing.T) {
- t.Parallel()
-
- testCases := []struct {
- name string
- sample *seccomp.LibraryError
- want string
- wantIs bool
- compare error
- }{
- {
- "full",
- &seccomp.LibraryError{Prefix: "seccomp_export_bpf failed", Seccomp: syscall.ECANCELED, Errno: syscall.EBADF},
- "seccomp_export_bpf failed: operation canceled (bad file descriptor)",
- true,
- &seccomp.LibraryError{Prefix: "seccomp_export_bpf failed", Seccomp: syscall.ECANCELED, Errno: syscall.EBADF},
- },
- {
- "errno only",
- &seccomp.LibraryError{Prefix: "seccomp_init failed", Errno: syscall.ENOMEM},
- "seccomp_init failed: cannot allocate memory",
- false,
- nil,
- },
- {
- "seccomp only",
- &seccomp.LibraryError{Prefix: "internal libseccomp failure", Seccomp: syscall.EFAULT},
- "internal libseccomp failure: bad address",
- true,
- syscall.EFAULT,
- },
- }
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- t.Parallel()
-
- if errors.Is(tc.sample, tc.compare) != tc.wantIs {
- t.Errorf("errors.Is(%#v, %#v) did not return %v",
- tc.sample, tc.compare, tc.wantIs)
- }
-
- if got := tc.sample.Error(); got != tc.want {
- t.Errorf("Error: %q, want %q",
- got, tc.want)
- }
- })
- }
-
- t.Run("invalid", func(t *testing.T) {
- t.Parallel()
-
- wantPanic := "invalid libseccomp error"
- defer func() {
- if r := recover(); r != wantPanic {
- t.Errorf("panic: %q, want %q", r, wantPanic)
- }
- }()
- runtime.KeepAlive(new(seccomp.LibraryError).Error())
- })
-}