aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/testdata/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-15 15:48:03 +0900
committerOphestra <cat@gensokyo.uk>2026-04-15 15:49:21 +0900
commit3352bb975bca696c8c4d2ed2f129c97514e013a4 (patch)
tree0a40ae148c8cbf0cbaa4a76e92acf43d09a2bc3f /internal/pkg/testdata/main.go
parentf7f48d57e9260f4e076e47013318714a52527b2f (diff)
internal/pkg: job count in container environment
This exposes preferred job count to the container initial process. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/testdata/main.go')
-rw-r--r--internal/pkg/testdata/main.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/pkg/testdata/main.go b/internal/pkg/testdata/main.go
index c969474d..f79f7917 100644
--- a/internal/pkg/testdata/main.go
+++ b/internal/pkg/testdata/main.go
@@ -9,7 +9,9 @@ import (
"os"
"path/filepath"
"reflect"
+ "runtime"
"slices"
+ "strconv"
"strings"
"hakurei.app/check"
@@ -21,6 +23,10 @@ func main() {
log.SetFlags(0)
log.SetPrefix("testtool: ")
+ environ := slices.DeleteFunc(slices.Clone(os.Environ()), func(s string) bool {
+ return s == "CURE_JOBS="+strconv.Itoa(runtime.NumCPU())
+ })
+
var hostNet, layers, promote bool
if len(os.Args) == 2 && os.Args[0] == "testtool" {
switch os.Args[1] {
@@ -48,15 +54,15 @@ func main() {
var overlayRoot bool
wantEnv := []string{"HAKUREI_TEST=1"}
- if len(os.Environ()) == 2 {
+ if len(environ) == 2 {
overlayRoot = true
if !layers && !promote {
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)
+ if !slices.Equal(wantEnv, environ) {
+ log.Fatalf("Environ: %q, want %q", environ, wantEnv)
}
var overlayWork bool