From c0e3bc649743b53a19c549bb0bfd66e2b62f2866 Mon Sep 17 00:00:00 2001 From: southerntofu Date: Wed, 5 Jan 2022 16:40:08 +0100 Subject: [PATCH] Can run tests from another folder --- test.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 9914b7d..8b157b2 100755 --- a/test.sh +++ b/test.sh @@ -15,6 +15,9 @@ # Please don't do weird things shopt -s nullglob +# Find where test.sh is so that we can find the tests/ folder relative to it +SPECDIR="$(dirname "$0")" + # Run the test suite against a binary # $1 is executable # $2, if any, is test results folder @@ -50,7 +53,7 @@ runTests() { # and ti's served as table for test results in results.toml echo "[$TIMESTAMP-$commit]" >> $TESTDIR/results.toml echo "$TIMESTAMP-$commit" > "$TESTDIR"/latest - for test in tests/*.bats; do + for test in "$SPECDIR"/tests/*.bats; do testname="$(basename $test .bats)" echo " Testfile "$testname"" @@ -67,7 +70,7 @@ runTests() { done else # No output folder - for test in tests/*.bats; do + for test in "$SPECDIR"/tests/*.bats; do testname="$(basename $test .bats)" echo " Testfile "$testname"" # No output folder, don't save to disk