testHarness: adjusting the ctest command invocation for scripts

under Windows/Mingw
This commit is contained in:
Martin Beaudoin 2015-09-16 09:27:34 -04:00 committed by Hrvoje Jasak
parent 7d10a1bbff
commit 0a48ccb4d2
3 changed files with 40 additions and 9 deletions

View file

@ -379,10 +379,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}")
EXECUTE_PROCESS( if(CMAKE_HOST_WIN32)
# Need to supply a bash shell to run the script under Windows
EXECUTE_PROCESS(
COMMAND bash -c "$ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR}"
WORKING_DIRECTORY .
)
else()
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(RUN_FROM_ONE_TIMESTEP) ENDIF(RUN_FROM_ONE_TIMESTEP)
ENDIF(BUILD_TESTING) ENDIF(BUILD_TESTING)

View file

@ -379,10 +379,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}")
EXECUTE_PROCESS( if(CMAKE_HOST_WIN32)
# Need to supply a bash shell to run the script under Windows
EXECUTE_PROCESS(
COMMAND bash -c "$ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR}"
WORKING_DIRECTORY .
)
else()
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(RUN_FROM_ONE_TIMESTEP) ENDIF(RUN_FROM_ONE_TIMESTEP)
ENDIF(BUILD_TESTING) ENDIF(BUILD_TESTING)

View file

@ -53,11 +53,18 @@ file(COPY $ENV{FOAM_TUTORIALS}/ DESTINATION ${TEST_CASE_DIR})
# The test harness relies on the presence of an Allrun file for # The test harness relies on the presence of an Allrun file for
# running the case # running the case
MESSAGE("${testRunTimeDirectory}: Checking for missing Allrun file in tutorials") MESSAGE("${testRunTimeDirectory}: Checking for missing Allrun file in tutorials")
EXECUTE_PROCESS( if(CMAKE_HOST_WIN32)
# Need to supply a bash shell to run the script under Windows
EXECUTE_PROCESS(
COMMAND bash -c "$ENV{FOAM_TEST_HARNESS_DIR}/scripts/addMissingAllrunFileToTutorial.sh ${TEST_CASE_DIR} $ENV{FOAM_TEST_HARNESS_DIR}/scripts/Allrun.default"
WORKING_DIRECTORY .
)
else()
EXECUTE_PROCESS(
COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/addMissingAllrunFileToTutorial.sh ${TEST_CASE_DIR} $ENV{FOAM_TEST_HARNESS_DIR}/scripts/Allrun.default COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/addMissingAllrunFileToTutorial.sh ${TEST_CASE_DIR} $ENV{FOAM_TEST_HARNESS_DIR}/scripts/Allrun.default
WORKING_DIRECTORY . WORKING_DIRECTORY .
) )
endif()
# Iterate over each tutorial case: # Iterate over each tutorial case:
# We are looking for tutorial cases with an Allrun file. # We are looking for tutorial cases with an Allrun file.
# If this file is present, (and it should), we add this case to the list of cases to run. # If this file is present, (and it should), we add this case to the list of cases to run.
@ -100,10 +107,10 @@ FOREACH(caseWithAllrun ${listofCasesWithAllrun})
MESSAGE(" Adding test: ${testId}") MESSAGE(" Adding test: ${testId}")
ADD_TEST(${testId} bash -c "cd ${thisCasePath}; ./Allrun") ADD_TEST(${testId} bash -c "cd ${thisCasePath}; ./Allrun")
# We extract a label name from the top level tutorial directories # We extract a label name from the top level tutorial directories
# (eg: basic, incompressible, immersedBoundary, etc). We will use this # (eg: basic, incompressible, immersedBoundary, etc). We will use this
# label in order to categorize the various test cases under a more 'generic # label in order to categorize the various test cases under a more 'generic
# topic', so we can for instance limit the testharness to the # topic', so we can for instance limit the testharness to the
# 'incompressible' test cases, etc., simply by using the ctest -L command. # 'incompressible' test cases, etc., simply by using the ctest -L command.
# #
# ctest --print-labels will print the list of all available labels. # ctest --print-labels will print the list of all available labels.
@ -125,10 +132,18 @@ ENDFOREACH(caseWithAllrun)
# Modify the cases Allrun files to incorporate additional shell functions # Modify the cases Allrun files to incorporate additional shell functions
MESSAGE("${testRunTimeDirectory}: Modifying the Allrun files for additional shell functions in directory: ${TEST_CASE_DIR}") MESSAGE("${testRunTimeDirectory}: Modifying the Allrun files for additional shell functions in directory: ${TEST_CASE_DIR}")
EXECUTE_PROCESS( if(CMAKE_HOST_WIN32)
# Need to supply a bash shell to run the script under Windows
EXECUTE_PROCESS(
COMMAND bash -c "$ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForTestHarness.sh ${TEST_CASE_DIR} $ENV{FOAM_TEST_HARNESS_DIR}/scripts/AdditionalRunFunctions"
WORKING_DIRECTORY .
)
else()
EXECUTE_PROCESS(
COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForTestHarness.sh ${TEST_CASE_DIR} $ENV{FOAM_TEST_HARNESS_DIR}/scripts/AdditionalRunFunctions COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForTestHarness.sh ${TEST_CASE_DIR} $ENV{FOAM_TEST_HARNESS_DIR}/scripts/AdditionalRunFunctions
WORKING_DIRECTORY . WORKING_DIRECTORY .
) )
endif()
# Configure the various ctest -S Dashboard drivers # Configure the various ctest -S Dashboard drivers
@ -137,6 +152,6 @@ configure_file(
"$ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/Dashboard_Tutorials.cmake.in" "$ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/Dashboard_Tutorials.cmake.in"
"$ENV{FOAM_TEST_HARNESS_DIR}/runDir/Dashboard_Tutorials.cmake" "$ENV{FOAM_TEST_HARNESS_DIR}/runDir/Dashboard_Tutorials.cmake"
@ONLY) @ONLY)
# That's it. # That's it.