From 7bd4d7d0e6937c858e5c960931ae81e2fe59195a Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 8 Jan 2026 07:36:01 +0900 Subject: internal/pkg: support explicit overlay mount This removes all but the /work/ auto overlay behaviour and enables much greater flexibility. This also renames ExecContainerPath to ExecPath so it is easier to type. Signed-off-by: Ophestra --- internal/pkg/testdata/main.go | 44 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) (limited to 'internal/pkg/testdata') diff --git a/internal/pkg/testdata/main.go b/internal/pkg/testdata/main.go index b3ce494c..dc50f388 100644 --- a/internal/pkg/testdata/main.go +++ b/internal/pkg/testdata/main.go @@ -24,6 +24,7 @@ func main() { wantArgs := []string{"testtool"} if len(os.Args) == 2 { hostNet = true + log.SetPrefix("testtool(net): ") wantArgs = []string{"testtool", "net"} } if !slices.Equal(os.Args, wantArgs) { @@ -34,27 +35,25 @@ func main() { wantEnv := []string{"HAKUREI_TEST=1"} if len(os.Environ()) == 2 { overlayRoot = true + log.SetPrefix("testtool(overlay root): ") wantEnv = []string{"HAKUREI_TEST=1", "HAKUREI_ROOT=1"} } if !slices.Equal(wantEnv, os.Environ()) { log.Fatalf("Environ: %q, want %q", os.Environ(), wantEnv) } - var overlayTmp, overlayWork bool + var overlayWork bool const ( wantExec = "/opt/bin/testtool" - wantExecTmp = "/tmp/bin/testtool" wantExecWork = "/work/bin/testtool" ) if got, err := os.Executable(); err != nil { log.Fatalf("Executable: error = %v", err) } else if got != wantExec { switch got { - case wantExecTmp: - overlayTmp = true - case wantExecWork: overlayWork = true + log.SetPrefix("testtool(overlay work): ") default: log.Fatalf("Executable: %q, want %q", got, wantExec) @@ -99,12 +98,12 @@ func main() { } const checksumEmptyDir = "MGWmEfjut2QE2xPJwTsmUzpff4BN_FEnQ7T0j7gvUCCiugJQNwqt9m151fm9D1yU" - ident := "oHuqV7p0v1Vd8IdAzjyYM8sfCS0P2LR5tfv5cb6Gbf2ZWUm8Ec-7hYPJ_qr183m7" + ident := "U2cbgVgEtjfRuvHfE1cQnZ3t8yoexULQyo_VLgvxAVJSsobMcNaFIsuDWtmt7kzK" log.Println(m) next := func() { m = m.Next; log.Println(m) } if overlayRoot { - ident = "cIjP14zs5el6W_BQhufL_c0vWg-V6Z6pDpsbEa3sYtZ1381u1bKnH3N16RIrw-1S" + ident = "5ey2wpmMpj483YYa7ZZQciYLA2cx3_l167JCqWW4Pd-5DVp81dj9EsBtVTwYptF6" if m.Root != "/" || m.Target != "/" || m.Source != "overlay" || m.FsType != "overlay" { @@ -122,7 +121,7 @@ func main() { } } else { if hostNet { - ident = "I3T53NtN6HPAyyodHtq2B0clcsoS1nPdvCEb-Zc5K-hoqFGL2od1mftHhwG7gX1S" + ident = "QdsJhGgnk5N2xdUNGcndXQxFKifxf1V_2t9X8CQ-pDcg24x6mGJC_BiLfGbs6Qml" } if m.Root != "/sysroot" || m.Target != "/" { @@ -140,28 +139,11 @@ func main() { } } - if !overlayTmp { - next() // testtool artifact - } else { - ident = "3ELJ8l42g6XeIoLGR9LheVhMIwSIleD6VrhsliBuon5DAdBOwFSMqd7aiUI4fll7" - - next() - if path.Base(m.Root) != checksumEmptyDir || m.Target != "/tmp" { - log.Fatal("unexpected artifact checksum") - } - } - - if overlayTmp { - next() // testtool artifact - if m.Root != "/" || m.Target != "/tmp" || - m.Source != "overlay" || m.FsType != "overlay" { - log.Fatal("unexpected temp mount entry") - } - } + next() // testtool artifact next() if overlayWork { - ident = "VMCurZKCA_MV80zb-ZBWVytfl3rhYOKJeo2u9l-OuaytQ_w_r4EsqgJ2nfO93x5_" + ident = "5ynpgDp5mcAmbFndOESXjQnOy_RG6furIxDpQz6c0bImBBLMAI8FouNbAB0uNs6f" if m.Root != "/" || m.Target != "/work" || m.Source != "overlay" || m.FsType != "overlay" { log.Fatal("unexpected work mount entry") @@ -172,11 +154,9 @@ func main() { } } - if !overlayTmp { - next() - if path.Base(m.Root) != ident || m.Target != "/tmp" { - log.Fatal("unexpected temp mount entry") - } + next() + if path.Base(m.Root) != ident || m.Target != "/tmp" { + log.Fatal("unexpected temp mount entry") } next() -- cgit v1.3.1