mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-26 16:18:52 +03:00
run-tests: add option --copy-src
This commit is contained in:
parent
803584a288
commit
0a2c8e4864
18
test/lib/copy-src.sh
Normal file
18
test/lib/copy-src.sh
Normal 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
|
@ -42,12 +42,20 @@
|
||||
# For now, creating NixOS containers requires root permissions.
|
||||
# See ./lib/make-container.sh for a complete documentation.
|
||||
#
|
||||
# Run tests from a snapshot copy of the source files
|
||||
# ./run-tests.sh --copy-src|-c ...
|
||||
#
|
||||
# This allows you to continue editing the nix-bitcoin sources while tests are running
|
||||
# and reading source files.
|
||||
# Files are copied to /tmp, a caching scheme helps minimizing copies.
|
||||
#
|
||||
# To add custom scenarios, set the environment variable `scenarioOverridesFile`.
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||
|
||||
args=("$@")
|
||||
scenario=
|
||||
outLinkPrefix=
|
||||
ciBuild=
|
||||
@ -77,6 +85,13 @@ while :; do
|
||||
shift
|
||||
ciBuild=1
|
||||
;;
|
||||
--copy-src|-c)
|
||||
shift
|
||||
if [[ ! $_nixBitcoinInCopySrc ]]; then
|
||||
. "$scriptDir/lib/copy-src.sh"
|
||||
exit
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
break
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user