netconf error handling and test summary script
This commit is contained in:
parent
f872c7e295
commit
861300d6c0
23 changed files with 331 additions and 189 deletions
40
test/all.sh
40
test/all.sh
|
|
@ -1,17 +1,43 @@
|
|||
#!/bin/bash
|
||||
# Run, eg as:
|
||||
# ./run.sh 2>&1 | tee test.log
|
||||
# ./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"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# include err() and new() functions
|
||||
. ./lib.sh
|
||||
|
||||
err=0
|
||||
for test in test*.sh; do
|
||||
echo "Running $test"
|
||||
./$test
|
||||
errcode=$?
|
||||
if [ $summary -ne 0 ]; then
|
||||
./$test > /dev/null 2>&1
|
||||
errcode=$?
|
||||
else
|
||||
./$test
|
||||
errcode=$?
|
||||
fi
|
||||
if [ $errcode -ne 0 ]; then
|
||||
echo "Error in $test errcode=$errcode"
|
||||
exit $errcode
|
||||
err=1
|
||||
echo -e "\e[31mError in $test errcode=$errcode"
|
||||
echo -ne "\e[0m"
|
||||
if [ $summary -eq 0 ]; then
|
||||
exit $errcode
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo OK
|
||||
if [ $err -eq 0 ]; then
|
||||
echo OK
|
||||
else
|
||||
echo -e "\e[31mError"
|
||||
echo -ne "\e[0m"
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue