Files
nixpkgs/pkgs/build-support/testers/testBuildFailurePrime/build-command.sh
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

48 lines
1.3 KiB
Bash

# shellcheck shell=bash
set -eu
declare -ag preScriptHooks=(testBuilderExitCode)
# shellcheck disable=SC2154
((${#expectedBuilderLogEntries[@]})) && preScriptHooks+=(testBuilderLogEntries)
testBuilderExitCode() {
nixLog "checking original builder exit code"
local -ir builderExitCode=$(<"${failed:?}/testBuildFailure.exit")
# shellcheck disable=SC2154
if ((expectedBuilderExitCode == builderExitCode)); then
nixLog "original builder exit code matches expected value of $expectedBuilderExitCode"
return 0
else
nixErrorLog "original builder produced exit code $builderExitCode but was expected to produce $expectedBuilderExitCode"
return 1
fi
}
testBuilderLogEntries() {
nixLog "checking original builder log"
local -r builderLogEntries="$(<"${failed:?}/testBuildFailure.log")"
local -i shouldExit=0
local expectedBuilderLogEntry
for expectedBuilderLogEntry in "${expectedBuilderLogEntries[@]}"; do
if [[ ${builderLogEntries} == *"$expectedBuilderLogEntry"* ]]; then
nixLog "original builder log contains ${expectedBuilderLogEntry@Q}"
else
nixErrorLog "original builder log does not contain ${expectedBuilderLogEntry@Q}"
shouldExit=1
fi
done
return $shouldExit
}
scriptPhase() {
runHook preScript
runHook script
runHook postScript
}
runHook scriptPhase
touch "${out:?}"