Skip to content

Commit

Permalink
List failed tests and the content of the .failed files
Browse files Browse the repository at this point in the history
We list the failed tests after dumping the contents of the
.failed files so that eups distrib will be able to report
the failed tests properly.

Switch to .format() for string formatting so as to not repeat
"testsDir" four distinct times.
  • Loading branch information
timj committed Nov 10, 2015
1 parent 3ed848b commit f6a7bb4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/lsst/sconsUtils/scripts.py
Expand Up @@ -168,13 +168,17 @@ def finish(defaultTargets=DEFAULT_TARGETS,
if "tests" in [str(t) for t in BUILD_TARGETS]:
testsDir = pipes.quote(os.path.join(os.getcwd(), "tests", ".tests"))
checkTestStatus_command = state.env.Command('checkTestStatus', [], """
@ if [ -d %s ]; then \
nfail=`find %s -name \*.failed | wc -l | sed -e 's/ //g'`; \
@ if [ -d {0} ]; then \
nfail=`find {0} -name \*.failed | wc -l | sed -e 's/ //g'`; \
if [ $$nfail -gt 0 ]; then \
echo "Failed test output:" >&2; \
find {0} -name \*.failed -exec cat {{}} \; >&2; \
echo "The following tests failed:" >&2;\
find {0} -name \*.failed >&2; \
echo "$$nfail tests failed" >&2; exit 1; \
fi; \
fi; \
""" % (testsDir, testsDir))
""".format(testsDir))

state.env.Depends(checkTestStatus_command, BUILD_TARGETS) # this is why the check runs last
BUILD_TARGETS.extend(checkTestStatus_command)
Expand Down

0 comments on commit f6a7bb4

Please sign in to comment.