2021-02-06 00:38:58 -08:00
|
|
|
# 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)
|
2022-08-16 12:00:00 -07:00
|
|
|
mv /tmp/nix-bitcoin-src "$tmp/src" 2>/dev/null || true
|
2021-02-06 00:38:58 -08:00
|
|
|
|
2021-02-12 12:35:08 -08:00
|
|
|
atExit() {
|
|
|
|
# Set the current src as the source cache (atomic)
|
2022-08-16 12:00:00 -07:00
|
|
|
mv -T "$tmp/src" /tmp/nix-bitcoin-src 2>/dev/null || true
|
|
|
|
rm -rf "$tmp"
|
2021-02-12 12:35:08 -08:00
|
|
|
}
|
|
|
|
trap "atExit" EXIT
|
2021-02-06 00:38:58 -08:00
|
|
|
|
2022-08-16 12:00:00 -07:00
|
|
|
# shellcheck disable=SC2154
|
2022-10-22 10:37:50 -07:00
|
|
|
rsync -a --delete "$scriptDir/../" "$tmp/src"
|
2021-02-12 12:35:08 -08:00
|
|
|
echo "Copied src"
|
2022-08-16 12:00:00 -07:00
|
|
|
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
_nixBitcoinInCopiedSrc=1 "$tmp/src/test/run-tests.sh" "${args[@]}"
|