travis: Fail when a unit test fails

* Oops, this never actually aborted when something went wrong.
* Fix that and abort.
* Print a brief message about the last script run that blew up.
This commit is contained in:
Kyle Manna 2016-06-01 13:25:08 -07:00
parent 61bb4a933c
commit f3a24fee60
2 changed files with 16 additions and 1 deletions

View File

@ -18,4 +18,4 @@ before_install:
- docker run kylemanna/openvpn openssl version - docker run kylemanna/openvpn openssl version
script: script:
- pushd tests && for i in *.sh; do echo -e "\n\n>> Running test $i\n\n"; "./$i"; done && popd - ./test-ci.sh

15
test-ci.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -x
cd "$(dirname "$(readlink -f "$0")")/tests"
for i in *.sh; do
echo -e "\n>> Running test $i\n"
./${i}
retval=$?
if [ $retval != 0 ]; then
echo "Failed $i with exit code $retval"
exit $retval
fi
done