diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-06 04:36:01 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-06 05:05:34 +0900 |
| commit | 79adf217f4ca94fdfeb8a190fc7dc49fd26254dd (patch) | |
| tree | bc9cfb855369bb6539fb11634fa0d132a6ef6a4e /internal/pkg/pkg_test.go | |
| parent | 8efffd72f4c5a0f241075fd13e4d07d71fd7fde8 (diff) | |
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 <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
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)) |
