From 3e1e5372952da176641a91221e60423c4e10faa6 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Tue, 20 Apr 2021 15:34:26 +0200
Subject: [PATCH] Rerun failed tests a second time

For the continuous tests rerun failed tests a second time. This should reduce
the number of failing test pipelines.
In most cases of failing tests the Geant3 simulations crash due to the well
known memory error. If these tests are restarted they normally work without
problem.
Since the feature to restart tests is only available with cmake 3.17 change
the scripts of the CI pipeline to use at least this version.
---
 .gitlab-ci.yml     | 3 +--
 CbmRoot_test.cmake | 5 +++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d521140cbf..83c655c432 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -218,7 +218,6 @@ CbmRoot_Merge_macosx:
     - echo "export BUILDDIR=$PWD/build" >> Dart.cfg
     - echo "export SOURCEDIR=$PWD" >> Dart.cfg
     - echo "export NCPU=4" >> Dart.cfg
-    - echo "export PATH=\$SIMPATH/bin:$PATH" >> Dart.cfg
     - ls
     - pwd
     - cat Dart.cfg
@@ -252,7 +251,7 @@ CbmRoot_Merge_realData:
     - echo "export BUILDDIR=$PWD/build" >> Dart.cfg
     - echo "export SOURCEDIR=$PWD" >> Dart.cfg
     - echo "export NCPU=16" >> Dart.cfg
-    - echo "export PATH=\$SIMPATH/bin:$PATH" >> Dart.cfg
+    - echo "export PATH=/opt/cmake/3.20.1/bin:$PATH" >> Dart.cfg
     - ls
     - pwd
     - cat Dart.cfg
diff --git a/CbmRoot_test.cmake b/CbmRoot_test.cmake
index 5eb374c6a0..77819779a2 100644
--- a/CbmRoot_test.cmake
+++ b/CbmRoot_test.cmake
@@ -85,7 +85,11 @@ EndIf()
 
 Ctest_Start($ENV{ctest_model})
 
+unset(repeat)
 If($ENV{ctest_model} MATCHES Continuous)
+  if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
+    set(repeat REPEAT UNTIL_PASS:2)
+  endif()
   set(ENV{ctest_model} Nightly)
 EndIf()
 
@@ -111,6 +115,7 @@ If(NOT _RETVAL)
 
   Ctest_Test(BUILD "${CTEST_BINARY_DIRECTORY}"
              PARALLEL_LEVEL $ENV{number_of_processors}
+             ${repeat}
              RETURN_VALUE _ctest_test_ret_val
             )
 
-- 
GitLab