[cig-commits] [commit] master: optional perl script to postprocess a screen-output file (2bfca6a)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Mon Sep 1 10:47:56 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/30ebdbf18265d5d129d98b6ca5f079916558687c...81c3920f5c4322ef3814b587ff70b740a78e87b2
>---------------------------------------------------------------
commit 2bfca6a2e364439aa631642ddce8886b3ea718aa
Author: Timo Heister <timo.heister at gmail.com>
Date: Fri Aug 29 12:00:02 2014 -0400
optional perl script to postprocess a screen-output file
>---------------------------------------------------------------
2bfca6a2e364439aa631642ddce8886b3ea718aa
tests/CMakeLists.txt | 15 +++++++++++----
tests/default.sh | 2 ++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 17cfe4c..8098637 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -167,6 +167,15 @@ FOREACH(_test ${_tests})
# the actual run command is a bit complicated because we have to figure out
# whether we want the test to run in parallel using MPI or not
GET_MPI_COUNT(${CMAKE_CURRENT_SOURCE_DIR}/${_test}.prm)
+
+ # detect the optional script <testname>.sh that a test can use to process
+ # output (currently screen-output only).
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_test}.sh)
+ SET(_replacement_script "${CMAKE_CURRENT_SOURCE_DIR}/${_test}.sh")
+ ELSE()
+ SET(_replacement_script "${CMAKE_CURRENT_SOURCE_DIR}/default.sh")
+ ENDIF()
+
IF("${_mpi_count}" STREQUAL "1")
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output
COMMAND
@@ -177,8 +186,7 @@ FOREACH(_test ${_tests})
done
COMMAND aspect ${CMAKE_CURRENT_BINARY_DIR}/${_test}.x.prm
> ${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output.tmp
- COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output.tmp
- ${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output
+ COMMAND ${_replacement_script} screen-output <${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output.tmp >${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output
COMMAND ${PERL_EXECUTABLE} -pi
${CMAKE_CURRENT_SOURCE_DIR}/normalize.pl
${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/*
@@ -194,8 +202,7 @@ FOREACH(_test ${_tests})
done
COMMAND mpirun -np ${_mpi_count} ${CMAKE_CURRENT_BINARY_DIR}/../aspect ${CMAKE_CURRENT_BINARY_DIR}/${_test}.x.prm
> ${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output.tmp
- COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output.tmp
- ${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output
+ COMMAND ${_replacement_script} screen-output <${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output.tmp >${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/screen-output
COMMAND ${PERL_EXECUTABLE} -pi
${CMAKE_CURRENT_SOURCE_DIR}/normalize.pl
${CMAKE_CURRENT_BINARY_DIR}/output-${_test}/*
diff --git a/tests/default.sh b/tests/default.sh
new file mode 100755
index 0000000..53b1eae
--- /dev/null
+++ b/tests/default.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+cat
More information about the CIG-COMMITS
mailing list