all: optionally forbid degrading in tests
Some checks failed
Test / Create distribution (push) Successful in 1m19s
Test / Sandbox (push) Successful in 3m9s
Test / Flake checks (push) Has been cancelled
Test / Hakurei (race detector) (push) Has been cancelled
Test / Sandbox (race detector) (push) Has been cancelled
Test / ShareFS (push) Has been cancelled
Test / Hakurei (push) Has been cancelled

This enables transparently degradable tests to be forced on in environments known to support them.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-07 15:18:28 +09:00
parent 289fdebead
commit 25b7bedaf1
8 changed files with 32 additions and 15 deletions

View File

@@ -24,6 +24,7 @@ import (
"hakurei.app/check"
"hakurei.app/container"
"hakurei.app/fhs"
"hakurei.app/internal/info"
"hakurei.app/internal/pkg"
"hakurei.app/internal/stub"
"hakurei.app/message"
@@ -290,12 +291,15 @@ func checkWithCache(t *testing.T, testCases []cacheTestCase) {
msg.SwapVerbose(testing.Verbose())
flags := tc.flags
if _, err := container.LandlockGetABI(); err != nil {
if !errors.Is(err, syscall.ENOSYS) {
t.Fatalf("LandlockGetABI: error = %v", err)
if info.CanDegrade {
if _, err := container.LandlockGetABI(); err != nil {
if !errors.Is(err, syscall.ENOSYS) {
t.Fatalf("LandlockGetABI: error = %v", err)
}
flags |= pkg.CHostAbstract
t.Log("Landlock LSM is unavailable, setting CHostAbstract")
}
flags |= pkg.CHostAbstract
t.Log("Landlock LSM is unavailable, setting CHostAbstract")
}
var scrubFunc func() error // scrub after hashing