diff --git a/examples/05-MUSUN/CMakeLists.txt b/examples/05-MUSUN/CMakeLists.txt index 48eef28..519909b 100644 --- a/examples/05-MUSUN/CMakeLists.txt +++ b/examples/05-MUSUN/CMakeLists.txt @@ -10,3 +10,14 @@ endif() add_executable(05-MUSUN main.cc HPGeTestStand.hh HPGeTestStand.cc) target_link_libraries(05-MUSUN PUBLIC RMG::remage) + +# collect auxiliary files +file( + GLOB _aux + RELATIVE ${PROJECT_SOURCE_DIR} + *.csv *.mac) + +# copy them to the build area +foreach(_file ${_aux}) + configure_file(${PROJECT_SOURCE_DIR}/${_file} ${PROJECT_BINARY_DIR}/${_file} COPYONLY) +endforeach() diff --git a/examples/05-MUSUN/main.cc b/examples/05-MUSUN/main.cc index 7632fda..95324cc 100644 --- a/examples/05-MUSUN/main.cc +++ b/examples/05-MUSUN/main.cc @@ -11,6 +11,7 @@ int main(int argc, char** argv) { manager.SetUserInit(new HPGeTestStand()); manager.SetNumberOfThreads(2); manager.EnablePersistency(); + manager.SetOutputOverwriteFiles(true); manager.GetDetectorConstruction()->RegisterDetector(kGermanium, "HPGe1", 0); manager.GetDetectorConstruction()->RegisterDetector(kGermanium, "HPGe2", 1); manager.GetDetectorConstruction()->RegisterDetector(kGermanium, "HPGe3", 2); @@ -22,5 +23,6 @@ int main(int argc, char** argv) { manager.Initialize(); manager.Run(); - return 0; + if (manager.HadError()) return 1; + return manager.HadWarning() ? 2 : 0; } diff --git a/examples/05-MUSUN/run.mac b/examples/05-MUSUN/run.mac index a59b48a..198951b 100644 --- a/examples/05-MUSUN/run.mac +++ b/examples/05-MUSUN/run.mac @@ -6,11 +6,9 @@ /RMG/Output/FileName output.root - - /RMG/Generator/Confine UnConfined /RMG/Generator/Select MUSUNCosmicMuons -/RMG/Generator/MUSUNCosmicMuons/SetMUSUNFile MUSUN_10k_events.csv +/RMG/Generator/MUSUNCosmicMuons/SetMUSUNFile MUSUN_100_events.csv -/run/beamOn 1000 +/run/beamOn 100 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 67bfe4c..86a41a7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,3 +15,7 @@ add_subdirectory(internals) add_subdirectory(output) add_subdirectory(python) add_subdirectory(vertex) + +if(RMG_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() diff --git a/tests/examples/CMakeLists.txt b/tests/examples/CMakeLists.txt new file mode 100644 index 0000000..1ec935d --- /dev/null +++ b/tests/examples/CMakeLists.txt @@ -0,0 +1,5 @@ +add_test( + NAME examples/05-MUSUN + WORKING_DIRECTORY $ + COMMAND 05-MUSUN run.mac) +set_tests_properties(examples/05-MUSUN PROPERTIES LABELS extra)