Can run tests from another folder

This commit is contained in:
southerntofu 2022-01-05 16:40:08 +01:00
parent 5fc4ff5601
commit c0e3bc6497
1 changed files with 5 additions and 2 deletions

View File

@ -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