0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-05 08:31:53 +00:00

Birdtest: Improve a tests lancher script

This commit is contained in:
Pavel Tvrdík 2015-04-13 10:33:04 +02:00
parent 9a49b70d1b
commit 8f5f52838e
2 changed files with 15 additions and 5 deletions

View File

@ -23,3 +23,4 @@ distclean: clean
clean-tests: clean-tests:
find . -name '*_test' | xargs rm -f find . -name '*_test' | xargs rm -f
rm -f $(objdir)/test/birdtest.o

View File

@ -13,10 +13,19 @@ num_succ_tests=0
num_fail_tests=0 num_fail_tests=0
echo -e " == Start all $num_all_tests unit tests ==\n" echo -e " == Start all $num_all_tests unit tests ==\n"
for test in $all_tests ; do for test in $all_tests ; do
echo -e " [$((num_test++))/$num_all_tests] $test" ./$test ; exit_code=$?
./$test \ cols=$(tput cols)
&& num_succ_tests=$((num_succ_tests+1)) \ offset=$((cols-17))
|| num_fail_tests=$((num_fail_tests+1)) 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 done
num_all_tests_src=0 num_all_tests_src=0