Skip to content

Commit 34d1d71

Browse files
authored
root/treeformula/references make to cmake
* implemented the tests in cmake * remove Makefile * Avoid variable shadowing
1 parent 24f3ca1 commit 34d1d71

File tree

6 files changed

+67
-79
lines changed

6 files changed

+67
-79
lines changed
Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,55 @@
1-
#-------------------------------------------------------------------------------
2-
#
3-
# Placeholder file to translate the tests to the new CTest system. Meanwhile we
4-
# define a CTest test that calls 'make' in ${CMAKE_CURRENT_SOURCE_DIR}
5-
#
6-
#-------------------------------------------------------------------------------
7-
ROOTTEST_ADD_OLDTEST()
1+
ROOT_GENERATE_DICTIONARY(G__TreeFormulaReferencesGeneration
2+
${CMAKE_CURRENT_SOURCE_DIR}/Event.h
3+
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/EventLinkDef.h)
4+
5+
ROOT_LINKER_LIBRARY(TreeFormulaReferencesGeneration
6+
${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaReferencesGeneration.cxx
7+
G__TreeFormulaReferencesGeneration.cxx
8+
LIBRARIES Core Tree Hist MathCore)
9+
10+
if(MSVC)
11+
add_custom_command(TARGET TreeFormulaReferencesGeneration POST_BUILD
12+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libTreeFormulaReferencesGeneration.dll
13+
${CMAKE_CURRENT_BINARY_DIR}/libTreeFormulaReferencesGeneration.dll
14+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libTreeFormulaReferencesGeneration.lib
15+
${CMAKE_CURRENT_BINARY_DIR}/libTreeFormulaReferencesGeneration.lib)
16+
endif()
17+
18+
ROOTTEST_GENERATE_EXECUTABLE(TreeFormulaReferencesGenerator
19+
${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaReferencesGenerator.cxx
20+
LIBRARIES Core RIO Net Tree Hist MathCore TreeFormulaReferencesGeneration
21+
DEPENDS TreeFormulaReferencesGeneration
22+
FIXTURES_SETUP treeformula-references-generator)
23+
24+
set(size 6)
25+
set(comp 0)
26+
set(action 1)
27+
set(tracks 30)
28+
29+
function(TREEFORMULA_REFERENCES_GENERATION name opt)
30+
ROOTTEST_ADD_TEST("${name}"
31+
COMMAND ./TreeFormulaReferencesGenerator ${size} ${comp} "${opt}" ${action} ${tracks} "TreeFormulaReferences.${name}.root"
32+
FIXTURES_REQUIRED treeformula-references-generator
33+
FIXTURES_SETUP treeformula-references-generation
34+
RESOURCE_LOCK treeformula-references-file)
35+
endfunction()
36+
37+
TREEFORMULA_REFERENCES_GENERATION(new.split0 0)
38+
TREEFORMULA_REFERENCES_GENERATION(new.split1 1)
39+
TREEFORMULA_REFERENCES_GENERATION(new.split2 2)
40+
TREEFORMULA_REFERENCES_GENERATION(new.split9 9)
41+
TREEFORMULA_REFERENCES_GENERATION(old.streamed -1)
42+
TREEFORMULA_REFERENCES_GENERATION(old.split -2)
43+
44+
configure_file(dt_RefProxyTest.C . COPYONLY)
45+
46+
ROOTTEST_ADD_TEST(proxy
47+
OUTREF RefProxyTest.ref
48+
MACRO dt_RefProxyTest.C
49+
PASSRC 1
50+
FIXTURES_REQUIRED treeformula-references-generation)
51+
52+
ROOTTEST_ADD_TEST(clones
53+
COPY_TO_BUILDDIR execRefClonesArrayTest.h
54+
OUTREF execRefClonesArrayTest.ref
55+
MACRO execRefClonesArrayTest.cxx)

root/treeformula/references/Makefile

Lines changed: 0 additions & 61 deletions
This file was deleted.

root/treeformula/references/RefProxyTest.ref

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Processing dt_RefProxyTest.C...
33

44

55

6-
===================== Event.new.split0.root =================================
6+
===================== TreeFormulaReferences.new.split0.root =================================
77

88

99
************************************************************************************************************
@@ -61,7 +61,7 @@ Processing dt_RefProxyTest.C...
6161

6262

6363

64-
===================== Event.new.split1.root =================================
64+
===================== TreeFormulaReferences.new.split1.root =================================
6565

6666

6767
************************************************************************************************************
@@ -119,7 +119,7 @@ Processing dt_RefProxyTest.C...
119119

120120

121121

122-
===================== Event.new.split2.root =================================
122+
===================== TreeFormulaReferences.new.split2.root =================================
123123

124124

125125
************************************************************************************************************
@@ -178,7 +178,7 @@ crap
178178

179179

180180

181-
===================== Event.new.split9.root =================================
181+
===================== TreeFormulaReferences.new.split9.root =================================
182182

183183

184184
************************************************************************************************************

root/treeformula/references/Event.cxx renamed to root/treeformula/references/TreeFormulaReferencesGeneration.cxx

File renamed without changes.

root/treeformula/references/MainEvent.cxx renamed to root/treeformula/references/TreeFormulaReferencesGenerator.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ int main(int argc, char **argv)
133133
if (split < 0) {branchStyle = 0; split = -1-split;}
134134

135135
TFile *hfile;
136-
TTree *tree;
137136
Event *event = 0;
138137

139138
// Fill event, header and tracks with some random numbers
@@ -158,7 +157,7 @@ int main(int argc, char **argv)
158157
hfile = new TNetFile("root://localhost/root/test/EventNet.root");
159158
} else
160159
hfile = new TFile(filename);
161-
tree = (TTree*)hfile->Get("T");
160+
TTree *tree = (TTree*)hfile->Get("T");
162161
TBranch *branch = tree->GetBranch("event");
163162
branch->SetAddress(&event);
164163
Int_t nentries = (Int_t)tree->GetEntries();

root/treeformula/references/dt_RefProxyTest.C

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#define ClingWorkAroundMissingDynamicScope
2+
13
bool dt_RefProxyTest() {
24
gSystem->Load("libTreePlayer");
3-
gSystem->Load("libEvent");
5+
gSystem->Load("libTreeFormulaReferencesGeneration");
46

57
const char* fname;
68

7-
fname = "Event.new.split0.root";
9+
fname = "TreeFormulaReferences.new.split0.root";
810
printf("\n\n\n===================== %s =================================\n\n\n",fname);
911
TFile::Open(fname);
1012
#ifdef ClingWorkAroundMissingDynamicScope
@@ -17,7 +19,7 @@ bool dt_RefProxyTest() {
1719
T->Scan("fLastTrack.GetUniqueID():[email protected]():fLastTrack.GetUniqueID()&0xFFFF:fTracks[[email protected]()-1].fUniqueID&0xFFFF:fTracks[0].GetUniqueID()&0xFFFF","","precision=3 col=9d");
1820
T->Scan("fHighPt.fUniqueID:fHighPt.fUniqueID&0xFFFF:fHighPt.fPx:fHighPt.fPy:fHighPt.fPz:fTracks[fHighPt.fUniqueID&0xFFFF-1].fUniqueID&0xFFFF:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPx:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPy:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPz","","precision=3 col=9d",1);
1921

20-
fname = "Event.new.split1.root";
22+
fname = "TreeFormulaReferences.new.split1.root";
2123
printf("\n\n\n===================== %s =================================\n\n\n",fname);
2224
TFile::Open(fname);
2325
#ifdef ClingWorkAroundMissingDynamicScope
@@ -29,7 +31,7 @@ bool dt_RefProxyTest() {
2931
T->Scan("fLastTrack.GetUniqueID():[email protected]():fLastTrack.GetUniqueID()&0xFFFF:fTracks[[email protected]()-1].fUniqueID&0xFFFF:fTracks[0].GetUniqueID()&0xFFFF","","precision=3 col=9d");
3032
T->Scan("fHighPt.fUniqueID:fHighPt.fUniqueID&0xFFFF:fHighPt.fPx:fHighPt.fPy:fHighPt.fPz:fTracks[fHighPt.fUniqueID&0xFFFF-1].fUniqueID&0xFFFF:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPx:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPy:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPz","","precision=3 col=9d",1);
3133

32-
fname = "Event.new.split2.root";
34+
fname = "TreeFormulaReferences.new.split2.root";
3335
printf("\n\n\n===================== %s =================================\n\n\n",fname);
3436
TFile::Open(fname);
3537
#ifdef ClingWorkAroundMissingDynamicScope
@@ -42,7 +44,7 @@ printf("crap\n");
4244
T->Scan("fLastTrack.GetUniqueID():[email protected]():fLastTrack.GetUniqueID()&0xFFFF:fTracks[[email protected]()-1].GetUniqueID()&0xFFFF:fTracks[0].GetUniqueID()&0xFFFF","","precision=3 col=9d");
4345
T->Scan("fHighPt.fUniqueID:fHighPt.fUniqueID&0xFFFF:fHighPt.fPx:fHighPt.fPy:fHighPt.fPz:fTracks[fHighPt.fUniqueID&0xFFFF-1].fUniqueID&0xFFFF:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPx:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPy:fTracks[fHighPt.fUniqueID&0xFFFF-1].fPz","","precision=3 col=9d",1);
4446

45-
fname = "Event.new.split9.root";
47+
fname = "TreeFormulaReferences.new.split9.root";
4648
printf("\n\n\n===================== %s =================================\n\n\n",fname);
4749
TFile::Open(fname);
4850
#ifdef ClingWorkAroundMissingDynamicScope

0 commit comments

Comments
 (0)