Commit 4228c80d authored by Emmanuel Promayon's avatar Emmanuel Promayon

UPDATED Using specific cmake script to rerun test

parent 52df9556
......@@ -63,7 +63,9 @@ fi
QT_VERSION=$(qmake --version | grep Qt | cut -f4 -d" " )
# output all information to report file
echo "Docker container id....... $CONTAINER_ID" > /tmp/report.txt
TIME_STAMP=$(date --rfc-2822)
echo "Time stamp................ $TIME_STAMP" > /tmp/report.txt
echo "Docker container id....... $CONTAINER_ID" >> /tmp/report.txt
echo "Job....................... $CI_JOB_NAME" >> /tmp/report.txt
echo "PROJECT_SOURCE_DIR........ $PROJECT_SOURCE_DIR" >> /tmp/report.txt
echo "CI_PROJECT_DIR............ $CI_PROJECT_DIR" >> /tmp/report.txt
......
......@@ -62,7 +62,7 @@ ctest --extra-verbose \
# -DCTEST_SOURCE_DIRECTORY="$PROJECT_SOURCE_DIR" \
# -DCTEST_BINARY_DIRECTORY="$PROJECT_BUILD_DIR" \
# -S $PROJECT_SOURCE_DIR/sdk/cmake/ctest/ci-test.cmake > >(tee --append ${PROJECT_LOG_DIR}/test.log | grep --line-buffered -e "Test \#") 2>&1
#
# if [[ "$OS" != "win7" ]]; then
# # shutdown xvfb
# kill $xvfbPid
......@@ -102,7 +102,8 @@ if grep --quiet "Fatal error" $CI_PROJECT_DIR/$PROJECT_LOG_DIR/ci-test.log; then
-DCI_PROJECT_LOG_DIRECTORY="$CI_PROJECT_DIR/$PROJECT_LOG_DIR" \
-DCTEST_SOURCE_DIRECTORY="$PROJECT_SOURCE_DIR" \
-DCTEST_BINARY_DIRECTORY="$PROJECT_BUILD_DIR" \
--tests-regex $testname > >(tee --append ${PROJECT_LOG_DIR}/rerun-test.log | grep --line-buffered -e "Test \#") 2>&1
-DRERUN_TESTNAME=$testname \
-S $PROJECT_SOURCE_DIR/sdk/cmake/ctest/ci-rerun.cmake > >(tee --append ${PROJECT_LOG_DIR}/rerun-test.log | grep --line-buffered -e "Test \#") 2>&1
done
if grep --quiet "\*\*\*Failed" $CI_PROJECT_DIR/$PROJECT_LOG_DIR/rerun-test.log; then
echo
......
# Driver instructions for the reran a failed test during continuous integration
#
# 1. Define parameters
# CAMITK_SITE="[Gitlab Runner] debian stable" # the name of the current machine
# CAMITK_CI_MODE="Experimental" # ctest mode (Nightly, Continuous, Experimental...)
# CAMITK_CI_BRANCH="branch-name" # git branch name (check directly with git if not defined)
# CAMITK_CI_ID="Pipeline #$CI_PIPELINE_ID Job #$CI_BUILD_ID" # unique id
# CAMITK_SOURCE_DIR=~/Dev/CamiTK/src/camitk # path to CamiTK code source directory
# CAMITK_BUILD_DIR=~/Dev/CamiTK/build/camitk-exp # path to the intended build directory
# CAMITK_BUILD_SETTINGS="GCC-64bits-Debug" # compiler-arch-buildtype string
#
# 2. run the command
# ctest -VV \
# -DCTEST_SITE="$CAMITK_SITE" \
# -DCI_MODE="$CAMITK_CI_MODE" \
# -DCI_ID="$CAMITK_CI_ID" \
# -DCI_BRANCH=$CAMITK_CI_BRANCH \
# -DCI_BUILD_SETTINGS="$COMPILER_CONFIG" \
# -DCTEST_SOURCE_DIRECTORY="$CAMITK_SOURCE_DIR" \
# -DCTEST_BINARY_DIRECTORY="$CAMITK_BUILD_DIR" \
# -S $CAMITK_SOURCE_DIR/sdk/cmake/ctest/ci-test.cmake > test.log 2>&1
#
# It will submit a new report in the "configure" section of the dashboard
# identified as $SITE and $COMPILER_CONFIG.
#
# What this script does ?
# 1. INFORMATION STEP
# Configure SITE and BUILD information to be correctly display on the dashboard
# Loads information from the CTestConfig.cmake file.
# 2. RUN TEST
# Re-Run test RERUN_TESTNAME
set(CI_STAGE "Test")
# ------------------------ STEP 1: information step ------------------------
include("${CTEST_SOURCE_DIRECTORY}/sdk/cmake/ctest/ci-setup.cmake")
# ------------------------ STEP 2: test ------------------------
message(STATUS "Step 2. Rerun only test '${RERUN_TESTNAME}'... Using ${NUMBER_OF_PROC} tests in parallel")
# set extra time for test to 30 min = 1800 s (default is 10 min = 600 s)
set(CTEST_TEST_TIMEOUT 1800)
# Update CDash configuration to the server
# The Project.xml file is automatically generated at configure time.
# If a new extension is added to CamiTK, CDash will automatically be updated according to it.
# To do this, send this file to the server
ctest_submit(FILES "${CTEST_BINARY_DIRECTORY}/Project.xml")
# run test
message(STATUS "- Running test ${RERUN_TESTNAME}...")
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}"
PARALLEL_LEVEL ${NUMBER_OF_PROC} # Run test in parallel
RETURN_VALUE TEST_RES
INCLUDE_LABEL ${RERUN_TESTNAME}
)
if (NOT TEST_RES EQUAL 0)
message(STATUS "- Error: Test ${RERUN_TESTNAME} failed with return value ${TEST_RES}")
else()
message(STATUS "- Test ${RERUN_TESTNAME} passed")
endif()
message(STATUS "- Submitting test ${RERUN_TESTNAME} results...")
ctest_submit(PARTS Test RETURN_VALUE TEST_RES)
if (NOT TEST_RES EQUAL 0)
message(STATUS "- Error: Submitting test ${RERUN_TESTNAME} results failed with return value ${TEST_RES}")
else()
message(STATUS "- Submitting test ${RERUN_TESTNAME} results passed")
endif()
message(STATUS "Test ${RERUN_TESTNAME} done")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment