run-tests: add option --copy-src

This commit is contained in:
Erik Arvstedt 2021-02-06 09:38:58 +01:00
parent 803584a288
commit 0a2c8e4864
No known key found for this signature in database
GPG key ID: 33312B944DD97846
2 changed files with 33 additions and 0 deletions

18
test/lib/copy-src.sh Normal file
View file

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