From 79adf217f4ca94fdfeb8a190fc7dc49fd26254dd Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 6 Jan 2026 04:36:01 +0900 Subject: internal/pkg: implement exec artifact This runs a program in a container environment. Artifacts can be made available to the container, they are cured concurrently and mounted in order. Signed-off-by: Ophestra --- internal/pkg/pkg_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/pkg/pkg_test.go') diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index dca39324..e089b9a3 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -23,6 +23,8 @@ import ( "hakurei.app/internal/pkg" ) +func TestMain(m *testing.M) { container.TryArgv0(nil); os.Exit(m.Run()) } + // overrideIdent overrides the ID method of [Artifact]. type overrideIdent struct { id pkg.ID @@ -251,13 +253,16 @@ type cureStep struct { err error } +// ignorePathname is passed to cureMany to skip the pathname check. +var ignorePathname = check.MustAbs("/\x00") + // cureMany cures many artifacts against a [Cache] and checks their outcomes. func cureMany(t *testing.T, c *pkg.Cache, steps []cureStep) { for _, step := range steps { t.Log("cure step:", step.name) if pathname, checksum, err := c.Cure(step.a); !reflect.DeepEqual(err, step.err) { t.Fatalf("Cure: error = %v, want %v", err, step.err) - } else if !pathname.Is(step.pathname) { + } else if step.pathname != ignorePathname && !pathname.Is(step.pathname) { t.Fatalf("Cure: pathname = %q, want %q", pathname, step.pathname) } else if checksum != step.checksum { t.Fatalf("Cure: checksum = %s, want %s", pkg.Encode(checksum), pkg.Encode(step.checksum)) -- cgit v1.3.1