From bdb1d426f5cf532ed68c3963bbb543a032d5ee3d Mon Sep 17 00:00:00 2001 From: Manuel Huber Date: Fri, 9 Aug 2024 23:30:40 +0200 Subject: [PATCH] tests: also test root output writing output files --- tests/output/CMakeLists.txt | 16 ++++++++-------- tests/output/run-test-root.sh | 13 +++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) create mode 100755 tests/output/run-test-root.sh diff --git a/tests/output/CMakeLists.txt b/tests/output/CMakeLists.txt index e9c7893..b94b452 100644 --- a/tests/output/CMakeLists.txt +++ b/tests/output/CMakeLists.txt @@ -1,6 +1,5 @@ -set(_visit_hdf5 "false") - # executable for converting remage output HDF5 with ntuples to LH5 tables +set(_visit_hdf5 "false") if(Geant4_hdf5_FOUND) add_executable(test-visit-hdf5 EXCLUDE_FROM_ALL test-visit-hdf5.cc) target_include_directories(test-visit-hdf5 PRIVATE ${HDF5_INCLUDE_DIRS}) @@ -15,7 +14,7 @@ endif() file( GLOB _aux RELATIVE ${PROJECT_SOURCE_DIR} - macros/*.mac macros/*.hdf5ls gdml/*.gdml gdml/*.xml run-test-hdf5.sh) + macros/*.mac macros/*.hdf5ls gdml/*.gdml gdml/*.xml run-test-*.sh) # copy them to the build area foreach(_file ${_aux}) @@ -25,14 +24,15 @@ endforeach() set(_macros ntuple-per-det.mac ntuple-flat.mac) foreach(_mac ${_macros}) - add_test(NAME output/${_mac} COMMAND ./run-test-hdf5.sh $ ${_visit_hdf5} - ${_mac}) + add_test(NAME output/hdf5-${_mac} COMMAND ./run-test-hdf5.sh $ + ${_visit_hdf5} ${_mac}) + add_test(NAME output/root-${_mac} COMMAND ./run-test-root.sh $ ${_mac}) endforeach() -list(TRANSFORM _macros PREPEND "output/") -set_tests_properties(${_macros} PROPERTIES LABELS extra DEPENDS output/build-test-visit-hdf5) +list(TRANSFORM _macros PREPEND "output/hdf5-" OUTPUT_VARIABLE _macros_hdf5) +set_tests_properties(${_macros_hdf5} PROPERTIES LABELS extra DEPENDS output/build-test-visit-hdf5) # Geant4 <= 11.0.3 is deleting non-empty HDF5 files after a successful run, so disable the tests. if(Geant4_VERSION VERSION_LESS "11.0.4" OR NOT Geant4_hdf5_FOUND) - set_tests_properties(${_macros} PROPERTIES DISABLED True) + set_tests_properties(${_macros_hdf5} PROPERTIES DISABLED True) endif() diff --git a/tests/output/run-test-root.sh b/tests/output/run-test-root.sh new file mode 100755 index 0000000..a57c5c9 --- /dev/null +++ b/tests/output/run-test-root.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -euo pipefail + +rmg="$1" +macro="macros/$2" +output="${2/.mac/.root}" + +# run remage, produce root output. +"$rmg" -g gdml/geometry.gdml -o "$output" -- "$macro" + +# check that output file is there. +test -f "$output"