Correction for a problem with newer versions of CMake that are refusing to upload the test harness

results  to the CDash server.
The generated error message is the following: "Error message was: Illegal characters found in URL"

Diagnostic:
    If the environment variable CDASH_SUBMIT_LOCAL_HOST_ID is not initialized, the FQN hostname of the
system will be picked by the CMake/CTest scripts. The CTest internal system command used for retrieving
the FQN hostname is indeed leaving a carriage return in the returned hostname string.
That string is in turn reused to construct an URL that will be shared with the CDash service. The presence
of such characters (\n and \r) is no longer accepted by newer versions of CTest/CMake.

Solution:
    The solution is simply to check and remove such characters from the hostname string.
This commit is contained in:
Martin Beaudoin 2018-04-15 21:51:43 -04:00
parent afef1bac2f
commit 2adbd0457a
3 changed files with 32 additions and 22 deletions

View file

@ -1,7 +1,7 @@
# /*-------------------------------------------------------------------------*\ # /*-------------------------------------------------------------------------*\
# ========= | # ========= |
# \\ / F ield | foam-extend: Open Source CFD # \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 4.0 # \\ / O peration | Version: 4.1
# \\ / A nd | Web: http://www.foam-extend.org # \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright # \\/ M anipulation | For copyright notice see file Copyright
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -23,7 +23,7 @@
# #
# Description # Description
# CMakeLists.txt file for implementing a test harness for the compilation # CMakeLists.txt file for implementing a test harness for the compilation
# and test of foam-extend-3.2 using Kitware CTest/CMake/CDash # and test of foam-extend-4.1 using Kitware CTest/CMake/CDash
# #
# The results will be submitted to the CDash server identified by the file # The results will be submitted to the CDash server identified by the file
# CTestConfig.cmake # CTestConfig.cmake
@ -36,7 +36,7 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8)
PROJECT(foam-extend-4.0) PROJECT(foam-extend-4.1)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Utility functions # Utility functions
@ -59,6 +59,11 @@ function(GetHostName var)
OUTPUT_VARIABLE thisHostname OUTPUT_VARIABLE thisHostname
) )
endif() endif()
# Cleanup possible presence of \n or \r characters
string(REPLACE "\n" "" thisHostname ${thisHostname})
string(REPLACE "\r" "" thisHostname ${thisHostname})
set(${var} ${thisHostname} PARENT_SCOPE) set(${var} ${thisHostname} PARENT_SCOPE)
endfunction() endfunction()

View file

