Skip to content

Commit

Permalink
Re-enable fastcloningeventtree tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vepadulano committed Feb 19, 2024
1 parent 5f20e9b commit 0e92b5f
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 354 deletions.
2 changes: 0 additions & 2 deletions root/tree/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@

set(excluded_tests fastcloningeventtree)
ROOTTEST_ADD_TESTDIRS(EXCLUDED_DIRS ${excluded_tests})
110 changes: 23 additions & 87 deletions root/tree/fastcloningeventtree/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,90 +1,26 @@
if(ROOTTEST_DIR)
set(ROOT_EVENT_DIR ${ROOTTEST_DIR}/root/treeformula/event/)
else()
set(ROOT_EVENT_DIR ${ROOT_SOURCE_DIR}/roottest/root/treeformula/event/)
endif()

# Generating dataset from roottest-treeformula-event-make test
# FIXME: it will be nice to move roottest-treeformula-event to CMake and add it as dependency
# To fix runtime_cxxmodules, we need to use already build artefacts.

if(TARGET onepcm)
set(EventDependencies "onepcm")
set(EventDependencies "onepcm")
endif()

#ROOT_GENERATE_DICTIONARY(EventDict ${ROOT_EVENT_DIR}/Event.h
# LINKDEF ${ROOT_EVENT_DIR}/EventLinkDef.h)

#ROOT_LINKER_LIBRARY(Event TEST ${ROOT_EVENT_DIR}/Event.cxx EventDict.cxx
# LIBRARIES Core Tree Hist MathCore)

ROOTTEST_GENERATE_EXECUTABLE(EventGeneration ${ROOT_EVENT_DIR}/MainEvent.cxx
LIBRARIES Core RIO Net Tree Hist MathCore Event)

if(NOT ClingWorkAroundMissingDynamicScope)
ROOTTEST_ADD_TEST(Event-new-split0
COMMAND ./EventGeneration 50 0 0 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split0.root
DEPENDS EventGeneration ${EventDependencies})

ROOTTEST_ADD_TEST(Event-new-split1
COMMAND ./EventGeneration 50 0 1 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split1.root
DEPENDS EventGeneration ${EventDependencies})

ROOTTEST_ADD_TEST(Event-new-split2
COMMAND ./EventGeneration 50 0 2 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split2.root
DEPENDS EventGeneration ${EventDependencies})

ROOTTEST_ADD_TEST(Event-new-split9
COMMAND ./EventGeneration 50 0 9 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split9.root
DEPENDS EventGeneration ${EventDependencies})

ROOTTEST_ADD_TEST(Event-old-split
COMMAND ./EventGenerate 50 0 -2 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.old.split.root
DEPENDS EventGenerate ${EventDependencies})

ROOTTEST_ADD_TEST(Event-old-streamed
COMMAND ./EventGeneration 20 0 -1 1 30 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.old.streamed.root
DEPENDS EventGeneration ${EventDependencies})

ROOTTEST_ADD_TEST(Event-new-split0-clone
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split0.root\\\"\\)" > log
DEPENDS Event-new-split0)

ROOTTEST_ADD_TEST(Event-new-split1-clone
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split1.root\\\"\\)" > log
DEPENDS Event-new-split1)

ROOTTEST_ADD_TEST(Event-new-split2-clone
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split2.root\\\"\\)" > log
DEPENDS Event-new-split2)

ROOTTEST_ADD_TEST(Event-new-split9-clone
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split9.root\\\"\\)" > log
DEPENDS Event-new-split9)

ROOTTEST_ADD_TEST(Event-old-split-clone
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.old.split.root\\\"\\)" > log
DEPENDS Event-old-split)

ROOTTEST_ADD_TEST(Event-old-streamed-clone
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.old.streamed.root\\\"\\)" > log
DEPENDS Event-old-streamed)

ROOTTEST_ADD_TEST(Event-new-split9-clone
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/dt_MakeRef.C\\(\\\"Event.new.split9.root\\\"\\)" > log
DEPENDS Event-new-split9)

ROOTTEST_ADD_TEST(runsingle
COPY_TO_BUILDDIR dt_wrap.C dt_RunDrawTest.C dt_DrawTest.C
EXEC dt_RunDrawTest.sh
OUTREF references/runsingle.ref
WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS Event-new-split0-clone
DEPENDS Event-new-split1-clone
DEPENDS Event-new-split2-clone
DEPENDS Event-new-split9-clone
DEPENDS Event-old-split-clone
DEPENDS Event-old-streamed-clone
DEPENDS Event-new-split9-clone
)
endif()
#
# function FASTCLONINGEVENTTREE_GENERATE_TEST
#
# Generate ctrans.C tests using file generated with FASTCLONINGEVENTTREE_GENERATE_FILE
#
function(FASTCLONINGEVENTTREE_GENERATE_TEST file_name)
ROOTTEST_ADD_TEST("ctrans-${file_name}"
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\(\"${ROOTTEST_EVENTGENERATION_OUTPUT_DIR}/${file_name}.root\"\)"
DEPENDS EventGeneration
FIXTURES_REQUIRED EventGeneration-${file_name})
endfunction()

FASTCLONINGEVENTTREE_GENERATE_TEST(split-zero)
FASTCLONINGEVENTTREE_GENERATE_TEST(split-one)
FASTCLONINGEVENTTREE_GENERATE_TEST(split-two)
FASTCLONINGEVENTTREE_GENERATE_TEST(split-nine)
FASTCLONINGEVENTTREE_GENERATE_TEST(stream-old)

ROOTTEST_ADD_TEST(makeref-split-nine
COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/dt_MakeRef.C\(\"${ROOTTEST_EVENTGENERATION_OUTPUT_DIR}/split-nine.root\"\)" > log
DEPENDS EventGeneration
FIXTURES_REQUIRED EventGeneration-split-nine)
187 changes: 0 additions & 187 deletions root/tree/fastcloningeventtree/Makefile

This file was deleted.

10 changes: 9 additions & 1 deletion root/tree/fastcloningeventtree/ctrans.C
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
void ctrans(const char *filename)
{
std::string fullpath{filename};

// Add directory of the input file to the dynamic path so that the
// library can be loaded.
auto lastslash = fullpath.find_last_of("/");
std::string directory{fullpath.substr(0, lastslash)};
gSystem->AddDynamicPath(directory.c_str());
TFile *_file0 = TFile::Open(filename);
gSystem->Load("libEvent.so");
gSystem->Load("libTreeFormulaEvent");

TTree *from = (TTree*) _file0->Get("T");
auto f = new TFile("clone.root","RECREATE");
from->CloneTree(-1,"fast");
Expand Down
61 changes: 0 additions & 61 deletions root/tree/fastcloningeventtree/dt_RunDrawTest.sh

This file was deleted.

7 changes: 0 additions & 7 deletions root/tree/fastcloningeventtree/mtrans.C

This file was deleted.

Loading

0 comments on commit 0e92b5f

Please sign in to comment.