diff --git a/.travis.yml b/.travis.yml index 15fe1467b4..64e663603b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,31 +22,5 @@ install: - sudo apt-get install -qq libboost-all-dev libgtk-3-dev libwebkit2gtk-3.0-dev - sudo apt-get --reinstall install -qq language-pack-en language-pack-fr - git clone https://github.com/google/googletest -b release-1.8.0 ~/gtest -script: | - # The -e here says that if any line below fails, the whole script fails - set -ev - - # First, do the cmake build using the default Makefile generator - if [[ "$BUILDTYPE" == "cmake-make" ]]; then - mkdir /tmp/gnucash-build-cmake-make - cd /tmp/gnucash-build-cmake-make - GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock cmake $TRAVIS_BUILD_DIR - make -j 4 - TZ="America/Los_Angeles" make check - - # Next, do cmake again, using the Ninja generator this time - elif [[ "$BUILDTYPE" == "cmake-ninja" ]]; then - mkdir /tmp/gnucash-build-cmake-ninja - cd /tmp/gnucash-build-cmake-ninja - GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock cmake -G Ninja $TRAVIS_BUILD_DIR - ninja - TZ="America/Los_Angeles" ninja check - - # Finally, do the autotools build - elif [[ "$BUILDTYPE" == "autotools" ]]; then - cd $TRAVIS_BUILD_DIR - ./autogen.sh - ./configure --enable-python GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock - make - TZ="America/Los_Angeles" make check - fi +script: ./util/travis-script.sh +after_failure: ./util/travis-after-failure.sh diff --git a/util/travis-after-failure.sh b/util/travis-after-failure.sh new file mode 100755 index 0000000000..64957def4b --- /dev/null +++ b/util/travis-after-failure.sh @@ -0,0 +1,19 @@ +#! /bin/bash + +# Build logs are located in different places depending on the build environment used +if [[ "$BUILDTYPE" == "cmake-make" ]] || [[ "$BUILDTYPE" == "cmake-ninja" ]]; then + echo "##### LastTest.log #####" + echo "#########################" + cat /tmp/gnucash-build-${BUILDTYPE}/Testing/Temporary/LastTest.log +elif [[ "$BUILDTYPE" == "autotools" ]]; then + for logfile in $( find . -name 'test*.log' ); do + SIZE=$((${#logfile} + 12)) + HRULE=$(head -c $SIZE < /dev/zero | tr '\0' '#') + echo $HRULE + echo "##### ${logfile} #####" + echo $HRULE + cat -- "$logfile" + echo -e "\n\n" + done +fi + diff --git a/util/travis-script.sh b/util/travis-script.sh new file mode 100755 index 0000000000..8e14edd608 --- /dev/null +++ b/util/travis-script.sh @@ -0,0 +1,30 @@ +#! /bin/bash -ev +# The -e above says that if any line below fails, the whole script fails + +# Run tests in different build configurations depending on the +# value of the BUILDTYPE environment variable +# 1. cmake build using the default Makefile generator +if [[ "$BUILDTYPE" == "cmake-make" ]]; then + mkdir /tmp/gnucash-build-cmake-make + cd /tmp/gnucash-build-cmake-make + GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock cmake $TRAVIS_BUILD_DIR + make -j 4 + TZ="America/Los_Angeles" make check + +# 2. cmake build using the Ninja generator +elif [[ "$BUILDTYPE" == "cmake-ninja" ]]; then + mkdir /tmp/gnucash-build-cmake-ninja + cd /tmp/gnucash-build-cmake-ninja + GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock cmake -G Ninja $TRAVIS_BUILD_DIR + ninja + TZ="America/Los_Angeles" ninja check + +# 3. autotools build +elif [[ "$BUILDTYPE" == "autotools" ]]; then + cd $TRAVIS_BUILD_DIR + ./autogen.sh + ./configure --enable-python GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock + make + TZ="America/Los_Angeles" make check +fi +