Supply test tools and verify PATH through the native init supervisor
Assisted-by: SurmAgent:unknown [read] [edit] [bash]
This commit is contained in:
@@ -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 = ''
|
||||
|
||||
@@ -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.'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user