aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/ir_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-12 15:10:43 +0900
committerOphestra <cat@gensokyo.uk>2026-05-12 15:11:17 +0900
commit6643cfbeee181ee1bd543e2b3783bb5a8c01ad13 (patch)
tree04b1b3b1d3fa044a1f8d5097355fa2779fe95af9 /internal/pkg/ir_test.go
parentdcde38f2e967ebf14a3c8a7f933b7dd1bf465566 (diff)
internal/pkg: optionally measure exec artifact
Useful for verifying deterministic output without enabling network access. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/ir_test.go')
-rw-r--r--internal/pkg/ir_test.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/internal/pkg/ir_test.go b/internal/pkg/ir_test.go
index ad895471..9a465e55 100644
--- a/internal/pkg/ir_test.go
+++ b/internal/pkg/ir_test.go
@@ -39,7 +39,7 @@ func TestIRRoundtrip(t *testing.T) {
)},
{"exec offline", pkg.NewExec(
- "exec-offline", "", nil, 0, false,
+ "exec-offline", "", nil, 0, false, false,
pkg.AbsWork,
[]string{"HAKUREI_TEST=1"},
check.MustAbs("/opt/bin/testtool"),
@@ -61,7 +61,7 @@ func TestIRRoundtrip(t *testing.T) {
{"exec net", pkg.NewExec(
"exec-net", "",
(*pkg.Checksum)(bytes.Repeat([]byte{0xfc}, len(pkg.Checksum{}))),
- 0, false,
+ 0, false, false,
pkg.AbsWork,
[]string{"HAKUREI_TEST=1"},
check.MustAbs("/opt/bin/testtool"),
@@ -80,6 +80,28 @@ func TestIRRoundtrip(t *testing.T) {
)),
)},
+ {"exec measured", pkg.NewExec(
+ "exec-measured", "",
+ (*pkg.Checksum)(bytes.Repeat([]byte{0xfd}, len(pkg.Checksum{}))),
+ 0, false, false,
+ pkg.AbsWork,
+ []string{"HAKUREI_TEST=1"},
+ check.MustAbs("/opt/bin/testtool"),
+ []string{"testtool", "measured"},
+
+ pkg.MustPath("/file", false, pkg.NewFile("file", []byte(
+ "stub file",
+ ))), pkg.MustPath("/.hakurei", false, pkg.NewHTTPGetTar(
+ nil, "file:///hakurei.tar",
+ pkg.Checksum(bytes.Repeat([]byte{0xfd}, len(pkg.Checksum{}))),
+ pkg.TarUncompressed,
+ )), pkg.MustPath("/opt", false, pkg.NewHTTPGetTar(
+ nil, "file:///testtool.tar.gz",
+ pkg.Checksum(bytes.Repeat([]byte{0xfd}, len(pkg.Checksum{}))),
+ pkg.TarGzip,
+ )),
+ )},
+
{"file anonymous", pkg.NewFile("", []byte{0})},
{"file", pkg.NewFile("stub", []byte("stub"))},
}