testHarness: adding the environment variable CDASH_SCM_INFO in order to override
the SCM information that gets appended at the end of the buildname string. The buildname string is the string that will identify your test run when published on the foam-extend CDash service. When using git, this SCM information is picked up automatically from the CTest script: -git-branch=the_git_branch_name-git-rev=the_git_revision_number. But when using a non-git SCM (mercurial, etc), when the foam-extend source code you are testing is not under a valid git repository, or simply when a user needs to add more details to the standard SCM information (branch name and revision number), then setting the environment variable CDASH_SCM_INFO to the proper information will allow you to override the suffix we add at the end of the buildname. Please note that in order to keep the CMake script simple, for non-git repositories, the fallback solution to try grabbing the information through Mercurial has been removed. Please use the CDASH_SCM_INFO environment varible instead.
This commit is contained in:
parent
a04e8e4c27
commit
6cebda5e41
5 changed files with 143 additions and 60 deletions
|
@ -67,7 +67,7 @@ SET(
|
|||
|
||||
#Grab the FOAM installation directory.
|
||||
SET(
|
||||
OF_ROOT $ENV{WM_PROJECT_DIR}
|
||||
FOAM_ROOT $ENV{WM_PROJECT_DIR}
|
||||
CACHE INTERNAL "FOAM root directory."
|
||||
)
|
||||
|
||||
|
@ -79,6 +79,22 @@ SET(
|
|||
CACHE STRING "Build ID"
|
||||
)
|
||||
|
||||
# We allow overriding the git branch and revision information with some
|
||||
# user-supplied information using the CDASH_SCM_INFO environment variable.
|
||||
#
|
||||
# Mercurial or other SCM users should be using this environment variable
|
||||
# in order to provide branch and revision information for the buildname.
|
||||
#
|
||||
# Git users should use this environment variable in order to provide
|
||||
# additionnal information instead of just the branch and revision number.
|
||||
#
|
||||
# Otherwise, the buildname will be appended with the following information:
|
||||
# -git-branch=the_git_branch_name-git-rev=the_git_revision_number
|
||||
SET(
|
||||
BUILDNAME_SCM_INFO $ENV{CDASH_SCM_INFO}
|
||||
CACHE STRING "SCM info for CDash buildname"
|
||||
)
|
||||
|
||||
# Find out the version of the compiler being used.
|
||||
# Add this information to the buildname
|
||||
# This is for gcc or icc because they both support the -dumpversion option
|
||||
|
@ -115,48 +131,63 @@ set (UPDATE_TYPE git)
|
|||
# Using GIT as SCM
|
||||
#
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
message("Git was found: ${GIT_EXECUTABLE}")
|
||||
|
||||
# Adding the name of the git branch to the build name
|
||||
EXEC_PROGRAM(git
|
||||
ARGS branch --no-color 2> /dev/null | grep '*'| awk '{print $2}'
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
)
|
||||
message("Git branch: ${GIT_BRANCH_NAME}")
|
||||
if(NOT BUILDNAME_SCM_INFO STREQUAL "")
|
||||
SET(BUILDNAME "${BUILDNAME}-${BUILDNAME_SCM_INFO}")
|
||||
|
||||
# We also add the git rev number to the build name
|
||||
EXEC_PROGRAM(git
|
||||
ARGS rev-parse --short=12 HEAD
|
||||
OUTPUT_VARIABLE GIT_REV_NUMBER
|
||||
elseif(GIT_FOUND)
|
||||
message("The git command was found: ${GIT_EXECUTABLE}")
|
||||
|
||||
# Check if the source code is under a valid git repository
|
||||
execute_process(
|
||||
COMMAND git status
|
||||
WORKING_DIRECTORY ${FOAM_ROOT}
|
||||
OUTPUT_VARIABLE GIT_STATUS
|
||||
RESULT_VARIABLE GIT_ECODE
|
||||
ERROR_QUIET
|
||||
)
|
||||
message("Git rev: ${GIT_REV_NUMBER}")
|
||||
if (GIT_BRANCH_NAME STREQUAL "")
|
||||
message("No git-branch. Mercurial?")
|
||||
EXEC_PROGRAM(hg
|
||||
ARGS id
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
)
|
||||
string(REPLACE " " "_" GIT_BRANCH_NAME ${GIT_BRANCH_NAME})
|
||||
string(REPLACE "+" "_modified" GIT_BRANCH_NAME ${GIT_BRANCH_NAME})
|
||||
SET(GIT_BRANCH_NAME "hg_${GIT_BRANCH_NAME}")
|
||||
message("Git branch (mercurial): ${GIT_BRANCH_NAME}")
|
||||
endif()
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
||||
|
||||
if(NOT GIT_ECODE)
|
||||
# We have a valid git repository. Grab the branch and revision info.
|
||||
# Add to the build name
|
||||
exec_program(git
|
||||
ARGS branch --no-color 2> /dev/null | grep '*'| awk '{print $2}'
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
)
|
||||
message("Git branch: ${GIT_BRANCH_NAME}")
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse --short=12 HEAD
|
||||
OUTPUT_VARIABLE GIT_REV_NUMBER
|
||||
)
|
||||
message("Git revision: ${GIT_REV_NUMBER}")
|
||||
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
||||
else()
|
||||
# Not a git repository: no branch nor revision information available
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
||||
endif()
|
||||
else()
|
||||
# Git is not available: no branch nor revision information supplied
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
||||
endif()
|
||||
|
||||
# Some last minute cleanup
|
||||
# Seems like no '/' are allowed in the BUILDNAME or in the SITE name
|
||||
# Seems like no '/' or ' 'are allowed in the BUILDNAME or in the SITE name
|
||||
string(REPLACE "/" "_" BUILDNAME ${BUILDNAME})
|
||||
string(REPLACE " " "_" BUILDNAME ${BUILDNAME})
|
||||
string(REPLACE "/" "_" SITE ${SITE})
|
||||
string(REPLACE " " "_" SITE ${SITE})
|
||||
|
||||
# Build section
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Compile FOAM, libs and apps
|
||||
add_custom_target (foam-extend-$ENV{WM_PROJECT_VERSION} ALL
|
||||
${OF_ROOT}/Allwmake
|
||||
${FOAM_ROOT}/Allwmake
|
||||
)
|
||||
|
||||
set_property(
|
||||
|
@ -168,7 +199,7 @@ set_property(
|
|||
# This part will not be compiled and run by default.
|
||||
# This would be a good candidate for a sub-project
|
||||
add_custom_target (foam-extend-$ENV{WM_PROJECT_VERSION}_unitTests
|
||||
wmake all ${OF_ROOT}/applications/test
|
||||
wmake all ${FOAM_ROOT}/applications/test
|
||||
)
|
||||
|
||||
# Test section
|
||||
|
|
|
@ -170,6 +170,13 @@
|
|||
# You can override your identifier using this environment variable
|
||||
#setenv CDASH_SUBMIT_LOCAL_HOST_ID choose_your_CDash_system_identifer
|
||||
|
||||
# Buildname suffix for the FOAM CDash test harness on foam-extend
|
||||
# By default, the git branch name and git revision number will be
|
||||
# appended to the CDash build name.
|
||||
# Otherwise, for users not using git, or wanting to provide additionnal
|
||||
# information, simply initialize the CDASH_SCM_INFO with the proper information
|
||||
#setenv CDASH_SCM_INFO your_SCM_information
|
||||
|
||||
# Mac OS X MacPorts root directory.
|
||||
# The default value is '/opt/local/etc/macports'.
|
||||
# In order to disable the usage of MacPorts on Mac OSX, simply initialize this
|
||||
|
|
|
@ -180,6 +180,13 @@ export FOAM_VERBOSE=1
|
|||
# You can override your identifier using this environment variable
|
||||
#export CDASH_SUBMIT_LOCAL_HOST_ID=choose_your_CDash_system_identifer
|
||||
|
||||
# Buildname suffix for the FOAM CDash test harness on foam-extend
|
||||
# By default, the git branch name and git revision number will be
|
||||
# appended to the CDash build name.
|
||||
# Otherwise, for users not using git, or wanting to provide additionnal
|
||||
# information, simply initialize the CDASH_SCM_INFO with the proper information
|
||||
#export CDASH_SCM_INFO=your_SCM_information
|
||||
|
||||
# Mac OS X MacPorts root directory.
|
||||
# The default value is '/opt/local/etc/macports'.
|
||||
# In order to disable the usage of MacPorts on Mac OSX, simply initialize this
|
||||
|
|
|
@ -178,6 +178,13 @@ export PARAVIEW_BIN_DIR=$PARAVIEW_DIR/bin
|
|||
# You can override your identifier using this environment variable
|
||||
#export CDASH_SUBMIT_LOCAL_HOST_ID=choose_your_CDash_system_identifer
|
||||
|
||||
# Buildname suffix for the FOAM CDash test harness on foam-extend
|
||||
# By default, the git branch name and git revision number will be
|
||||
# appended to the CDash build name.
|
||||
# Otherwise, for users not using git, or wanting to provide additionnal
|
||||
# information, simply initialize the CDASH_SCM_INFO with the proper information
|
||||
#export CDASH_SCM_INFO=your_SCM_information
|
||||
|
||||
# Mac OS X MacPorts root directory.
|
||||
# The default value is '/opt/local/etc/macports'.
|
||||
# In order to disable the usage of MacPorts on Mac OSX, simply initialize this
|
||||
|
|
|
@ -67,7 +67,7 @@ SET(
|
|||
|
||||
#Grab the FOAM installation directory.
|
||||
SET(
|
||||
OF_ROOT $ENV{WM_PROJECT_DIR}
|
||||
FOAM_ROOT $ENV{WM_PROJECT_DIR}
|
||||
CACHE INTERNAL "FOAM root directory."
|
||||
)
|
||||
|
||||
|
@ -79,6 +79,22 @@ SET(
|
|||
CACHE STRING "Build ID"
|
||||
)
|
||||
|
||||
# We allow overriding the git branch and revision information with some
|
||||
# user-supplied information using the CDASH_SCM_INFO environment variable.
|
||||
#
|
||||
# Mercurial or other SCM users should be using this environment variable
|
||||
# in order to provide branch and revision information for the buildname.
|
||||
#
|
||||
# Git users should use this environment variable in order to provide
|
||||
# additionnal information instead of just the branch and revision number.
|
||||
#
|
||||
# Otherwise, the buildname will be appended with the following information:
|
||||
# -git-branch=the_git_branch_name-git-rev=the_git_revision_number
|
||||
SET(
|
||||
BUILDNAME_SCM_INFO $ENV{CDASH_SCM_INFO}
|
||||
CACHE STRING "SCM info for CDash buildname"
|
||||
)
|
||||
|
||||
# Find out the version of the compiler being used.
|
||||
# Add this information to the buildname
|
||||
# This is for gcc or icc because they both support the -dumpversion option
|
||||
|
@ -115,48 +131,63 @@ set (UPDATE_TYPE git)
|
|||
# Using GIT as SCM
|
||||
#
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
message("Git was found: ${GIT_EXECUTABLE}")
|
||||
|
||||
# Adding the name of the git branch to the build name
|
||||
EXEC_PROGRAM(git
|
||||
ARGS branch --no-color 2> /dev/null | grep '*'| awk '{print $2}'
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
)
|
||||
message("Git branch: ${GIT_BRANCH_NAME}")
|
||||
if(NOT BUILDNAME_SCM_INFO STREQUAL "")
|
||||
SET(BUILDNAME "${BUILDNAME}-${BUILDNAME_SCM_INFO}")
|
||||
|
||||
# We also add the git rev number to the build name
|
||||
EXEC_PROGRAM(git
|
||||
ARGS rev-parse --short=12 HEAD
|
||||
OUTPUT_VARIABLE GIT_REV_NUMBER
|
||||
elseif(GIT_FOUND)
|
||||
message("The git command was found: ${GIT_EXECUTABLE}")
|
||||
|
||||
# Check if the source code is under a valid git repository
|
||||
execute_process(
|
||||
COMMAND git status
|
||||
WORKING_DIRECTORY ${FOAM_ROOT}
|
||||
OUTPUT_VARIABLE GIT_STATUS
|
||||
RESULT_VARIABLE GIT_ECODE
|
||||
ERROR_QUIET
|
||||
)
|
||||
message("Git rev: ${GIT_REV_NUMBER}")
|
||||
if (GIT_BRANCH_NAME STREQUAL "")
|
||||
message("No git-branch. Mercurial?")
|
||||
EXEC_PROGRAM(hg
|
||||
ARGS id
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
)
|
||||
string(REPLACE " " "_" GIT_BRANCH_NAME ${GIT_BRANCH_NAME})
|
||||
string(REPLACE "+" "_modified" GIT_BRANCH_NAME ${GIT_BRANCH_NAME})
|
||||
SET(GIT_BRANCH_NAME "hg_${GIT_BRANCH_NAME}")
|
||||
message("Git branch (mercurial): ${GIT_BRANCH_NAME}")
|
||||
endif()
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
||||
|
||||
if(NOT GIT_ECODE)
|
||||
# We have a valid git repository. Grab the branch and revision info.
|
||||
# Add to the build name
|
||||
exec_program(git
|
||||
ARGS branch --no-color 2> /dev/null | grep '*'| awk '{print $2}'
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
)
|
||||
message("Git branch: ${GIT_BRANCH_NAME}")
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse --short=12 HEAD
|
||||
OUTPUT_VARIABLE GIT_REV_NUMBER
|
||||
)
|
||||
message("Git revision: ${GIT_REV_NUMBER}")
|
||||
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
||||
else()
|
||||
# Not a git repository: no branch nor revision information available
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
||||
endif()
|
||||
else()
|
||||
# Git is not available: no branch nor revision information supplied
|
||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
||||
endif()
|
||||
|
||||
# Some last minute cleanup
|
||||
# Seems like no '/' are allowed in the BUILDNAME or in the SITE name
|
||||
# Seems like no '/' or ' 'are allowed in the BUILDNAME or in the SITE name
|
||||
string(REPLACE "/" "_" BUILDNAME ${BUILDNAME})
|
||||
string(REPLACE " " "_" BUILDNAME ${BUILDNAME})
|
||||
string(REPLACE "/" "_" SITE ${SITE})
|
||||
string(REPLACE " " "_" SITE ${SITE})
|
||||
|
||||
# Build section
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Compile FOAM, libs and apps
|
||||
add_custom_target (foam-extend-$ENV{WM_PROJECT_VERSION} ALL
|
||||
${OF_ROOT}/Allwmake
|
||||
${FOAM_ROOT}/Allwmake
|
||||
)
|
||||
|
||||
set_property(
|
||||
|
@ -168,7 +199,7 @@ set_property(
|
|||
# This part will not be compiled and run by default.
|
||||
# This would be a good candidate for a sub-project
|
||||
add_custom_target (foam-extend-$ENV{WM_PROJECT_VERSION}_unitTests
|
||||
wmake all ${OF_ROOT}/applications/test
|
||||
wmake all ${FOAM_ROOT}/applications/test
|
||||
)
|
||||
|
||||
# Test section
|
||||
|
|
Reference in a new issue