Skip to content

Commit d27f6ce

Browse files
committed
Travis: run Qt examples too
1 parent 4ad75e3 commit d27f6ce

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ addons:
3636
- ninja-build
3737
- valgrind
3838
- qtbase5-dev
39+
- xvfb
3940

4041
before_install:
4142
- if [[ "${TRAVIS_OS_NAME}" = "osx" ]]; then brew update && brew install ninja qt5; fi

travis.sh

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,54 @@ cmake --build build
2828
cmake --build build --target test
2929
cmake --build build --target features
3030

31-
for CALC_EXAMPLE in \
31+
# Start virtual X display server
32+
33+
# Starting Xvfb hangs on OSX, that's why we do this on Linux only now
34+
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
35+
DISPLAY=:99
36+
export DISPLAY
37+
38+
# Xvfb sends SIGUSR1 to its parent when it finished startup, this causes the 'wait' below to stop waiting
39+
trap : USR1
40+
(trap '' USR1; Xvfb $DISPLAY -screen 0 640x480x8 -nolisten tcp > /dev/null 2>&1) &
41+
XVFBPID=$!
42+
wait || :
43+
trap '' USR1
44+
if ! kill -0 $XVFBPID 2> /dev/null; then
45+
echo "Xvfb failed to start" >&2
46+
exit 1
47+
fi
48+
else
49+
unset DISPLAY
50+
fi
51+
52+
for TEST in \
3253
build/examples/Calc/GTestCalculatorSteps \
3354
build/examples/Calc/BoostCalculatorSteps \
3455
build/examples/Calc/FuncArgsCalculatorSteps \
3556
; do
36-
if [ -f "${CALC_EXAMPLE}" ]; then
37-
"${CALC_EXAMPLE}" > /dev/null &
57+
if [ -f "${TEST}" ]; then
58+
"${TEST}" > /dev/null &
59+
sleep 1
3860
cucumber examples/Calc
39-
wait
61+
wait %
4062
fi
4163
done
64+
65+
for TEST in \
66+
build/examples/CalcQt/GTestCalculatorQtSteps \
67+
build/examples/CalcQt/BoostCalculatorQtSteps \
68+
; do
69+
if [ -f "${TEST}" -a -n "${DISPLAY:-}" ]; then
70+
"${TEST}" 2> /dev/null &
71+
sleep 1
72+
cucumber examples/CalcQt
73+
wait %
74+
fi
75+
done
76+
77+
if [ -n "${XVFBPID:-}" ]; then
78+
# Stop virtual X display server
79+
kill $XVFBPID
80+
wait
81+
fi

0 commit comments

Comments
 (0)