From 2535ae922c556a88ac7a6152247b794d96692eeb Mon Sep 17 00:00:00 2001 From: Emmanuel Promayon Date: Tue, 5 Jun 2018 07:18:48 +0200 Subject: [PATCH 1/4] FIXED (tentative) run one XVFB server on which all tests are done This is to try avoid some random "QXcbConnection: Could not connect to display :99" error (that seems to occur especially during nightly build...) --- .gitlab/build.sh | 2 +- .gitlab/configure.sh | 2 +- .gitlab/coverage.sh | 2 +- .gitlab/test.sh | 57 ++++++++++--------- .../config/testing/config-test.sh | 20 +++---- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/.gitlab/build.sh b/.gitlab/build.sh index fbb075db..956c9fdb 100755 --- a/.gitlab/build.sh +++ b/.gitlab/build.sh @@ -9,7 +9,7 @@ if ! grep -q TRIGGER_STAGE_BUILD "${PROJECT_LOG_DIR}/trigger-stage.txt"; then exit 1; fi -echo "Build" +echo "===== build =====" if [ "$OS" == "win7" ]; then # there is no xvfb on windows diff --git a/.gitlab/configure.sh b/.gitlab/configure.sh index d74501a5..b5bb7fcd 100755 --- a/.gitlab/configure.sh +++ b/.gitlab/configure.sh @@ -9,7 +9,7 @@ if ! grep -q TRIGGER_STAGE_CONFIGURE "${PROJECT_LOG_DIR}/trigger-stage.txt"; the exit 1; fi -echo "Configure step" +echo "===== configure =====" # Clean build directory # note: cannot build outside the source tree otherwise artifacts cannot be collected diff --git a/.gitlab/coverage.sh b/.gitlab/coverage.sh index e1670360..e5fb7afc 100755 --- a/.gitlab/coverage.sh +++ b/.gitlab/coverage.sh @@ -7,7 +7,7 @@ if ! grep -q TRIGGER_STAGE_COVERAGE "${PROJECT_LOG_DIR}/trigger-stage.txt"; then exit 1; fi -echo "Coverage" +echo "===== coverage =====" # coverage for some reason seems to always exit with non-zero code. Force exit 0 xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" \ diff --git a/.gitlab/test.sh b/.gitlab/test.sh index 2e4d9733..57c9859a 100755 --- a/.gitlab/test.sh +++ b/.gitlab/test.sh @@ -9,34 +9,35 @@ if ! grep -q TRIGGER_STAGE_TEST "${PROJECT_LOG_DIR}/trigger-stage.txt"; then exit 1; fi -echo "Test" - - -if [ "$OS" == "win7" ]; then - # there is no xvfb on windows - ctest -VV \ - -DCTEST_SITE="$CDASH_SITE" \ - -DCI_MODE="$CAMITK_CI_MODE" \ - -DCI_ID="P $CI_PIPELINE_ID - J $CI_BUILD_ID" \ - -DCI_BRANCH="$CI_COMMIT_REF_NAME" \ - -DCI_BUILD_SETTINGS="$COMPILER_CONFIG" \ - -DCI_PROJECT_LOG_DIRECTORY="$CI_PROJECT_DIR/$PROJECT_LOG_DIR" \ - -DCTEST_SOURCE_DIRECTORY="$PROJECT_SOURCE_DIR" \ - -DCTEST_BINARY_DIRECTORY="$PROJECT_BUILD_DIR" \ - -S $PROJECT_SOURCE_DIR/sdk/cmake/ctest/ci-test.cmake > >(tee ${PROJECT_LOG_DIR}/test.log | grep --line-buffered -e "Test \#") 2>&1 -else - # on Linux, xvfb is required to run the tests - xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" \ - ctest -VV \ - -DCTEST_SITE="$CDASH_SITE" \ - -DCI_MODE="$CAMITK_CI_MODE" \ - -DCI_ID="P $CI_PIPELINE_ID - J $CI_BUILD_ID" \ - -DCI_BRANCH="$CI_COMMIT_REF_NAME" \ - -DCI_BUILD_SETTINGS="$COMPILER_CONFIG" \ - -DCI_PROJECT_LOG_DIRECTORY="$CI_PROJECT_DIR/$PROJECT_LOG_DIR" \ - -DCTEST_SOURCE_DIRECTORY="$PROJECT_SOURCE_DIR" \ - -DCTEST_BINARY_DIRECTORY="$PROJECT_BUILD_DIR" \ - -S $PROJECT_SOURCE_DIR/sdk/cmake/ctest/ci-test.cmake > >(tee ${PROJECT_LOG_DIR}/test.log | grep --line-buffered -e "Test \#") 2>&1 +echo "===== test =====" + + +if [[ "$osName" != "win7" ]]; then + echo "===== Configuring xvfb =====" + # Starts the server first (try to avoid unexpected and random "QXcbConnection: Could not connect to display :99") + # see also https://doc.qt.io/qt-5/embedded-linux.html#linuxfb + Xvfb :5 -screen 0 1600x1200x24 -ac +extension GLX +render -noreset -v -fbdir $workingDir/ & + xvfbPid=$! + echo "PID of Xvfb: $xvfbPid" + export DISPLAY=:5 + export XAUTHORITY=/dev/null +fi + +ctest -VV \ + -DCTEST_SITE="$CDASH_SITE" \ + -DCI_MODE="$CAMITK_CI_MODE" \ + -DCI_ID="P $CI_PIPELINE_ID - J $CI_BUILD_ID" \ + -DCI_BRANCH="$CI_COMMIT_REF_NAME" \ + -DCI_BUILD_SETTINGS="$COMPILER_CONFIG" \ + -DCI_PROJECT_LOG_DIRECTORY="$CI_PROJECT_DIR/$PROJECT_LOG_DIR" \ + -DCTEST_SOURCE_DIRECTORY="$PROJECT_SOURCE_DIR" \ + -DCTEST_BINARY_DIRECTORY="$PROJECT_BUILD_DIR" \ + -S $PROJECT_SOURCE_DIR/sdk/cmake/ctest/ci-test.cmake > >(tee ${PROJECT_LOG_DIR}/test.log | grep --line-buffered -e "Test \#") 2>&1 + + +if [[ "$OS" != "win7" ]]; then + # shutdown xvfb + kill $xvfbPid fi # as ctest return a strange 255 error, check the log diff --git a/sdk/applications/config/testing/config-test.sh b/sdk/applications/config/testing/config-test.sh index 436d66a2..3ea4804d 100644 --- a/sdk/applications/config/testing/config-test.sh +++ b/sdk/applications/config/testing/config-test.sh @@ -24,10 +24,10 @@ set -e cleanup() { # backup the current exit status currentExitValue=$? - if [[ "$osName" != "Windows" ]]; then - # kill the xfvb - kill $xvfbPid - fi + if [[ "$osName" != "Windows" ]]; then + # kill the xfvb + kill $xvfbPid + fi # cleanup current dir (but not build dir!) if [ "$inBuild" == "0" ] ; then rm -rf $workingDir @@ -89,12 +89,12 @@ fi echo "===== Checking $camitkConfig =====" # check if current build is on windows debug version if ! hash -lt ${camitkConfig} 2>/dev/null; then - echo "===== Not found: $camitkConfig on $osName =====" - if [[ "$osName" == "Windows" ]]; then - echo "===== camitk-config binary not found, using Debug version on Windows =====" - # try with debug postfix - camitkConfig=$camitkConfig-debug - fi + echo "===== Not found: $camitkConfig on $osName =====" + if [[ "$osName" == "Windows" ]]; then + echo "===== camitk-config binary not found, using Debug version on Windows =====" + # try with debug postfix + camitkConfig=$camitkConfig-debug + fi fi echo "===== Get CamiTK configuration =====" -- GitLab From b02255743f6c7bf1127903f08de35c8ae7664902 Mon Sep 17 00:00:00 2001 From: Emmanuel Promayon Date: Tue, 5 Jun 2018 08:31:05 +0200 Subject: [PATCH 2/4] FIXED display :5 clashes with the Xvfb started in config-test.sh --- .gitlab/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/test.sh b/.gitlab/test.sh index 57c9859a..558227ba 100755 --- a/.gitlab/test.sh +++ b/.gitlab/test.sh @@ -16,10 +16,10 @@ if [[ "$osName" != "win7" ]]; then echo "===== Configuring xvfb =====" # Starts the server first (try to avoid unexpected and random "QXcbConnection: Could not connect to display :99") # see also https://doc.qt.io/qt-5/embedded-linux.html#linuxfb - Xvfb :5 -screen 0 1600x1200x24 -ac +extension GLX +render -noreset -v -fbdir $workingDir/ & + Xvfb :42 -screen 0 1600x1200x24 -ac +extension GLX +render -noreset -v -fbdir $workingDir/ & xvfbPid=$! echo "PID of Xvfb: $xvfbPid" - export DISPLAY=:5 + export DISPLAY=:42 export XAUTHORITY=/dev/null fi -- GitLab From 7a00ea0bb4370953ba9e1561e863ec3cff26f369 Mon Sep 17 00:00:00 2001 From: Emmanuel Promayon Date: Tue, 5 Jun 2018 13:14:39 +0200 Subject: [PATCH 3/4] FIXED (tentative) testing another way to run Xfvb --- .gitlab/test.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab/test.sh b/.gitlab/test.sh index 558227ba..681dc2cb 100755 --- a/.gitlab/test.sh +++ b/.gitlab/test.sh @@ -16,10 +16,10 @@ if [[ "$osName" != "win7" ]]; then echo "===== Configuring xvfb =====" # Starts the server first (try to avoid unexpected and random "QXcbConnection: Could not connect to display :99") # see also https://doc.qt.io/qt-5/embedded-linux.html#linuxfb - Xvfb :42 -screen 0 1600x1200x24 -ac +extension GLX +render -noreset -v -fbdir $workingDir/ & - xvfbPid=$! - echo "PID of Xvfb: $xvfbPid" - export DISPLAY=:42 + export DISPLAY=":98" + Xvfb $DISPLAY -screen 0 1600x1200x24 -ac +extension GLX +render -noreset -v -fbdir $workingDir/ &> ${PROJECT_LOG_DIR}/test.log & + trap "kill $! || true" EXIT + sleep 10 export XAUTHORITY=/dev/null fi @@ -35,10 +35,10 @@ ctest -VV \ -S $PROJECT_SOURCE_DIR/sdk/cmake/ctest/ci-test.cmake > >(tee ${PROJECT_LOG_DIR}/test.log | grep --line-buffered -e "Test \#") 2>&1 -if [[ "$OS" != "win7" ]]; then - # shutdown xvfb - kill $xvfbPid -fi +# if [[ "$OS" != "win7" ]]; then +# # shutdown xvfb +# kill $xvfbPid +# fi # as ctest return a strange 255 error, check the log if grep --quiet "Fatal error" $CI_PROJECT_DIR/$PROJECT_LOG_DIR/ci-test.log; then -- GitLab From 06b128e5b007f607fd5888efa1cbb07b80b9147d Mon Sep 17 00:00:00 2001 From: Emmanuel Promayon Date: Tue, 5 Jun 2018 14:31:21 +0200 Subject: [PATCH 4/4] FIXED (tentative) simplify xvfb parameters --- .gitlab/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab/test.sh b/.gitlab/test.sh index 681dc2cb..0bfb737a 100755 --- a/.gitlab/test.sh +++ b/.gitlab/test.sh @@ -17,7 +17,8 @@ if [[ "$osName" != "win7" ]]; then # Starts the server first (try to avoid unexpected and random "QXcbConnection: Could not connect to display :99") # see also https://doc.qt.io/qt-5/embedded-linux.html#linuxfb export DISPLAY=":98" - Xvfb $DISPLAY -screen 0 1600x1200x24 -ac +extension GLX +render -noreset -v -fbdir $workingDir/ &> ${PROJECT_LOG_DIR}/test.log & + #-ac +extension GLX +render -noreset -v -fbdir $workingDir/ &> ${PROJECT_LOG_DIR}/test.log & + Xvfb $DISPLAY -screen 0 1600x1200x24 &> ${PROJECT_LOG_DIR}/test.log & trap "kill $! || true" EXIT sleep 10 export XAUTHORITY=/dev/null -- GitLab