Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
group: deprecated-2017Q3

language: cpp
os: linux
sudo: required
Expand All @@ -6,9 +8,12 @@ compiler:
- clang
- gcc
env:
- GMOCK_VER=1.8.0
- GMOCK_VER=1.7.0
- GMOCK_PATH=/usr/src/gmock #1.6.0 from ubuntu trusty repo
global:
- DISPLAY=:99
matrix:
- GMOCK_VER=1.8.0
- GMOCK_VER=1.7.0
- GMOCK_PATH=/usr/src/gmock #1.6.0 from ubuntu trusty repo
matrix:
include:
- os: linux
Expand Down
55 changes: 30 additions & 25 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@
set -e #break script on non-zero exitcode from any command
set -x #display command being executed

startXvfb () {
# Xvfb sends SIGUSR1 to its parent when it finished startup, this causes the 'wait' below to stop waiting
# Starting Xvfb hangs on OSX, that's why we do this on Linux only now
if [[ "${TRAVIS_OS_NAME}" = "linux" ]]; then
trap : USR1
(trap '' USR1; Xvfb $DISPLAY -screen 0 640x480x8 -nolisten tcp > /dev/null 2>&1) &
XVFBPID=$!
wait || :
trap '' USR1
if ! kill -0 $XVFBPID 2> /dev/null; then
echo "Xvfb failed to start" >&2
exit 1
fi
else
sudo Xvfb $DISPLAY -screen 0 640x480x8 -nolisten tcp > /dev/null 2>&1 &
XVFBPID=$!
sleep 5
fi
}

killXvfb () {
if [ -n "${XVFBPID:-}" ]; then
# Stop virtual X display server
sudo kill $XVFBPID
wait
fi
}

CTEST_OUTPUT_ON_FAILURE=ON
export CTEST_OUTPUT_ON_FAILURE

Expand All @@ -27,26 +55,7 @@ cmake --build build
cmake --build build --target test
cmake --build build --target features

# Start virtual X display server

# Starting Xvfb hangs on OSX, that's why we do this on Linux only now
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
DISPLAY=:99
export DISPLAY

# Xvfb sends SIGUSR1 to its parent when it finished startup, this causes the 'wait' below to stop waiting
trap : USR1
(trap '' USR1; Xvfb $DISPLAY -screen 0 640x480x8 -nolisten tcp > /dev/null 2>&1) &
XVFBPID=$!
wait || :
trap '' USR1
if ! kill -0 $XVFBPID 2> /dev/null; then
echo "Xvfb failed to start" >&2
exit 1
fi
else
unset DISPLAY
fi
startXvfb # Start virtual X display server

for TEST in \
build/examples/Calc/GTestCalculatorSteps \
Expand Down Expand Up @@ -83,8 +92,4 @@ if [ -f "${TEST}" ]; then
wait %
fi

if [ -n "${XVFBPID:-}" ]; then
# Stop virtual X display server
kill $XVFBPID
wait
fi
killXvfb