From 6a22f374e20fe5dfb95f149647a7166a674871fe Mon Sep 17 00:00:00 2001 From: Surma Date: Thu, 12 Nov 2026 10:59:32 +0000 Subject: [PATCH] Supply test tools and verify PATH through the native init supervisor Assisted-by: SurmAgent:unknown [read] [edit] [bash] --- flake.nix | 2 +- host/tests/packaged-builder.nu | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/flake.nix b/flake.nix index b4e4b85..d5692ea 100644 --- a/flake.nix +++ b/flake.nix @@ -165,7 +165,7 @@ cargoExtraArgs = "--locked -p sausage -p sausage-vfs"; cargoTestExtraArgs = "-- --nocapture"; doCheck = true; - nativeBuildInputs = hostArgs.nativeBuildInputs ++ [ pkgs.git ]; + nativeBuildInputs = hostArgs.nativeBuildInputs ++ builderTools ++ [ pkgs.git pkgs.nodejs ]; SAUSAGE_TEST_NO_BUILDER_SANDBOX = "1"; SAUSAGE_USERLAND = bundle; preCheck = '' diff --git a/host/tests/packaged-builder.nu b/host/tests/packaged-builder.nu index b02590c..b3ec07b 100644 --- a/host/tests/packaged-builder.nu +++ b/host/tests/packaged-builder.nu @@ -18,17 +18,6 @@ ps | grep -q PID sh -c 'echo sh OK' bash -c 'echo bash OK' qjs -e 'console.log("qjs source OK")' -rm /etc/systemd/system/multi-user.target.wants/web.service -mkdir -p /run/systemd/requests /run/systemd/replies /run/systemd/state -set -m -init > /init.stdout 2> /init.stderr & -supervisor=$! -set +m -systemd-run --unit alias --wait -p Type=oneshot touch /init-PATH-ok -test -f /init-PATH-ok -echo 'init PATH OK' -/bin/kill "$supervisor" -wait "$supervisor" || true mkdir -p /src/projects cd /src/projects cargo new packaged-probe --vcs none @@ -40,11 +29,20 @@ cargo run --release print --no-newline $result.stdout print --stderr --no-newline $result.stderr if $result.exit_code != 0 { error make {msg: 'packaged builder failed'} } - for expected in ['coreutils OK' 'sh OK' 'bash OK' 'qjs source OK' 'init PATH OK' 'packaged builder OK'] { + for expected in ['coreutils OK' 'sh OK' 'bash OK' 'qjs source OK' 'packaged builder OK'] { if not ($result.stdout | lines | any {|line| $line == $expected }) { error make {msg: $'packaged check did not print: ($expected)'} } } + # Native run starts init. A bare command must retain argv[0] through its PATH symlink. + "[Service]\nType=oneshot\nExecStart=touch /init-PATH-ok\n" | save --force ($world | path join world etc systemd system web.service) + let supervised = (^timeout --signal INT 15s $host run $world | complete) + print --no-newline $supervised.stdout + print --stderr --no-newline $supervised.stderr + if $supervised.exit_code not-in [0 124] or not ($world | path join world init-PATH-ok | path exists) { + error make {msg: 'init did not resolve the bare command through its PATH symlink'} + } + print 'init PATH OK' rm --recursive --force $temporary print 'Packaged builder check passed.' }