diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-04-07 15:18:28 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-04-07 15:22:52 +0900 |
| commit | e4355279a1624833e36455a1a85788dbe091464e (patch) | |
| tree | 7ba95bbd813f54cbabcaaf4cec5b004f8dbe72da /internal/pkg/pkg_test.go | |
| parent | 289fdebead872b1b011b8fe892d43a2f234703d1 (diff) | |
all: optionally forbid degrading in tests
This enables transparently degradable tests to be forced on in environments known to support them.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index 4fce4b1e..e1deaf3d 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -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 |
