nix-bitcoin/test/lib/copy-src.sh
Erik Arvstedt 8e3feece67
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.
2021-02-12 21:39:46 +01:00

19 lines
577 B
Bash

# Re-run run-tests.sh in a snapshot copy of the source.
# Maintain /tmp/nix-bitcoin-src as a source cache to minimize copies.
tmp=$(mktemp -d '/tmp/nix-bitcoin-src.XXXXX')
# Move source cache if it exists (atomic)
mv /tmp/nix-bitcoin-src $tmp/src 2>/dev/null || true
atExit() {
# Set the current src as the source cache (atomic)
mv -T $tmp/src /tmp/nix-bitcoin-src 2>/dev/null || true
rm -rf $tmp
}
trap "atExit" EXIT
rsync -a --delete --exclude='.git*' "$scriptDir/../" $tmp/src
echo "Copied src"
_nixBitcoinInCopySrc=1 $tmp/src/test/run-tests.sh "${args[@]}"