Merge #322: run-tests: Fix interrupt handling for --copy-src

8e3feece67 run-tests: fix interrupt handling for --copy-src (Erik Arvstedt)

Pull request description:

ACKs for top commit:
  nixbitcoin:
    ACK 8e3feece67

Tree-SHA512: ec4916facedb1f5988dccd0e80e08fcf1788a8425320676e6c48350aa69f29d302bb102408c52c748ac5a794735c0c00d7a95dbea91d735add40b5690817d272
This commit is contained in:
Jonas Nick 2021-02-14 19:48:05 +00:00
commit eddc48ee62
No known key found for this signature in database
GPG Key ID: 4861DBF262123605

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 && \
echo "Copied src" && \
_nixBitcoinInCopySrc=1 $tmp/src/test/run-tests.sh "${args[@]}"
atExit() {
# Set the current src as the source cache (atomic) # Set the current src as the source cache (atomic)
mv -T $tmp/src /tmp/nix-bitcoin-src 2>/dev/null mv -T $tmp/src /tmp/nix-bitcoin-src 2>/dev/null || true
rm -rf $tmp 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[@]}"