Streamline postmortem analysis, and fix non-essential-test report being lost
[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 run_harness_tests() {
7   local -x HARNESS_TIMER=1
8   local -x HARNESS_OPTIONS=c:j$NUMTHREADS
9   make test 2> >(tee "$TEST_STDERR_LOG")
10 }
11
12 TEST_T0=$SECONDS
13 if [[ "$CLEANTEST" = "true" ]] ; then
14   echo_err "$(tstamp) Running tests with plain \`make test\`"
15   run_or_err "Prepare blib" "make pure_all"
16   run_harness_tests
17 else
18   PROVECMD="prove --timer -lrswj$NUMTHREADS t xt"
19
20   # FIXME - temporary, until Package::Stash is fixed
21   if perl -M5.010 -e 1 &>/dev/null ; then
22     PROVECMD="$PROVECMD -T"
23   fi
24
25   echo_err "$(tstamp) running tests with \`$PROVECMD\`"
26   $PROVECMD 2> >(tee "$TEST_STDERR_LOG")
27 fi
28 TEST_T1=$SECONDS
29
30 if [[ -z "$DBICTRACE" ]] && [[ -z "$POISON_ENV" ]] && [[ -s "$TEST_STDERR_LOG" ]] ; then
31   STDERR_LOG_SIZE=$(wc -l < "$TEST_STDERR_LOG")
32
33   # prepend STDERR log
34   POSTMORTEM="$(
35     echo
36     echo "Test run produced $STDERR_LOG_SIZE lines of output on STDERR:"
37     echo "============================================================="
38     cat "$TEST_STDERR_LOG"
39     echo "============================================================="
40     echo "End of test run STDERR output ($STDERR_LOG_SIZE lines)"
41     echo
42   )$POSTMORTEM"
43 fi
44
45 echo
46 echo "${POSTMORTEM:- \o/ No notable smoke run issues \o/ }"
47 echo
48 echo "$(tstamp) Testing took a total of $(( $TEST_T1 - $TEST_T0 ))s"
49 if [[ -n "$INSTALLDEPS_OUT" ]] ; then
50   echo "$(tstamp) Full dep install log at $(/usr/bin/nopaste -q -s Shadowcat -d DepInstall <<< "$INSTALLDEPS_OUT")"
51 fi
52 echo