Fix failures and protect the suite from spurious VERSION-related warnings
[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   if [[ "$VCPU_USE" == 1 ]]; then
11     ulim=$(( ( $(ps xH | wc -l) - 3 ) + 4 )) # (real count excluding header + ps + wc) + space for ( make + tee + harness + <actual test> )
12     echo_err "$(tstamp) Setting process/thread limit to $ulim"
13     ulimit -u $ulim
14     sleep 10 # needed to settle things down a bit
15   fi
16   make test 2> >(tee "$TEST_STDERR_LOG")
17 }
18
19 # announce everything we have on this box
20 TRAVIS="" perl -Ilib t/00describe_environment.t >/dev/null
21
22 TEST_T0=$SECONDS
23 if [[ "$CLEANTEST" = "true" ]] ; then
24   echo_err "$(tstamp) Running tests with plain \`make test\`"
25   run_or_err "Prepare blib" "make pure_all"
26   run_harness_tests
27 else
28   PROVECMD="prove -lrswj$VCPU_USE xt t"
29
30   # FIXME - temporary, until Package::Stash is fixed
31   if perl -M5.010 -e 1 &>/dev/null ; then
32     PROVECMD="$PROVECMD -T"
33   fi
34
35   echo_err "$(tstamp) running tests with \`$PROVECMD\`"
36   $PROVECMD 2> >(tee "$TEST_STDERR_LOG")
37 fi
38 TEST_T1=$SECONDS
39
40 if \
41    [[ -z "$DBIC_TRACE" ]] \
42 && [[ -z "$DBIC_MULTICREATE_DEBUG" ]] \
43 && [[ -z "$DBICTEST_DEBUG_CONCURRENCY_LOCKS" ]] \
44 && [[ -z "$DBICTEST_VERSION_WARNS_INDISCRIMINATELY" ]] \
45 && [[ -s "$TEST_STDERR_LOG" ]] ; then
46   STDERR_LOG_SIZE=$(wc -l < "$TEST_STDERR_LOG")
47
48   # prepend STDERR log
49   POSTMORTEM="$(
50     echo
51     echo "Test run produced $STDERR_LOG_SIZE lines of output on STDERR:"
52     echo "============================================================="
53     cat "$TEST_STDERR_LOG"
54     echo "============================================================="
55     echo "End of test run STDERR output ($STDERR_LOG_SIZE lines)"
56     echo
57     echo
58   )$POSTMORTEM"
59 fi
60
61 echo
62 echo "${POSTMORTEM:- \o/ No notable smoke run issues \o/ }"
63 echo
64 echo "$(tstamp) Testing took a total of $(( $TEST_T1 - $TEST_T0 ))s"
65 if [[ -n "$INSTALLDEPS_OUT" ]] ; then
66   echo "$(tstamp) Full dep install log at $(/usr/bin/nopaste -q -s Shadowcat -d DepInstall <<< "$INSTALLDEPS_OUT")"
67 fi
68 echo