summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-01-11 10:33:09 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2017-01-11 10:33:09 +0100
commitd199d9a42ca48e247d52a2ea43b316ebf01bffc9 (patch)
tree64797f38c1d1f1769345bc46dbec7673c32a05c4
parent86ea1ab023d05943c90e46fc597798e599ce31a2 (diff)
downloadbin-d199d9a42ca48e247d52a2ea43b316ebf01bffc9.zip
bin-d199d9a42ca48e247d52a2ea43b316ebf01bffc9.tar.gz
mtests: support dirs or files as arguments
-rwxr-xr-xmtests.sh48
1 files changed, 27 insertions, 21 deletions
diff --git a/mtests.sh b/mtests.sh
index 86e397d..31fd9ea 100755
--- a/mtests.sh
+++ b/mtests.sh
@@ -191,6 +191,16 @@ function run_test
exit 1
}
+function run_dir
+{
+ enter_dir || return
+ for test_c in $(find $dir -name test_*.c | sort)
+ do
+ run_test
+ done
+ say " leave"
+}
+
function report
{
[ $QUIET -eq 1 ] && exit 0
@@ -200,31 +210,27 @@ function report
exit 0
}
+if [ -z "$TESTS" ]
+then
+ say "search for tests into $BROWN$SRC_D$RESET"
+ TESTS=$(find $SRC_D -type d -name tests)
+fi
+
for test_c in $TESTS
do
- if [ ! -f $test_c ]
+ if [ -d $test_c ]
then
- say "$test_c does not exists"
- continue
- fi
- dir=${test_c%/*}
- enter_dir || continue
- run_test
- say " leave"
-done
-
-[ ! -z "$TESTS" ] && report
-
-say "search for tests into $SRC_D"
-for dir in $(find $SRC_D -type d -name tests)
-do
- enter_dir || continue
- for test_c in $(find $dir -name test_*.c | sort)
- do
+ dir=$test_c
+ run_dir
+ elif [ -f $test_c ]
+ then
+ dir=${test_c%/*}
+ enter_dir || continue
run_test
- done
- say " leave"
+ say " leave"
+ else
+ say "$BROWN$test_c$RESET can't be read"
+ fi
done
-say "done"
report