hakurei/container/seccomp/syscall_test.go
Ophestra b2b69d9f62
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m12s
Test / Hakurei (push) Successful in 3m16s
Test / Hpkg (push) Successful in 4m5s
Test / Sandbox (race detector) (push) Successful in 4m8s
Test / Hakurei (race detector) (push) Successful in 5m3s
Test / Flake checks (push) Successful in 1m28s
container/seccomp: define C struct type
This enables the test to refer to this type and check its size.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-05 05:04:56 +09:00

32 lines
624 B
Go

package seccomp
import (
"testing"
"unsafe"
"hakurei.app/container/std"
)
func TestSyscallResolveName(t *testing.T) {
t.Parallel()
for name, want := range std.Syscalls() {
t.Run(name, func(t *testing.T) {
t.Parallel()
// this checks the std implementation against libseccomp.
if got, ok := syscallResolveName(name); !ok || got != want {
t.Errorf("syscallResolveName(%q) = %d, want %d", name, got, want)
}
})
}
}
func TestRuleSize(t *testing.T) {
got := unsafe.Sizeof(NativeRule{})
want := unsafe.Sizeof(syscallRule{})
if got != want {
t.Fatalf("NativeRule: %d, want %d", got, want)
}
}