diff options
Diffstat (limited to 'container/seccomp/syscall_test.go')
| -rw-r--r-- | container/seccomp/syscall_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/container/seccomp/syscall_test.go b/container/seccomp/syscall_test.go index 57a73265..151f6321 100644 --- a/container/seccomp/syscall_test.go +++ b/container/seccomp/syscall_test.go @@ -1,7 +1,9 @@ package seccomp import ( + "reflect" "testing" + "unsafe" "hakurei.app/container/std" ) @@ -20,3 +22,18 @@ func TestSyscallResolveName(t *testing.T) { }) } } + +func TestRuleSize(t *testing.T) { + assertSize[NativeRule, syscallRule](t) + assertSize[ScmpDatum, scmpDatum](t) + assertSize[ScmpArgCmp, scmpArgCmp](t) +} + +// assertSize asserts that native and equivalent are of the same size. +func assertSize[native, equivalent any](t *testing.T) { + got := unsafe.Sizeof(*new(native)) + want := unsafe.Sizeof(*new(equivalent)) + if got != want { + t.Fatalf("%s: %d, want %d", reflect.TypeFor[native]().Name(), got, want) + } +} |
