treewide: fit test untyped int literals in 32-bit
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m17s
Test / Hakurei (push) Successful in 3m15s
Test / Hpkg (push) Successful in 3m56s
Test / Sandbox (race detector) (push) Successful in 4m6s
Test / Hakurei (race detector) (push) Successful in 5m2s
Test / Flake checks (push) Successful in 1m24s

This enables hakurei test suite to run on 32-bit targets.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-11-05 20:13:19 +09:00
parent fba201c995
commit 9fd97e71d0
29 changed files with 371 additions and 366 deletions

View File

@@ -34,9 +34,9 @@ func TestPaths(t *testing.T) {
TempDir: fhs.AbsTmp,
}, hst.Paths{
TempDir: fhs.AbsTmp,
SharePath: fhs.AbsTmp.Append("hakurei.3735928559"),
RuntimePath: fhs.AbsTmp.Append("hakurei.3735928559/compat"),
RunDirPath: fhs.AbsTmp.Append("hakurei.3735928559/compat/hakurei"),
SharePath: fhs.AbsTmp.Append("hakurei.57005"),
RuntimePath: fhs.AbsTmp.Append("hakurei.57005/compat"),
RunDirPath: fhs.AbsTmp.Append("hakurei.57005/compat/hakurei"),
}, ""},
{"full", &env.Paths{
@@ -44,7 +44,7 @@ func TestPaths(t *testing.T) {
RuntimePath: fhs.AbsRunUser.Append("1000"),
}, hst.Paths{
TempDir: fhs.AbsTmp,
SharePath: fhs.AbsTmp.Append("hakurei.3735928559"),
SharePath: fhs.AbsTmp.Append("hakurei.57005"),
RuntimePath: fhs.AbsRunUser.Append("1000"),
RunDirPath: fhs.AbsRunUser.Append("1000/hakurei"),
}, ""},
@@ -61,7 +61,7 @@ func TestPaths(t *testing.T) {
}
var sc hst.Paths
tc.env.Copy(&sc, 0xdeadbeef)
tc.env.Copy(&sc, 0xdead)
if !reflect.DeepEqual(&sc, &tc.want) {
t.Errorf("Copy: %#v, want %#v", sc, tc.want)
}

View File

@@ -36,7 +36,7 @@ func call(name string, args stub.ExpectArgs, ret any, err error) stub.Call {
const (
// checkExpectUid is the uid value used by checkOpBehaviour to initialise [system.I].
checkExpectUid = 0xcafebabe
checkExpectUid = 0xcafe
// wantAutoEtcPrefix is the autoetc prefix corresponding to checkExpectInstanceId.
wantAutoEtcPrefix = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
// wantInstancePrefix is the SharePath corresponding to checkExpectInstanceId.

View File

@@ -86,12 +86,12 @@ func (h *Hsu) MustID(msg message.Msg) int {
msg.Verbose("*"+fallback, err)
}
os.Exit(1)
return -0xdeadbeef // not reached
return -0xbad // not reached
} else if m, ok := message.GetMessage(err); ok {
log.Fatal(m)
return -0xdeadbeef // not reached
return -0xbad // not reached
} else {
log.Fatalln(fallback, err)
return -0xdeadbeef // not reached
return -0xbad // not reached
}
}

View File

@@ -701,7 +701,7 @@ type stubNixOS struct {
}
func (k *stubNixOS) getppid() int { return 0xbad }
func (k *stubNixOS) getpid() int { return 0xdeadbeef }
func (k *stubNixOS) getpid() int { return 0xdead }
func (k *stubNixOS) getuid() int { return 1971 }
func (k *stubNixOS) getgid() int { return 100 }

View File

@@ -127,8 +127,8 @@ func TestEntryData(t *testing.T) {
func newTemplateState() *hst.State {
return &hst.State{
ID: hst.ID(bytes.Repeat([]byte{0xaa}, len(hst.ID{}))),
PID: 0xcafebabe,
ShimPID: 0xdeadbeef,
PID: 0xcafe,
ShimPID: 0xdead,
Config: hst.Template(),
Time: time.Unix(0, 0),
}