diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-01-11 10:33:09 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-01-11 10:33:09 +0100 |
commit | d199d9a42ca48e247d52a2ea43b316ebf01bffc9 (patch) | |
tree | 64797f38c1d1f1769345bc46dbec7673c32a05c4 | |
parent | 86ea1ab023d05943c90e46fc597798e599ce31a2 (diff) | |
download | bin-d199d9a42ca48e247d52a2ea43b316ebf01bffc9.zip bin-d199d9a42ca48e247d52a2ea43b316ebf01bffc9.tar.gz |
mtests: support dirs or files as arguments
-rwxr-xr-x | mtests.sh | 48 |
1 files changed, 27 insertions, 21 deletions
@@ -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 |