test scripts: added sum.sh

This commit is contained in:
Olof hagsand 2019-02-02 13:19:49 +01:00
parent 936ae389e8
commit 376b75328c
4 changed files with 53 additions and 25 deletions

View file

@ -1,14 +1,9 @@
#!/bin/bash
# Run, eg as:
# ./all.sh 2>&1 | tee test.log # break on first test
# ./all.sh summary # to run all tests and print
summary=0
if [ $# -gt 0 ]; then
summary=1
fi
if [ $# -gt 1 ]; then
echo "usage: $0 [summary] # pipe to dev/null and continue on error"
echo "usage: $0 # detailed logs and stopon first error"
exit -1
fi
@ -17,20 +12,13 @@ fi
err=0
for test in test*.sh; do
echo "Running $test"
if [ $summary -ne 0 ]; then
./$test > /dev/null 2>&1
errcode=$?
else
./$test
errcode=$?
fi
./$test
errcode=$?
if [ $errcode -ne 0 ]; then
err=1
echo -e "\e[31mError in $test errcode=$errcode"
echo -ne "\e[0m"
if [ $summary -eq 0 ]; then
exit $errcode
fi
exit $errcode
fi
done
if [ $err -eq 0 ]; then