From: Pavel TvrdĂ­k Date: Mon, 13 Apr 2015 08:33:04 +0000 (+0200) Subject: Birdtest: Improve a tests lancher script X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f5f52838e9fe97d44ebe2f25445b7ff94128aa0;p=thirdparty%2Fbird.git Birdtest: Improve a tests lancher script --- diff --git a/tools/Makefile-top.in b/tools/Makefile-top.in index 3f199a8a9..c68ed5470 100644 --- a/tools/Makefile-top.in +++ b/tools/Makefile-top.in @@ -22,4 +22,5 @@ distclean: clean rm -f config.* configure sysdep/autoconf.h sysdep/paths.h Makefile clean-tests: - find . -name '*_test' | xargs rm -f \ No newline at end of file + find . -name '*_test' | xargs rm -f + rm -f $(objdir)/test/birdtest.o \ No newline at end of file diff --git a/tools/run_tests.sh b/tools/run_tests.sh index f1a2b0d38..3e84ca108 100755 --- a/tools/run_tests.sh +++ b/tools/run_tests.sh @@ -13,10 +13,19 @@ num_succ_tests=0 num_fail_tests=0 echo -e " == Start all $num_all_tests unit tests ==\n" for test in $all_tests ; do - echo -e " [$((num_test++))/$num_all_tests] $test" - ./$test \ - && num_succ_tests=$((num_succ_tests+1)) \ - || num_fail_tests=$((num_fail_tests+1)) + ./$test ; exit_code=$? + cols=$(tput cols) + offset=$((cols-17)) + fmt=" [%2d/%-2d] %-${offset}s" + printf "$fmt" $((num_test++)) $num_all_tests "$test" + if [ $exit_code -eq 0 ]; then + printf "[\e[1;32m OK \e[0m]" + num_succ_tests=$((num_succ_tests+1)) + else + printf "[\e[1;31mFAIL\e[0m]" + num_fail_tests=$((num_fail_tests+1)) + fi + printf "\n" done num_all_tests_src=0