Skip to content

Commit 60146a3

Browse files
committed
[roottest] use cmake for meta/ROOT-7181 tests
While redirecting input stream into root execution is not provided by ROOTTEST_ADD_TEST, implement reading and executing scritps line by line ourself. Also instead loading "lib.so" files using name of generated reflex dictionary Ref files and main part of scripts remain the same
1 parent 522b4eb commit 60146a3

File tree

9 files changed

+79
-83
lines changed

9 files changed

+79
-83
lines changed

roottest/root/meta/ROOT-7181/.rootrc

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
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-
8-
ROOTTEST_ADD_OLDTEST()
1+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
2+
3+
ROOTTEST_GENERATE_REFLEX_DICTIONARY(btag
4+
inc/BTagVertex_v1.h
5+
SELECTION inc/btag_selection.xml
6+
FIXTURES_SETUP root-meta-7181-btag-fixture)
7+
8+
ROOTTEST_GENERATE_REFLEX_DICTIONARY(jet
9+
inc/Jet_v1.h
10+
SELECTION inc/jet_selection.xml
11+
FIXTURES_SETUP root-meta-7181-jet-fixture)
12+
13+
ROOTTEST_GENERATE_REFLEX_DICTIONARY(sjet
14+
inc/SJet_v1.h
15+
SELECTION inc/sjet_selection.xml
16+
FIXTURES_SETUP root-meta-7181-sjet-fixture)
17+
18+
macro(ROOT_7181_TEST name use_rmap)
19+
if(${use_rmap} STREQUAL "true")
20+
set(testname rmap-${name})
21+
else()
22+
set(testname ${name})
23+
endif()
24+
25+
ROOTTEST_ADD_TEST(${testname}
26+
MACRO runscript.C
27+
MACROARG "\"${CMAKE_CURRENT_SOURCE_DIR}/scripts/${name}.script\",${use_rmap}"
28+
ROOTEXE_OPTS -e "gInterpreter->AddIncludePath(\"-I${CMAKE_CURRENT_SOURCE_DIR}/inc\")"
29+
OUTREF ${testname}.ref
30+
FIXTURES_REQUIRED root-meta-7181-btag-fixture
31+
root-meta-7181-jet-fixture
32+
root-meta-7181-sjet-fixture)
33+
endmacro(ROOT_7181_TEST)
34+
35+
ROOT_7181_TEST(case1 false)
36+
ROOT_7181_TEST(case2 false)
37+
ROOT_7181_TEST(case3 false)
38+
ROOT_7181_TEST(case4 false)
39+
40+
ROOT_7181_TEST(case1 true)
41+
ROOT_7181_TEST(case2 true)
42+
ROOT_7181_TEST(case3 true)
43+
ROOT_7181_TEST(case4 true)

roottest/root/meta/ROOT-7181/Makefile

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <fstream>
2+
#include <iostream>
3+
#include <string>
4+
5+
#include "DataVector.h"
6+
7+
void runscript(const std::string &fname, bool with_rootmap = false)
8+
{
9+
if (with_rootmap) {
10+
int old = gInterpreter->SetClassAutoloading(kFALSE);
11+
gInterpreter->LoadLibraryMap("libbtag.rootmap");
12+
gInterpreter->LoadLibraryMap("libjet.rootmap");
13+
gInterpreter->LoadLibraryMap("libsjet.rootmap");
14+
gInterpreter->SetClassAutoloading(old);
15+
}
16+
17+
std::ifstream f(fname);
18+
19+
//std::cout << "Processing " << fname << "\n";
20+
21+
std::string str;
22+
while (std::getline(f, str)) {
23+
24+
//std::cout << "Processing line: " << str << "\n";
25+
26+
gROOT->ProcessLine(str.c_str());
27+
}
28+
}

roottest/root/meta/ROOT-7181/scripts/case1.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.L lib/libjet.so
2-
.L lib/libbtag.so
1+
gSystem->Load("libjet_dictrflx");
2+
gSystem->Load("libbtag_dictrflx");
33
#include "DataVector.h"
44
TClass::GetClass("SG::AuxTypeVectorFactory<std::vector<ElementLink<DataVector<xAOD::Jet_v1> > > >");
55
auto c = TClass::GetClass("DataVector<xAOD::Jet_v1>")->GetClassInfo();

roottest/root/meta/ROOT-7181/scripts/case2.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.L lib/libsjet.so
2-
.L lib/libbtag.so
1+
gSystem->Load("libsjet_dictrflx");
2+
gSystem->Load("libbtag_dictrflx");
33
#include "DataVector.h"
44
TClass::GetClass("SG::AuxTypeVectorFactory<std::vector<ElementLink<SDataVector<xAOD::SJet_v1> > > >");
55
auto c = TClass::GetClass("SDataVector<xAOD::SJet_v1>")->GetClassInfo();

roottest/root/meta/ROOT-7181/scripts/case3.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.L lib/libjet.so
2-
.L lib/libbtag.so
1+
gSystem->Load("libjet_dictrflx");
2+
gSystem->Load("libbtag_dictrflx");
33
#include "DataVector.h"
44
auto c = TClass::GetClass("DataVector<xAOD::Jet_v1>");
55
printf("TClass for DataVector<xAOD::Jet_v1> is %s\n",c->IsLoaded() ? "loaded" : "not loaded");

roottest/root/meta/ROOT-7181/scripts/case4.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.L lib/libjet.so
2-
.L lib/libbtag.so
1+
gSystem->Load("libjet_dictrflx");
2+
gSystem->Load("libbtag_dictrflx");
33
#include "DataVector.h"
44
DataVector<xAOD::Jet_v1> obj;
55

roottest/root/meta/ROOT-7181/scripts/loadrootmap.C

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

0 commit comments

Comments
 (0)