mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-30 03:32:05 +03:00
run-tests: rename testDir -> scriptDir
This commit is contained in:
parent
466d23deaa
commit
95bc1237e2
@ -40,6 +40,8 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||
|
||||
scenario=
|
||||
outLinkPrefix=
|
||||
while :; do
|
||||
@ -73,9 +75,7 @@ numCPUs=${numCPUs:-$(nproc)}
|
||||
# Min. 800 MiB needed to avoid 'out of memory' errors
|
||||
memoryMiB=${memoryMiB:-2048}
|
||||
|
||||
testDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||
|
||||
export NIX_PATH=nixpkgs=$(nix eval --raw -f "$testDir/../pkgs/nixpkgs-pinned.nix" nixpkgs)
|
||||
export NIX_PATH=nixpkgs=$(nix eval --raw -f "$scriptDir/../pkgs/nixpkgs-pinned.nix" nixpkgs)
|
||||
|
||||
# Run the test. No temporary files are left on the host system.
|
||||
run() {
|
||||
@ -83,7 +83,7 @@ run() {
|
||||
export TMPDIR=$(mktemp -d /tmp/nix-bitcoin-test.XXX)
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
|
||||
nix-build --out-link $TMPDIR/driver -E "(import \"$testDir/tests.nix\" { scenario = \"$scenario\"; }).vm" -A driver
|
||||
nix-build --out-link $TMPDIR/driver -E "(import \"$scriptDir/tests.nix\" { scenario = \"$scenario\"; }).vm" -A driver
|
||||
|
||||
# Variable 'tests' contains the Python code that is executed by the driver on startup
|
||||
if [[ $1 == --interactive ]]; then
|
||||
@ -129,7 +129,7 @@ instantiate() {
|
||||
}
|
||||
|
||||
container() {
|
||||
. "$testDir/lib/make-container.sh" "$@"
|
||||
. "$scriptDir/lib/make-container.sh" "$@"
|
||||
}
|
||||
|
||||
# Run the test by building the test derivation
|
||||
@ -163,7 +163,7 @@ exprForCI() {
|
||||
vmTestNixExpr() {
|
||||
extraQEMUOpts="$1"
|
||||
cat <<EOF
|
||||
((import "$testDir/tests.nix" { scenario = "$scenario"; }).vm {}).overrideAttrs (old: rec {
|
||||
((import "$scriptDir/tests.nix" { scenario = "$scenario"; }).vm {}).overrideAttrs (old: rec {
|
||||
buildCommand = ''
|
||||
export QEMU_OPTS="-smp $numCPUs -m $memoryMiB $extraQEMUOpts"
|
||||
echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB"
|
||||
|
Loading…
Reference in New Issue
Block a user