From 8f5f52838e9fe97d44ebe2f25445b7ff94128aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Tvrd=C3=ADk?= Date: Mon, 13 Apr 2015 10:33:04 +0200 Subject: [PATCH] Birdtest: Improve a tests lancher script --- tools/Makefile-top.in | 3 ++- tools/run_tests.sh | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/Makefile-top.in b/tools/Makefile-top.in index 3f199a8a..c68ed547 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 f1a2b0d3..3e84ca10 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