(travis) Refactor the NUMTHREADS codepaths, rename variable (see next commit)
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 40_script.bash
1 #!/bin/bash
2
3 # this file is executed in a subshell - set up the common stuff
4 source maint/travis-ci_scripts/common.bash
5
6 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then exit 0 ; fi
7
8 run_harness_tests() {
9   local -x HARNESS_OPTIONS=c:j$VCPU_USE
10   make test 2> >(tee "$TEST_STDERR_LOG")
11 }
12
13 TEST_T0=$SECONDS
14 if [[ "$CLEANTEST" = "true" ]] ; then
15   echo_err "$(tstamp) Running tests with plain \`make test\`"
16   run_or_err "Prepare blib" "make pure_all"
17   run_harness_tests
18 else
19   PROVECMD="prove -lrswj$VCPU_USE xt t"
20
21   # FIXME - temporary, until Package::Stash is fixed
22   if perl -M5.010 -e 1 &>/dev/null ; then
23     PROVECMD="$PROVECMD -T"
24   fi
25
26   echo_err "$(tstamp) running tests with \`$PROVECMD\`"
27   $PROVECMD 2> >(tee "$TEST_STDERR_LOG")
28 fi
29 TEST_T1=$SECONDS
30
31 if [[ -z "$DBIC_TRACE" ]] && [[ -z "$DBIC_MULTICREATE_DEBUG" ]] && [[ -s "$TEST_STDERR_LOG" ]] ; then
32   STDERR_LOG_SIZE=$(wc -l < "$TEST_STDERR_LOG")
33
34   # prepend STDERR log
35   POSTMORTEM="$(
36     echo
37     echo "Test run produced $STDERR_LOG_SIZE lines of output on STDERR:"
38     echo "============================================================="
39     cat "$TEST_STDERR_LOG"
40     echo "============================================================="
41     echo "End of test run STDERR output ($STDERR_LOG_SIZE lines)"
42     echo
43     echo
44   )$POSTMORTEM"
45 fi
46
47 echo
48 echo "${POSTMORTEM:- \o/ No notable smoke run issues \o/ }"
49 echo
50 echo "$(tstamp) Testing took a total of $(( $TEST_T1 - $TEST_T0 ))s"
51 if [[ -n "$INSTALLDEPS_OUT" ]] ; then
52   echo "$(tstamp) Full dep install log at $(/usr/bin/nopaste -q -s Shadowcat -d DepInstall <<< "$INSTALLDEPS_OUT")"
53 fi
54 echo