Files
weave/test/run_all.sh
T
Tom Wilkie 13f1239a3e Various improvements to unit test running
- units.sh should exit on error.
- Add race detector to unit test runner.
- Use local testing/cover/cover tool in gen_coverage_report.sh and units.sh
- Use the scheduler to parallelise the unit tests.
- Make test run id a string and differentiate between unit runs and integration runs in the scheduler.
- Pipe circle env vars through to build container so we can detect when to use the scheduler
- Add python requests to the weave build container.
- Quote test names in urls, make flask handle url segments with slashes in.
2015-07-13 09:33:52 +00:00

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "$DIR/config.sh"
whitely echo Sanity checks
if ! bash "$DIR/sanity_check.sh"; then
whitely echo ...failed
exit 1
fi
whitely echo ...ok
# Modified version of _assert_cleanup from assert.sh that
# prints overall status
check_test_status() {
if [ $? -ne 0 ]; then
redly echo "---= !!!ABNORMAL TEST TERMINATION!!! =---"
elif [ $tests_suite_status -ne 0 ]; then
redly echo "---= !!!SUITE FAILURES - SEE ABOVE FOR DETAILS!!! =---"
exit $tests_suite_status
else
greenly echo "---= ALL SUITES PASSED =---"
fi
}
# Overwrite assert.sh _assert_cleanup trap with our own
trap check_test_status EXIT
TESTS="${@:-*_test.sh}"
# If running on circle, use the scheduler to work out what tests to run
if [ -n "$CIRCLECI" -a -z "$NO_SCHEDULER" ]; then
TESTS=$(echo $TESTS | "$DIR/sched" sched integration-$CIRCLE_BUILD_NUM $CIRCLE_NODE_TOTAL $CIRCLE_NODE_INDEX)
fi
echo Running $TESTS
for t in $TESTS; do
echo
greyly echo "---= Running $t =---"
. $t
# Report test runtime when running on circle, to help scheduler
if [ -n "$CIRCLECI" -a -z "$NO_SCHEDULER" ]; then
"$DIR/sched" time $t $(bc -l <<< "$tests_time/1000000000")
fi
done