From 1012fb2a8e6961028f441979fd10e33c8f726291 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 20 Feb 2013 10:20:24 -0800 Subject: [PATCH] Check the number of tests run by testr. Check that the number of tests run by testr is equal to the number of tests found by testr. If subunit has a catastrophic failure these two numbers will not match but testr reports success. Check if the numbers match and if not fail the build with a useful message. Change-Id: I849db8912dd0d9974fb83ed08bc93646b0eb3e9f Reviewed-on: https://review.openstack.org/22456 Reviewed-by: Dan Smith Reviewed-by: Monty Taylor Reviewed-by: James E. Blair Reviewed-by: Jeremy Stanley Reviewed-by: Sean Dague Reviewed-by: Khai Do Approved: Clark Boylan Tested-by: Jenkins --- modules/jenkins/files/slave_scripts/run-tox.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/jenkins/files/slave_scripts/run-tox.sh b/modules/jenkins/files/slave_scripts/run-tox.sh index 7337fb3a6a..f969686edf 100755 --- a/modules/jenkins/files/slave_scripts/run-tox.sh +++ b/modules/jenkins/files/slave_scripts/run-tox.sh @@ -90,4 +90,21 @@ else echo fi +if [ -d ".testrepository" ] +then + source .tox/$venv/bin/activate + foundcount=$(testr list-tests | sed -e '1d' | wc -l) + rancount=$(testr last | sed -ne 's/Ran \([0-9]\+\).*tests in.*/\1/p') + if [ "$foundcount" -ne "$rancount" ] + then + echo + echo "The number of tests found did not match the number of tests" + echo "that were run. This indicates a fatal error occured while" + echo "running the tests." + echo "Tests found: $foundcount Tests ran: $rancount" + echo + exit 1 + fi +fi + exit $result