From bf096d67249adfc69e001c098cb6f1d5f7cdf2d7 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Fri, 4 Dec 2020 17:33:58 +0100
Subject: [PATCH] DDTest.EventReader: test HepMC3 reader, make testing depend
 on cmake options

---
 DDTest/CMakeLists.txt           | 6 ++++++
 DDTest/src/test_EventReaders.cc | 7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt
index 4f065e258..d3fb4fe2d 100644
--- a/DDTest/CMakeLists.txt
+++ b/DDTest/CMakeLists.txt
@@ -54,6 +54,12 @@ if (DD4HEP_USE_GEANT4)
       test_EventReaders
       )
     add_executable(${TEST_NAME} src/${TEST_NAME}.cc)
+    if(DD4HEP_USE_HEPMC3)
+      target_compile_definitions(${TEST_NAME} PRIVATE DD4HEP_USE_HEPMC3)
+    endif()
+    if(DD4HEP_USE_LCIO)
+      target_compile_definitions(${TEST_NAME} PRIVATE DD4HEP_USE_LCIO)
+    endif()
     target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDG4)
     target_include_directories(${TEST_NAME} PRIVATE ./include)
     install(TARGETS ${TEST_NAME} DESTINATION bin)
diff --git a/DDTest/src/test_EventReaders.cc b/DDTest/src/test_EventReaders.cc
index 5efe6effb..06400858c 100644
--- a/DDTest/src/test_EventReaders.cc
+++ b/DDTest/src/test_EventReaders.cc
@@ -37,11 +37,14 @@ int main(int argc, char** argv ){
   std::string inputFileFolder = argv[1];
 
   std::vector<TestTuple> tests;
+  #ifdef DD4HEP_USE_LCIO
   tests.push_back( TestTuple( "LCIOStdHepReader", "bbudsc_3evt.stdhep" ) );
   tests.push_back( TestTuple( "LCIOFileReader",   "muons.slcio" , /*skipEOF= */ true ) );
+  #endif
   tests.push_back( TestTuple( "Geant4EventReaderHepEvtShort", "Muons10GeV.HEPEvt" ) );
-  tests.push_back( TestTuple( "Geant4EventReaderHepMC", "g4pythia.hepmc" ) );
-
+  #ifdef DD4HEP_USE_HEPMC3
+  tests.push_back( TestTuple( "HEPMC3FileReader", "g4pythia.hepmc", /*skipEOF= */ true) );
+  #endif
 
   try{
     for(std::vector<TestTuple>::const_iterator it = tests.begin(); it != tests.end(); ++it) {
-- 
GitLab