From d199d9a42ca48e247d52a2ea43b316ebf01bffc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 11 Jan 2017 10:33:09 +0100 Subject: mtests: support dirs or files as arguments --- mtests.sh | 48 +++++++++++++++++++++++++++--------------------- 1 file 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 -- cgit v1.1-2-g2b99