]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Birdtest: Improve a tests lancher script
authorPavel Tvrdík <pawel.tvrdik@gmail.cz>
Mon, 13 Apr 2015 08:33:04 +0000 (10:33 +0200)
committerPavel Tvrdík <pawel.tvrdik@gmail.cz>
Mon, 13 Apr 2015 08:33:04 +0000 (10:33 +0200)
tools/Makefile-top.in
tools/run_tests.sh

index 3f199a8a97cc031771d13fa08f4617010a248662..c68ed54702ecbcf52f9746431ae4d0f67cd28a59 100644 (file)
@@ -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
index f1a2b0d38158039b0492e41a0702031a0fc00798..3e84ca108de44355c86b9250fe93890b10169175 100755 (executable)
@@ -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