Skip to content

Commit

Permalink
don't build a debug build when testing in nix-build
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Nov 20, 2020
1 parent d3e044c commit 061c80d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions script/run-integration-tests.sh
Expand Up @@ -2,11 +2,20 @@
set -euo pipefail
IFS=$'\n\t'

if test -d target/debug; then
cargo build
BIN_PATH="$(pwd)/target/debug"
elif test -d target/release; then
BIN_PATH="$(pwd)/target/release"
fi

mkdir tmp
trap 'rm -rf tmp' EXIT

run_test() {
rm -r tmp/forbidden-imports.toml
if test -f tmp/forbidden-imports.toml; then
rm tmp/forbidden-imports.toml
fi

TEST_FILE="${1:-}"
NAME="$(basename "$TEST_FILE")"
Expand All @@ -15,7 +24,7 @@ run_test() {
CURRENT="$GOLDEN.current"

echo "===== $NAME"
env PATH="$(pwd)/target/debug:$PATH" ELM_FORBID_IMPORT_CONFIG="tmp/forbidden-imports.toml" bash -xeou pipefail "$TEST_FILE" > "$CURRENT"
env PATH="$BIN_PATH:$PATH" ELM_FORBID_IMPORT_CONFIG="tmp/forbidden-imports.toml" bash -xeou pipefail "$TEST_FILE" > "$CURRENT"

if ! test -e "$GOLDEN"; then
cp "$CURRENT" "$GOLDEN"
Expand All @@ -24,8 +33,6 @@ run_test() {
diff -U 0 "$GOLDEN" "$CURRENT"
}

cargo build

EXIT=0

for TEST_FILE in $(find tests/integration -type f -name '*.sh'); do
Expand Down

0 comments on commit 061c80d

Please sign in to comment.