]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Fix up previous attempt to quote correctly
authorMatthias Maier <tamiko@43-1.org>
Sun, 8 Jan 2017 16:51:12 +0000 (10:51 -0600)
committerMatthias Maier <tamiko@43-1.org>
Sun, 8 Jan 2017 22:52:07 +0000 (16:52 -0600)
In reference to #3742

cmake/macros/macro_deal_ii_add_test.cmake
cmake/scripts/run_test.sh

index 649da9158e8fc51025d64fcd07b84c5cf03ce39c..b03422e64b46f26c80d8e233aee5827162ea157a 100644 (file)
@@ -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 "$<TARGET_FILE:${_target}>") # the command to issue
+        SET(_run_args "$<TARGET_FILE:${_target}>") # 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 "$<TARGET_FILE:${_target}> ${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.prm")
+        SET(_run_args
+          "$<TARGET_FILE:${_target}>"
+          "${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
index 23fbc358584c3e79f635e3a52adc2b6b8f49e232..72a39a7a81e9273b25ed41f7761f0281d5caec81 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.