diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-04-10 23:56:45 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-04-10 23:56:45 +0900 |
| commit | b39064037625d1757a65913086ec3a247ad5bb29 (patch) | |
| tree | 7fd59329e779e195aaadab8846996844e5f45974 /container/landlock_test.go | |
| parent | ad2c9f36cddfd8adcd06fbe9238d176a8eb89614 (diff) | |
internal/landlock: relocate from package container
This is not possible to use directly, so remove it from the public API.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/landlock_test.go')
| -rw-r--r-- | container/landlock_test.go | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/container/landlock_test.go b/container/landlock_test.go deleted file mode 100644 index 87dc2496..00000000 --- a/container/landlock_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package container_test - -import ( - "testing" - "unsafe" - - "hakurei.app/container" -) - -func TestLandlockString(t *testing.T) { - t.Parallel() - - testCases := []struct { - name string - rulesetAttr *container.RulesetAttr - want string - }{ - {"nil", nil, "NULL"}, - {"zero", new(container.RulesetAttr), "0"}, - {"some", &container.RulesetAttr{Scoped: container.LANDLOCK_SCOPE_SIGNAL}, "scoped: signal"}, - {"set", &container.RulesetAttr{ - HandledAccessFS: container.LANDLOCK_ACCESS_FS_MAKE_SYM | container.LANDLOCK_ACCESS_FS_IOCTL_DEV | container.LANDLOCK_ACCESS_FS_WRITE_FILE, - HandledAccessNet: container.LANDLOCK_ACCESS_NET_BIND_TCP, - Scoped: container.LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET | container.LANDLOCK_SCOPE_SIGNAL, - }, "fs: write_file make_sym fs_ioctl_dev, net: bind_tcp, scoped: abstract_unix_socket signal"}, - {"all", &container.RulesetAttr{ - HandledAccessFS: container.LANDLOCK_ACCESS_FS_EXECUTE | - container.LANDLOCK_ACCESS_FS_WRITE_FILE | - container.LANDLOCK_ACCESS_FS_READ_FILE | - container.LANDLOCK_ACCESS_FS_READ_DIR | - container.LANDLOCK_ACCESS_FS_REMOVE_DIR | - container.LANDLOCK_ACCESS_FS_REMOVE_FILE | - container.LANDLOCK_ACCESS_FS_MAKE_CHAR | - container.LANDLOCK_ACCESS_FS_MAKE_DIR | - container.LANDLOCK_ACCESS_FS_MAKE_REG | - container.LANDLOCK_ACCESS_FS_MAKE_SOCK | - container.LANDLOCK_ACCESS_FS_MAKE_FIFO | - container.LANDLOCK_ACCESS_FS_MAKE_BLOCK | - container.LANDLOCK_ACCESS_FS_MAKE_SYM | - container.LANDLOCK_ACCESS_FS_REFER | - container.LANDLOCK_ACCESS_FS_TRUNCATE | - container.LANDLOCK_ACCESS_FS_IOCTL_DEV, - HandledAccessNet: container.LANDLOCK_ACCESS_NET_BIND_TCP | - container.LANDLOCK_ACCESS_NET_CONNECT_TCP, - Scoped: container.LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET | - container.LANDLOCK_SCOPE_SIGNAL, - }, "fs: execute write_file read_file read_dir remove_dir remove_file make_char make_dir make_reg make_sock make_fifo make_block make_sym fs_refer fs_truncate fs_ioctl_dev, net: bind_tcp connect_tcp, scoped: abstract_unix_socket signal"}, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - if got := tc.rulesetAttr.String(); got != tc.want { - t.Errorf("String: %s, want %s", got, tc.want) - } - }) - } -} - -func TestLandlockAttrSize(t *testing.T) { - t.Parallel() - want := 24 - if got := unsafe.Sizeof(container.RulesetAttr{}); got != uintptr(want) { - t.Errorf("Sizeof: %d, want %d", got, want) - } -} |
