Trap and display STDERR during travis test runs
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 40_script.bash
1 #!/bin/bash
2
3 source maint/travis-ci_scripts/common.bash
4 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
5
6 export HARNESS_TIMER=1 HARNESS_OPTIONS=c:j$NUMTHREADS
7
8 TEST_T0=$SECONDS
9 if [[ "$CLEANTEST" = "true" ]] ; then
10   echo_err "$(tstamp) Running tests with plain \`make test\`"
11   run_or_err "Prepare blib" "make pure_all"
12   make test 2> >(tee "$TEST_STDERR_LOG")
13 else
14   PROVECMD="prove -lrswj$NUMTHREADS t xt"
15   echo_err "$(tstamp) running tests with \`$PROVECMD\`"
16   $PROVECMD 2> >(tee "$TEST_STDERR_LOG")
17 fi
18 TEST_T1=$SECONDS
19
20 if [[ -z "$DBICTRACE" ]] && [[ -z "$POISON_ENV" ]] && [[ -s "$TEST_STDERR_LOG" ]] ; then
21   STDERR_LOG_SIZE=$(wc -l < "$TEST_STDERR_LOG")
22
23   echo
24   echo "Test run produced $STDERR_LOG_SIZE lines of output on STDERR:"
25   echo "============================================================="
26   cat "$TEST_STDERR_LOG"
27   echo "============================================================="
28   echo "End of test run STDERR output ($STDERR_LOG_SIZE lines)"
29   echo
30 fi
31
32 echo "$(tstamp) Testing took a total of $(( $TEST_T1 - $TEST_T0 ))s"