Преглед на файлове

test: fix up loom script a bit

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Eliza Weisman преди 3 години
родител
ревизия
c95a2cffd6
променени са 1 файла, в които са добавени 21 реда и са изтрити 8 реда
  1. 21 8
      bin/loom

+ 21 - 8
bin/loom

@@ -1,7 +1,19 @@
 #!/usr/bin/env bash
-
+#
+# Runs `loom` tests, using `cargo nextest` if it's available, or `cargo test`
+# otherwise.
+#
+# Usage:
+#    All environment variables honored by `loom` can be used to configure `loom`
+#    test behavior. Default values are set for `LOOM_LOG` and
+#    `LOOM_MAX_PREEMPTIONS`, if those variables are unset when the script is
+#    invoked.
+#
+#    Any command-line arguments are passed through to the test invocation.
+set -euo pipefail
 set -x
 
+cd "$(dirname "$0")"/..
 TESTCMD=(test)
 
 # if cargo nextest is installed, use it instead!
@@ -9,10 +21,11 @@ if cargo list | grep -q "nextest"; then
     TESTCMD=(nextest run --cargo-profile loom)
 fi
 
-RUSTFLAGS="--cfg loom ${RUSTFLAGS}" \
-LOOM_LOG="${LOOM_LOG:-info}" \
-LOOM_MAX_PREEMPTIONS="${LOOM_MAX_PREEMPTIONS:-2}" \
-cargo ${TESTCMD[@]} \
-    --profile loom \
-    --lib \
-    "$@"
+TESTCMD+=(--profile loom --lib)
+# pass through args
+TESTCMD+=(${@})
+
+RUSTFLAGS="--cfg loom ${RUSTFLAGS:-}" \
+    LOOM_LOG="${LOOM_LOG:-info}" \
+    LOOM_MAX_PREEMPTIONS="${LOOM_MAX_PREEMPTIONS:-2}" \
+    cargo ${TESTCMD[@]}