@ -1,7 +1,7 @@
# /*-------------------------------------------------------------------------*\ # /*-------------------------------------------------------------------------*\
# ========= | # ========= |
# \\ / F ield | foam-extend: Open Source CFD # \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 4.0 # \\ / O peration | Version: 4.1
# \\ / A nd | Web: http://www.foam-extend.org # \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright # \\/ M anipulation | For copyright notice see file Copyright
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -23,7 +23,7 @@
# #
# Description # Description
# CMakeLists.txt file for implementing a test harness for the compilation # CMakeLists.txt file for implementing a test harness for the compilation
# and test of foam-extend-4.0 using Kitware CTest/CMake/CDash # and test of foam-extend-4.1 using Kitware CTest/CMake/CDash
# #
# The results will be submitted to the CDash server identified by the file # The results will be submitted to the CDash server identified by the file
# CTestConfig.cmake # CTestConfig.cmake
@ -36,7 +36,7 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8)
PROJECT(foam-extend-4.0) PROJECT(foam-extend-4.1)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Utility functions # Utility functions
@ -59,6 +59,11 @@ function(GetHostName var)
OUTPUT_VARIABLE thisHostname OUTPUT_VARIABLE thisHostname
) )
endif() endif()
# Cleanup possible presence of \n or \r characters
string(REPLACE "\n" "" thisHostname ${thisHostname})
string(REPLACE "\r" "" thisHostname ${thisHostname})
set(${var} ${thisHostname} PARENT_SCOPE) set(${var} ${thisHostname} PARENT_SCOPE)
endfunction() endfunction()
@ -104,9 +109,9 @@ function(GetGitBranchName var)
foreach(branch ${listOfGitBranches}) foreach(branch ${listOfGitBranches})
string(REGEX MATCH "\\* .*$" matchString ${branch}) string(REGEX MATCH "\\* .*$" matchString ${branch})
string(LENGTH "${matchString}" lengthMatchString) string(LENGTH "${matchString}" lengthMatchString)
if(lengthMatchString GREATER 0) if(lengthMatchString GREATER 0)
# We have match. Cleanup and set retValue # We have match. Cleanup and set retValue
string(REPLACE "* " "" retValue ${matchString}) string(REPLACE "* " "" retValue ${matchString})
endif() endif()
endforeach() endforeach()
@ -122,7 +127,7 @@ function(GetGitRevNumber var)
set( retValue "unknown") set( retValue "unknown")
execute_process( execute_process(
COMMAND git rev-parse --short=12 HEAD COMMAND git rev-parse --short=12 HEAD
WORKING_DIRECTORY ${FOAM_ROOT} WORKING_DIRECTORY ${FOAM_ROOT}
OUTPUT_VARIABLE git_rev_number OUTPUT_VARIABLE git_rev_number
) )
@ -259,11 +264,11 @@ elseif(GIT_FOUND)
if(NOT GIT_ECODE) if(NOT GIT_ECODE)
# We have a valid git repository. # We have a valid git repository.
# Grab the branch and revision info. Add to the build name # Grab the branch and revision info. Add to the build name
GetGitBranchName(GIT_BRANCH_NAME) GetGitBranchName(GIT_BRANCH_NAME)
message("Git branch: ${GIT_BRANCH_NAME}") message("Git branch: ${GIT_BRANCH_NAME}")
GetGitRevNumber(GIT_REV_NUMBER) GetGitRevNumber(GIT_REV_NUMBER)
message("Git revision: ${GIT_REV_NUMBER}") message("Git revision: ${GIT_REV_NUMBER}")
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}") SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
@ -301,8 +306,8 @@ elseif(GIT_FOUND)
SET(BUILDNAME "${BUILDNAME}-hg-rev=${GIT_REV_NUMBER}") SET(BUILDNAME "${BUILDNAME}-hg-rev=${GIT_REV_NUMBER}")
else() else()
# Not a git or mercurial repository: no branch nor revision information available # Not a git or mercurial repository: no branch nor revision information available
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown") SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown") SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
endif() endif()
endif() endif()
else() else()
@ -379,18 +384,18 @@ IF(BUILD_TESTING)
IF(RUN_FROM_ONE_TIMESTEP) IF(RUN_FROM_ONE_TIMESTEP)
# Modify the cases controlDict file in order to run for only one time step # Modify the cases controlDict file in order to run for only one time step
MESSAGE("${testRunTimeDirectory}: Modifying the controlDict files for running only one time step in directory: ${TEST_CASE_DIR}") MESSAGE("${testRunTimeDirectory}: Modifying the controlDict files for running only one time step in directory: ${TEST_CASE_DIR}")
if(CMAKE_HOST_WIN32) if(CMAKE_HOST_WIN32)
# Need to supply a bash shell to run the script under Windows # Need to supply a bash shell to run the script under Windows
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND bash -c "$ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR}" COMMAND bash -c "$ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR}"
WORKING_DIRECTORY . WORKING_DIRECTORY .
) )
else() else()
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR} COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR}
WORKING_DIRECTORY . WORKING_DIRECTORY .
) )
endif() endif()
ENDIF(RUN_FROM_ONE_TIMESTEP) ENDIF(RUN_FROM_ONE_TIMESTEP)
ENDIF(BUILD_TESTING) ENDIF(BUILD_TESTING)

View file

@ -10,12 +10,12 @@
# on the foam-extend CDash service hosted on SourceForge.Net # on the foam-extend CDash service hosted on SourceForge.Net
# See here: http://foam-extend.sourceforge.net/CDash/index.php # See here: http://foam-extend.sourceforge.net/CDash/index.php
# #
set(CTEST_PROJECT_NAME "foam-extend-4.0") set(CTEST_PROJECT_NAME "foam-extend-4.1")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_DROP_METHOD "http") set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "foam-extend.sourceforge.net") set(CTEST_DROP_SITE "foam-extend.sourceforge.net")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=foam-extend-4.0") set(CTEST_DROP_LOCATION "/CDash/submit.php?project=foam-extend-4.1")
set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_DROP_SITE_CDASH TRUE)
# We can override those variables for local sites so you can use # We can override those variables for local sites so you can use