summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-03-23 14:51:04 +0100
committerJo-Philipp Wich <jo@mein.io>2021-03-23 14:51:04 +0100
commitfe464eaa5ed78d0f1f0710b8523d7608a90ca3e1 (patch)
tree2edbedfa1f8838c43d7df8bdd172133a7faa4165
parent091ae1b198e019430f342ae1444c68d6517e077e (diff)
run_tests.sh: allow passing tests to run as arguments
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rwxr-xr-xrun_tests.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/run_tests.sh b/run_tests.sh
index 2d35c81..69010c5 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -144,13 +144,31 @@ run_test() {
n_tests=0
n_fails=0
+select_tests="$@"
+
+use_test() {
+ local input="$(readlink -f "$1")"
+ local test
+
+ [ -f "$input" ] || return 1
+ [ -n "$select_tests" ] || return 0
+
+ for test in "$select_tests"; do
+ test="$(readlink -f "$test")"
+
+ [ "$test" != "$input" ] || return 0
+ done
+
+ return 1
+}
+
for catdir in tests/[0-9][0-9]_*; do
[ -d "$catdir" ] || continue
printf "\n##\n## Running %s tests\n##\n\n" "${catdir##*/[0-9][0-9]_}"
for testfile in "$catdir/"[0-9][0-9]_*; do
- [ -f "$testfile" ] || continue
+ use_test "$testfile" || continue
n_tests=$((n_tests + 1))
run_test "$testfile" || n_fails=$((n_fails + 1))