treewide: rename to hakurei
All checks were successful
Test / Create distribution (push) Successful in 43s
Test / Sandbox (push) Successful in 2m18s
Test / Hakurei (push) Successful in 3m10s
Test / Sandbox (race detector) (push) Successful in 3m30s
Test / Hakurei (race detector) (push) Successful in 4m43s
Test / Fpkg (push) Successful in 5m4s
Test / Flake checks (push) Successful in 1m12s
All checks were successful
Test / Create distribution (push) Successful in 43s
Test / Sandbox (push) Successful in 2m18s
Test / Hakurei (push) Successful in 3m10s
Test / Sandbox (race detector) (push) Successful in 3m30s
Test / Hakurei (race detector) (push) Successful in 4m43s
Test / Fpkg (push) Successful in 5m4s
Test / Flake checks (push) Successful in 1m12s
Fortify makes little sense for a container tool. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper"
|
||||
"git.gensokyo.uk/security/hakurei/helper"
|
||||
)
|
||||
|
||||
func TestArgsString(t *testing.T) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper/proc"
|
||||
"git.gensokyo.uk/security/hakurei/helper/proc"
|
||||
)
|
||||
|
||||
// NewDirect initialises a new direct Helper instance with wt as the null-terminated argument writer.
|
||||
@@ -67,17 +67,17 @@ func (h *helperCmd) Start() error {
|
||||
|
||||
h.Env = slices.Grow(h.Env, 2)
|
||||
if h.useArgsFd {
|
||||
h.Env = append(h.Env, FortifyHelper+"=1")
|
||||
h.Env = append(h.Env, HakureiHelper+"=1")
|
||||
} else {
|
||||
h.Env = append(h.Env, FortifyHelper+"=0")
|
||||
h.Env = append(h.Env, HakureiHelper+"=0")
|
||||
}
|
||||
if h.useStatFd {
|
||||
h.Env = append(h.Env, FortifyStatus+"=1")
|
||||
h.Env = append(h.Env, HakureiStatus+"=1")
|
||||
|
||||
// stat is populated on fulfill
|
||||
h.Cancel = func() error { return h.stat.Close() }
|
||||
} else {
|
||||
h.Env = append(h.Env, FortifyStatus+"=0")
|
||||
h.Env = append(h.Env, HakureiStatus+"=0")
|
||||
}
|
||||
|
||||
return proc.Fulfill(h.helperFiles.ctx, &h.ExtraFiles, h.Cmd.Start, h.files, h.extraFiles)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper"
|
||||
"git.gensokyo.uk/security/hakurei/helper"
|
||||
)
|
||||
|
||||
func TestCmd(t *testing.T) {
|
||||
@@ -22,9 +22,9 @@ func TestCmd(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("valid new helper nil check", func(t *testing.T) {
|
||||
if got := helper.NewDirect(t.Context(), "fortify", argsWt, false, argF, nil, nil); got == nil {
|
||||
if got := helper.NewDirect(t.Context(), "hakurei", argsWt, false, argF, nil, nil); got == nil {
|
||||
t.Errorf("NewDirect(%q, %q) got nil",
|
||||
argsWt, "fortify")
|
||||
argsWt, "hakurei")
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper/proc"
|
||||
"git.gensokyo.uk/security/fortify/sandbox"
|
||||
"git.gensokyo.uk/security/hakurei/helper/proc"
|
||||
"git.gensokyo.uk/security/hakurei/sandbox"
|
||||
)
|
||||
|
||||
// New initialises a Helper instance with wt as the null-terminated argument writer.
|
||||
@@ -54,17 +54,17 @@ func (h *helperContainer) Start() error {
|
||||
|
||||
h.Env = slices.Grow(h.Env, 2)
|
||||
if h.useArgsFd {
|
||||
h.Env = append(h.Env, FortifyHelper+"=1")
|
||||
h.Env = append(h.Env, HakureiHelper+"=1")
|
||||
} else {
|
||||
h.Env = append(h.Env, FortifyHelper+"=0")
|
||||
h.Env = append(h.Env, HakureiHelper+"=0")
|
||||
}
|
||||
if h.useStatFd {
|
||||
h.Env = append(h.Env, FortifyStatus+"=1")
|
||||
h.Env = append(h.Env, HakureiStatus+"=1")
|
||||
|
||||
// stat is populated on fulfill
|
||||
h.Cancel = func(*exec.Cmd) error { return h.stat.Close() }
|
||||
} else {
|
||||
h.Env = append(h.Env, FortifyStatus+"=0")
|
||||
h.Env = append(h.Env, HakureiStatus+"=0")
|
||||
}
|
||||
|
||||
return proc.Fulfill(h.helperFiles.ctx, &h.ExtraFiles, func() error {
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper"
|
||||
"git.gensokyo.uk/security/fortify/internal"
|
||||
"git.gensokyo.uk/security/fortify/internal/fmsg"
|
||||
"git.gensokyo.uk/security/fortify/sandbox"
|
||||
"git.gensokyo.uk/security/hakurei/helper"
|
||||
"git.gensokyo.uk/security/hakurei/internal"
|
||||
"git.gensokyo.uk/security/hakurei/internal/hlog"
|
||||
"git.gensokyo.uk/security/hakurei/sandbox"
|
||||
)
|
||||
|
||||
func TestContainer(t *testing.T) {
|
||||
@@ -25,9 +25,9 @@ func TestContainer(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("valid new helper nil check", func(t *testing.T) {
|
||||
if got := helper.New(t.Context(), "fortify", argsWt, false, argF, nil, nil); got == nil {
|
||||
if got := helper.New(t.Context(), "hakurei", argsWt, false, argF, nil, nil); got == nil {
|
||||
t.Errorf("New(%q, %q) got nil",
|
||||
argsWt, "fortify")
|
||||
argsWt, "hakurei")
|
||||
return
|
||||
}
|
||||
})
|
||||
@@ -52,6 +52,6 @@ func TestHelperInit(t *testing.T) {
|
||||
if len(os.Args) != 5 || os.Args[4] != "init" {
|
||||
return
|
||||
}
|
||||
sandbox.SetOutput(fmsg.Output{})
|
||||
sandbox.Init(fmsg.Prepare, func(bool) { internal.InstallFmsg(false) })
|
||||
sandbox.SetOutput(hlog.Output{})
|
||||
sandbox.Init(hlog.Prepare, func(bool) { internal.InstallFmsg(false) })
|
||||
}
|
||||
|
||||
@@ -8,16 +8,16 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper/proc"
|
||||
"git.gensokyo.uk/security/hakurei/helper/proc"
|
||||
)
|
||||
|
||||
var WaitDelay = 2 * time.Second
|
||||
|
||||
const (
|
||||
// FortifyHelper is set to 1 when args fd is enabled and 0 otherwise.
|
||||
FortifyHelper = "FORTIFY_HELPER"
|
||||
// FortifyStatus is set to 1 when stat fd is enabled and 0 otherwise.
|
||||
FortifyStatus = "FORTIFY_STATUS"
|
||||
// HakureiHelper is set to 1 when args fd is enabled and 0 otherwise.
|
||||
HakureiHelper = "HAKUREI_HELPER"
|
||||
// HakureiStatus is set to 1 when stat fd is enabled and 0 otherwise.
|
||||
HakureiStatus = "HAKUREI_STATUS"
|
||||
)
|
||||
|
||||
type Helper interface {
|
||||
|
||||
@@ -11,13 +11,13 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper"
|
||||
"git.gensokyo.uk/security/hakurei/helper"
|
||||
)
|
||||
|
||||
var (
|
||||
wantArgs = []string{
|
||||
"unix:path=/run/dbus/system_bus_socket",
|
||||
"/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/system_bus_socket",
|
||||
"/tmp/hakurei.1971/12622d846cc3fe7b4c10359d01f0eb47/system_bus_socket",
|
||||
"--filter",
|
||||
"--talk=org.bluez",
|
||||
"--talk=org.freedesktop.Avahi",
|
||||
|
||||
@@ -14,13 +14,13 @@ import (
|
||||
func InternalHelperStub() {
|
||||
// this test mocks the helper process
|
||||
var ap, sp string
|
||||
if v, ok := os.LookupEnv(FortifyHelper); !ok {
|
||||
if v, ok := os.LookupEnv(HakureiHelper); !ok {
|
||||
return
|
||||
} else {
|
||||
ap = v
|
||||
}
|
||||
if v, ok := os.LookupEnv(FortifyStatus); !ok {
|
||||
panic(FortifyStatus)
|
||||
if v, ok := os.LookupEnv(HakureiStatus); !ok {
|
||||
panic(HakureiStatus)
|
||||
} else {
|
||||
sp = v
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package helper_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/helper"
|
||||
"git.gensokyo.uk/security/hakurei/helper"
|
||||
)
|
||||
|
||||
func TestHelperStub(t *testing.T) { helper.InternalHelperStub() }
|
||||
|
||||
Reference in New Issue
Block a user