run-tests: fix interrupt handling for --copy-src

Previously, `run-tests.sh --copy-src ...` exited with status 0 (success) when interrupted (SIGINT).
It now exits with an error status.
This commit is contained in:
Erik Arvstedt 2021-02-12 21:35:08 +01:00
parent f9683889d9
commit 8e3feece67
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -3,16 +3,16 @@
tmp=$(mktemp -d '/tmp/nix-bitcoin-src.XXXXX') tmp=$(mktemp -d '/tmp/nix-bitcoin-src.XXXXX')
# Ignore errors from now on
set +e
# Move source cache if it exists (atomic) # Move source cache if it exists (atomic)
mv /tmp/nix-bitcoin-src $tmp/src 2>/dev/null mv /tmp/nix-bitcoin-src $tmp/src 2>/dev/null || true
rsync -a --delete --exclude='.git*' "$scriptDir/../" $tmp/src && \ atExit() {
echo "Copied src" && \ # Set the current src as the source cache (atomic)
_nixBitcoinInCopySrc=1 $tmp/src/test/run-tests.sh "${args[@]}" mv -T $tmp/src /tmp/nix-bitcoin-src 2>/dev/null || true
rm -rf $tmp
}
trap "atExit" EXIT
# Set the current src as the source cache (atomic) rsync -a --delete --exclude='.git*' "$scriptDir/../" $tmp/src
mv -T $tmp/src /tmp/nix-bitcoin-src 2>/dev/null echo "Copied src"
rm -rf $tmp _nixBitcoinInCopySrc=1 $tmp/src/test/run-tests.sh "${args[@]}"