Skip to content

Commit 80f2b06

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 1e660dc commit 80f2b06

File tree

9 files changed

+89
-83
lines changed

9 files changed

+89
-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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <fstream>
2+
#include <iostream>
3+
#include <string>
4+
5+
void runscript(const std::string &fname, bool with_rootmap = false)
6+
{
7+
if (with_rootmap) {
8+
int old = gInterpreter->SetClassAutoloading(kFALSE);
9+
gInterpreter->LoadLibraryMap("libbtag.rootmap");
10+
gInterpreter->LoadLibraryMap("libjet.rootmap");
11+
gInterpreter->LoadLibraryMap("libsjet.rootmap");
12+
gInterpreter->SetClassAutoloading(old);
13+
}
14+
15+
std::ifstream f(fname);
16+
17+
std::string str;
18+
while (std::getline(f, str)) {
19+
20+
if (gSystem->InheritsFrom("TWinNTSystem"))
21+
if (str.find(".L") == 0) {
22+
auto p = str.find(".so");
23+
if (p != std::string::npos)
24+
str = str.substr(0, p) + ".dll";
25+
}
26+
27+
if (str.length() > 0)
28+
gInterpreter->ProcessLineSynch(str.c_str());
29+
}
30+
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
.L lib/libjet.so
2-
.L lib/libbtag.so
1+
.L libjet_dictrflx.so
2+
.L libbtag_dictrflx.so
3+
34
#include "DataVector.h"
5+
46
TClass::GetClass("SG::AuxTypeVectorFactory<std::vector<ElementLink<DataVector<xAOD::Jet_v1> > > >");
57
auto c = TClass::GetClass("DataVector<xAOD::Jet_v1>")->GetClassInfo();
68
printf("Classinfo for DataVector<xAOD::Jet_v1> is %s\n",gInterpreter->ClassInfo_IsValid(c) ? "valid" : "invalid");

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
.L lib/libsjet.so
2-
.L lib/libbtag.so
1+
.L libsjet_dictrflx.so
2+
.L libbtag_dictrflx.so
3+
34
#include "DataVector.h"
5+
46
TClass::GetClass("SG::AuxTypeVectorFactory<std::vector<ElementLink<SDataVector<xAOD::SJet_v1> > > >");
57
auto c = TClass::GetClass("SDataVector<xAOD::SJet_v1>")->GetClassInfo();
68
printf("Classinfo for SDataVector<xAOD::SJet_v1> is %s\n",gInterpreter->ClassInfo_IsValid(c) ? "valid" : "invalid");

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

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

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
.L lib/libjet.so
2-
.L lib/libbtag.so
1+
.L libjet_dictrflx.so
2+
.L libbtag_dictrflx.so
3+
34
#include "DataVector.h"
5+
46
DataVector<xAOD::Jet_v1> obj;
57

68
std::string name;

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

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

0 commit comments

Comments
 (0)