e6f19ea429
Set the executable bit before running the check phase, so that the check phase can run the script to test its behaviour. This aligns with what `concatTextFile` is doing. Also use explicit `if` statements so that we don't silently ignore `chmod` failures.
14 lines
381 B
Nix
14 lines
381 B
Nix
{ lib, writeShellScript }: let
|
|
output = "hello";
|
|
in (writeShellScript "test-script" ''
|
|
echo ${lib.escapeShellArg output}
|
|
'').overrideAttrs (old: {
|
|
checkPhase = old.checkPhase or "" + ''
|
|
expected=${lib.escapeShellArg output}
|
|
got=$("$target")
|
|
if [[ "$got" != "$expected" ]]; then
|
|
echo "wrong output: expected $expected, got $got"
|
|
exit 1
|
|
fi
|
|
'';
|
|
})
|