aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/app_stub_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-15 02:56:08 +0900
committerOphestra <cat@gensokyo.uk>2025-02-15 03:06:10 +0900
commitea8d1c07df18ceb94932fcc94ad00eb57c99da33 (patch)
tree84dd16fd18987542cbf5840b0727374627517f82 /internal/app/app_stub_test.go
parenta0062d827515c092cae7dfcf1af0033b87b3e90e (diff)
priv/shim: move /sbin/init setup to app
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/app_stub_test.go')
-rw-r--r--internal/app/app_stub_test.go33
1 files changed, 6 insertions, 27 deletions
diff --git a/internal/app/app_stub_test.go b/internal/app/app_stub_test.go
index 4d2e83e9..4d4674db 100644
--- a/internal/app/app_stub_test.go
+++ b/internal/app/app_stub_test.go
@@ -16,9 +16,12 @@ type stubNixOS struct {
usernameErr map[string]error
}
-func (s *stubNixOS) Geteuid() int {
- return 1971
-}
+func (s *stubNixOS) Geteuid() int { return 1971 }
+func (s *stubNixOS) TempDir() string { return "/tmp" }
+func (s *stubNixOS) MustExecutable() string { return "/run/wrappers/bin/fortify" }
+func (s *stubNixOS) Exit(code int) { panic("called exit on stub with code " + strconv.Itoa(code)) }
+func (s *stubNixOS) EvalSymlinks(path string) (string, error) { return path, nil }
+func (s *stubNixOS) Uid(aid int) (int, error) { return 1000000 + 0*10000 + aid, nil }
func (s *stubNixOS) LookupEnv(key string) (string, bool) {
switch key {
@@ -39,10 +42,6 @@ func (s *stubNixOS) LookupEnv(key string) (string, bool) {
}
}
-func (s *stubNixOS) TempDir() string {
- return "/tmp"
-}
-
func (s *stubNixOS) LookPath(file string) (string, error) {
if s.lookPathErr != nil {
if err, ok := s.lookPathErr[file]; ok {
@@ -60,10 +59,6 @@ func (s *stubNixOS) LookPath(file string) (string, error) {
}
}
-func (s *stubNixOS) Executable() (string, error) {
- return "/home/ophestra/.nix-profile/bin/fortify", nil
-}
-
func (s *stubNixOS) LookupGroup(name string) (*user.Group, error) {
switch name {
case "video":
@@ -127,14 +122,6 @@ func (s *stubNixOS) Open(name string) (fs.File, error) {
}
}
-func (s *stubNixOS) EvalSymlinks(path string) (string, error) {
- return path, nil
-}
-
-func (s *stubNixOS) Exit(code int) {
- panic("called exit on stub with code " + strconv.Itoa(code))
-}
-
func (s *stubNixOS) Paths() linux.Paths {
return linux.Paths{
SharePath: "/tmp/fortify.1971",
@@ -142,11 +129,3 @@ func (s *stubNixOS) Paths() linux.Paths {
RunDirPath: "/run/user/1971/fortify",
}
}
-
-func (s *stubNixOS) Uid(aid int) (int, error) {
- return 1000000 + 0*10000 + aid, nil
-}
-
-func (s *stubNixOS) SdBooted() bool {
- return true
-}