From: Matthias Maier Date: Sun, 8 Jan 2017 16:51:12 +0000 (-0600) Subject: Bugfix: Fix up previous attempt to quote correctly X-Git-Tag: v8.5.0-rc1~282^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d78742ba305a752a7e06d69532a3ea227a1b583;p=dealii.git Bugfix: Fix up previous attempt to quote correctly In reference to #3742 --- diff --git a/cmake/macros/macro_deal_ii_add_test.cmake b/cmake/macros/macro_deal_ii_add_test.cmake index 649da9158e..b03422e64b 100644 --- a/cmake/macros/macro_deal_ii_add_test.cmake +++ b/cmake/macros/macro_deal_ii_add_test.cmake @@ -169,7 +169,7 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file) IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.cc") SET(_target ${_test_name}.${_build_lowercase}) # target name - SET(_run_command "$") # the command to issue + SET(_run_args "$") # the command to issue ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.prm") @@ -184,7 +184,10 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file) "\" is defined.\n\n" ) ENDIF() - SET(_run_command "$ ${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.prm") + SET(_run_args + "$" + "${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.prm" + ) ELSE() MESSAGE(FATAL_ERROR @@ -210,7 +213,13 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file) SET(_diff_target ${_test_name}.mpirun${_n_cpu}.${_build_lowercase}.diff) # diff target name SET(_test_full ${_category}/${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}) # full test name SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_name}.${_build_lowercase}/mpirun=${_n_cpu}) # directory to run the test in - SET(_run_command "${DEAL_II_MPIEXEC} ${DEAL_II_MPIEXEC_NUMPROC_FLAG} ${_n_cpu} ${DEAL_II_MPIEXEC_PREFLAGS} ${_run_command} ${DEAL_II_MPIEXEC_POSTFLAGS}") + SET(_run_args + "${DEAL_II_MPIEXEC}" + ${DEAL_II_MPIEXEC_NUMPROC_FLAG} ${_n_cpu} + ${DEAL_II_MPIEXEC_PREFLAGS} + ${_run_args} + "${DEAL_II_MPIEXEC_POSTFLAGS}" + ) ENDIF() FILE(MAKE_DIRECTORY ${_test_directory}) @@ -257,8 +266,8 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file) ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/output COMMAND sh ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.sh - run "${_test_full}" "${_run_command}" "${_test_diff}" - "${DIFF_EXECUTABLE}" "${_comparison_file}" + run "${_test_full}" "${_test_diff}" + "${DIFF_EXECUTABLE}" "${_comparison_file}" ${_run_args} COMMAND ${PERL_EXECUTABLE} -pi ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/normalize.pl ${_test_directory}/output @@ -274,8 +283,8 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file) ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff COMMAND sh ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.sh - diff "${_test_full}" "${_run_command}" "${_test_diff}" - "${DIFF_EXECUTABLE}" "${_comparison_file}" + diff "${_test_full}" "${_test_diff}" + "${DIFF_EXECUTABLE}" "${_comparison_file}" ${_run_args} WORKING_DIRECTORY ${_test_directory} DEPENDS diff --git a/cmake/scripts/run_test.sh b/cmake/scripts/run_test.sh index 23fbc35858..72a39a7a81 100644 --- a/cmake/scripts/run_test.sh +++ b/cmake/scripts/run_test.sh @@ -27,10 +27,11 @@ set -u STAGE="$1" TEST_FULL="$2" -RUN_COMMAND="$3" -NUMDIFF_EXECUTABLE="$4" -DIFF_EXECUTABLE="$5" -COMPARISON_FILE="$6" +NUMDIFF_EXECUTABLE="$3" +DIFF_EXECUTABLE="$4" +COMPARISON_FILE="$5" +shift 5 +RUN_COMMAND=( "$@" ) # Ensure uniform sorting for pathname expansion export LC_ALL=C @@ -44,7 +45,7 @@ run(){ rm -f output rm -f stdout - "${RUN_COMMAND}" > stdout 2>&1 + "${RUN_COMMAND[@]}" > stdout 2>&1 RETURN_VALUE=$? [ -f output ] || mv stdout output