diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index 50e2a584..4fce4b1e 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -289,8 +289,17 @@ func checkWithCache(t *testing.T, testCases []cacheTestCase) { msg := message.New(log.New(os.Stderr, "cache: ", 0)) 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) + } + flags |= pkg.CHostAbstract + t.Log("Landlock LSM is unavailable, setting CHostAbstract") + } + var scrubFunc func() error // scrub after hashing - if c, err := pkg.Open(t.Context(), msg, tc.flags, 1<<4, base); err != nil { + if c, err := pkg.Open(t.Context(), msg, flags, 1<<4, base); err != nil { t.Fatalf("Open: error = %v", err) } else { t.Cleanup(c.Close)