Skip to content

Commit bf60ef9

Browse files
committed
Automatically create and load dictionaries
...for the tests that need them (currently, all nested `std::set` and friends).
1 parent 7da3afd commit bf60ef9

File tree

9 files changed

+16
-28
lines changed

9 files changed

+16
-28
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@ endif
55

66
.PHONY: all
77
all:
8+
$(MAKE) dict
89
$(MAKE) write
910
$(MAKE) read
1011

1112
# This assumes there is no whitespace in any of the paths...
13+
DICT_MAKEFILE_DIR := $(sort $(shell find */ -name Makefile -printf "%h\n"))
1214
WRITE_C := $(sort $(shell find . -name write.C))
1315
READ_C := $(sort $(shell find . -name read.C))
1416

17+
.PHONY: dict
18+
dict:
19+
@$(foreach d,$(DICT_MAKEFILE_DIR),make -C $(d) &&) true
20+
1521
.PHONY: write
1622
write:
17-
@$(foreach c,$(WRITE_C),$(ROOT_EXE) -q -l $(c) &&) true
23+
@$(foreach c,$(WRITE_C),LD_LIBRARY_PATH=$(shell dirname $(c)) $(ROOT_EXE) -q -l $(c) &&) true
1824

1925
.PHONY: read
2026
read:
21-
@$(foreach c,$(READ_C),$(ROOT_EXE) -q -l $(c) &&) true
27+
@$(foreach c,$(READ_C),LD_LIBRARY_PATH=$(shell dirname $(c)) $(ROOT_EXE) -q -l $(c) &&) true

types/multiset/nested/read.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ static void PrintNestedMultisetValue(const REntry &entry, std::string_view name,
5454

5555
void read(std::string_view input = "types.multiset.nested.root",
5656
std::string_view output = "types.multiset.nested.json") {
57-
if (!std::filesystem::exists("libNestedMultiset.so")) {
57+
if (gSystem->Load("libNestedMultiset") == -1)
5858
throw std::runtime_error("could not find the required ROOT dictionaries, "
5959
"please make sure to run `make` first");
60-
}
6160

62-
gSystem->Load("libNestedMultiset");
6361
std::ofstream os(std::string{output});
6462
os << "[\n";
6563

types/multiset/nested/write.C

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,9 @@ static std::shared_ptr<Multiset> MakeMultisetField(RNTupleModel &model,
3131
}
3232

3333
void write(std::string_view filename = "types.multiset.nested.root") {
34-
if (!std::filesystem::exists("libNestedMultiset.so")) {
34+
if (gSystem->Load("libNestedMultiset") == -1)
3535
throw std::runtime_error("could not find the required ROOT dictionaries, "
3636
"please make sure to run `make` first");
37-
}
38-
39-
gSystem->Load("libNestedMultiset");
4037

4138
auto model = RNTupleModel::Create();
4239

types/set/nested/read.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ static void PrintNestedSetValue(const REntry &entry, std::string_view name,
5454

5555
void read(std::string_view input = "types.set.nested.root",
5656
std::string_view output = "types.set.nested.json") {
57-
if (!std::filesystem::exists("libNestedSet.so")) {
57+
if (gSystem->Load("libNestedSet") == -1)
5858
throw std::runtime_error("could not find the required ROOT dictionaries, "
5959
"please make sure to run `make` first");
60-
}
6160

62-
gSystem->Load("libNestedSet");
6361
std::ofstream os(std::string{output});
6462
os << "[\n";
6563

types/set/nested/write.C

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,9 @@ static std::shared_ptr<Set> MakeSetField(RNTupleModel &model,
3131
}
3232

3333
void write(std::string_view filename = "types.set.nested.root") {
34-
if (!std::filesystem::exists("libNestedSet.so")) {
34+
if (gSystem->Load("libNestedSet") == -1)
3535
throw std::runtime_error("could not find the required ROOT dictionaries, "
3636
"please make sure to run `make` first");
37-
}
38-
39-
gSystem->Load("libNestedSet");
4037

4138
auto model = RNTupleModel::Create();
4239

types/unordered_multiset/nested/read.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ static void PrintNestedUnorderedMultisetValue(const REntry &entry,
6262

6363
void read(std::string_view input = "types.unordered_multiset.nested.root",
6464
std::string_view output = "types.unordered_multiset.nested.json") {
65-
if (!std::filesystem::exists("libNestedUnorderedMultiset.so")) {
65+
if (gSystem->Load("libNestedUnorderedMultiset") == -1)
6666
throw std::runtime_error("could not find the required ROOT dictionaries, "
6767
"please make sure to run `make` first");
68-
}
69-
gSystem->Load("libNestedUnorderedMultiset");
7068

7169
std::ofstream os(std::string{output});
7270
os << "[\n";

types/unordered_multiset/nested/write.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ MakeUnorderedMultisetField(RNTupleModel &model, std::string_view name,
3434
}
3535

3636
void write(std::string_view filename = "types.unordered_multiset.nested.root") {
37-
if (!std::filesystem::exists("libNestedUnorderedMultiset.so")) {
37+
if (gSystem->Load("libNestedUnorderedMultiset") == -1)
3838
throw std::runtime_error("could not find the required ROOT dictionaries, "
3939
"please make sure to run `make` first");
40-
}
41-
gSystem->Load("libNestedUnorderedMultiset");
4240

4341
auto model = RNTupleModel::Create();
4442

types/unordered_set/nested/read.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,9 @@ static void PrintNestedUnorderedSetValue(const REntry &entry,
6060

6161
void read(std::string_view input = "types.unordered_set.nested.root",
6262
std::string_view output = "types.unordered_set.nested.json") {
63-
if (!std::filesystem::exists("libNestedUnorderedSet.so")) {
63+
if (gSystem->Load("libNestedUnorderedSet") == -1)
6464
throw std::runtime_error("could not find the required ROOT dictionaries, "
6565
"please make sure to run `make` first");
66-
}
67-
gSystem->Load("libNestedUnorderedSet");
6866

6967
std::ofstream os(std::string{output});
7068
os << "[\n";

types/unordered_set/nested/write.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ MakeUnorderedSetField(RNTupleModel &model, std::string_view name,
3333
}
3434

3535
void write(std::string_view filename = "types.unordered_set.nested.root") {
36-
if (!std::filesystem::exists("libNestedUnorderedSet.so")) {
36+
if (gSystem->Load("libNestedUnorderedSet") == -1)
3737
throw std::runtime_error("could not find the required ROOT dictionaries, "
3838
"please make sure to run `make` first");
39-
}
40-
gSystem->Load("libNestedUnorderedSet");
4139

4240
auto model = RNTupleModel::Create();
4341

0 commit comments

Comments
 (0)