gitlab-ci: Use xvfb-run

Change the CI scripts to use xvfb-run instead of running Xvfb directly.

That avoids a potential race condition, where a test could fail because Xvfb
hasn't started listening for connections yet. xvfb-run will wait for Xvfb to be
ready before it runs any other programs.

That also simplifies error handling, because the CI scripts can just use
"set -e" instead of having to store the exit code, kill Xvfb, and then check
for an error.
This commit is contained in:
Kyle Brenneman 2019-12-09 11:34:12 -07:00
parent 4852538bdb
commit 27251993ba
3 changed files with 4 additions and 30 deletions

View File

@ -11,12 +11,5 @@ cd build
make V=1 VERBOSE=1
Xvfb :99 &
xvfb-run --auto-servernum make check V=1 VERBOSE=1
set +e
DISPLAY=:99 make check V=1 VERBOSE=1
RESULT=$?
set -e
kill %Xvfb
exit $RESULT

View File

@ -9,17 +9,11 @@ mkdir build
cd build
../configure
Xvfb :99 &
set +e
DISPLAY=:99 make distcheck V=1 VERBOSE=1
RESULT=$?
set -e
xvfb-run --auto-servernum make distcheck V=1 VERBOSE=1
# If make distcheck failed don't even bother with the meson check, the tarball
# may be invalid and it's just a waste
if [ $RESULT -ne 0 ]; then
kill %Xvfb
exit $RESULT
fi
@ -32,11 +26,6 @@ mkdir libglvnd
tar -xf libglvnd-*.tar.gz -C libglvnd --strip-components 1
pushd libglvnd
meson builddir --auto-features=enabled
set +e
DISPLAY=:99 ninja -C builddir test
RESULT=$?
set -e
xvfb-run --auto-servernum ninja -C builddir test
popd
kill %Xvfb
exit $RESULT

View File

@ -11,12 +11,4 @@ set -o xtrace
meson build --unity=on --auto-features=enabled $CONFIGURE_OPTIONS
ninja -C build
Xvfb :99 &
set +e
DISPLAY=:99 ninja -C build test
RESULT=$?
set -e
kill %Xvfb
exit $RESULT
xvfb-run --auto-servernum ninja -C build test