mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Have Travis print out build logs in case of test failures
To get the after_failure line work, I had to move the inline build script to a separate script (util/travis-script.sh) The second script (util/travis-after-failure.sh) will output LastTest.log for cmake based builds and all files named test*.log for an autotools based build. Note: this commit also comes with a delibarate test failure to illustrate the Travis behaviour. It will be removed in the next commit.
This commit is contained in:
19
util/travis-after-failure.sh
Executable file
19
util/travis-after-failure.sh
Executable file
@@ -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
|
||||
|
||||
30
util/travis-script.sh
Executable file
30
util/travis-script.sh
Executable file
@@ -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
|
||||
cmake $TRAVIS_BUILD_DIR
|
||||
make -j 4
|
||||
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
|
||||
cmake -G Ninja $TRAVIS_BUILD_DIR
|
||||
ninja
|
||||
ninja check
|
||||
|
||||
# 3. autotools build
|
||||
elif [[ "$BUILDTYPE" == "autotools" ]]; then
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make check
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user