Skip to content

Commit 8fc9ae7

Browse files
committed
[roottest] improve ntuple cmake
Skip root7 test - RNTuple always build Properly use multiple fixtures, use longer fixtures names Directly use multiple sources when build executables
1 parent b6fb6bd commit 8fc9ae7

File tree

5 files changed

+16
-38
lines changed

5 files changed

+16
-38
lines changed

roottest/root/ntuple/.rootrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

roottest/root/ntuple/makeproject/rntuple/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if(NOT ROOT_root7_FOUND)
2-
return()
3-
endif()
4-
51
# Generate common dictionary for custom class
62
ROOTTEST_GENERATE_DICTIONARY(
73
rntuple_event_dict
@@ -15,16 +11,11 @@ ROOTTEST_GENERATE_DICTIONARY(
1511
# Write the RNTuple with the custom class field
1612
ROOTTEST_GENERATE_EXECUTABLE(
1713
write_rntuple
14+
write_rntuple.cxx rntuple_event_dict.cxx
1815
LIBRARIES Core RIO ROOTNTuple
1916
FIXTURES_REQUIRED generated_event_dictionary_rntuple
2017
FIXTURES_SETUP write_rntuple_executable)
2118

22-
# Specify more than one input source for the generated executable
23-
target_sources(
24-
write_rntuple
25-
PRIVATE write_rntuple.cxx rntuple_event_dict.cxx
26-
)
27-
2819
ROOTTEST_ADD_TEST(write_rntuple
2920
EXEC ./write_rntuple
3021
FIXTURES_REQUIRED write_rntuple_executable

roottest/root/ntuple/makeproject/ttree/CMakeLists.txt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ ROOTTEST_GENERATE_DICTIONARY(
1212
# Write the TTree with the custom class branch
1313
ROOTTEST_GENERATE_EXECUTABLE(
1414
write_ttree
15+
write_ttree.cxx ttree_event_dict.cxx
1516
LIBRARIES Core RIO Tree
1617
FIXTURES_REQUIRED generated_event_dictionary_ttree
1718
FIXTURES_SETUP write_ttree_executable)
1819

19-
# Specify more than one input source for the generated executable
20-
target_sources(
21-
write_ttree
22-
PRIVATE write_ttree.cxx ttree_event_dict.cxx
23-
)
2420
ROOTTEST_ADD_TEST(write_ttree
2521
EXEC ./write_ttree
2622
FIXTURES_REQUIRED write_ttree_executable
27-
FIXTURES_SETUP written_ttree)
23+
FIXTURES_SETUP makeproject_written_ttree)
2824

2925
# Call MakeProject on the output file
3026
ROOTTEST_GENERATE_EXECUTABLE(
@@ -35,7 +31,7 @@ ROOTTEST_GENERATE_EXECUTABLE(
3531

3632
ROOTTEST_ADD_TEST(makeproject_ttree
3733
EXEC ./makeproject_ttree
38-
FIXTURES_REQUIRED "written_ttree;makeproject_ttree"
34+
FIXTURES_REQUIRED makeproject_written_ttree makeproject_ttree
3935
FIXTURES_SETUP makeproject_ttree_called)
4036

4137
# Read back the class instance thanks to the shared library generated by MakeProject.
@@ -51,7 +47,7 @@ ROOTTEST_GENERATE_EXECUTABLE(
5147
read_ttree.cxx
5248
LIBRARIES ${ROOT_LIBRARIES} GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main ${TTREESTLTESTLIB}
5349
FIXTURES_REQUIRED makeproject_ttree_called
54-
FIXTURES_SETUP read_ttree_executable
50+
FIXTURES_SETUP makeproject_read_ttree_executable
5551
)
5652
target_include_directories(read_ttree PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
5753
target_link_directories(read_ttree PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/libttreestltest)
@@ -67,7 +63,7 @@ set(_roottest_env_librarypath ${ROOTTEST_ENV_LIBRARYPATH})
6763
set(ROOTTEST_ENV_LIBRARYPATH "${ROOTTEST_ENV_LIBRARYPATH}:${CMAKE_CURRENT_BINARY_DIR}/libttreestltest")
6864
ROOTTEST_ADD_TEST(read_ttree
6965
EXEC ./read_ttree
70-
FIXTURES_REQUIRED read_ttree_executable
71-
# PATH is used on Windows to find libraries for loading
72-
ENVIRONMENT PATH=${CMAKE_CURRENT_BINARY_DIR}/libttreestltest)
66+
FIXTURES_REQUIRED makeproject_read_ttree_executable
67+
# PATH is used on Windows to find libraries for loading
68+
ENVIRONMENT PATH=${CMAKE_CURRENT_BINARY_DIR}/libttreestltest)
7369
set(ROOTTEST_ENV_LIBRARYPATH ${_roottest_env_librarypath})

roottest/root/ntuple/streamerfield/CMakeLists.txt

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ ROOTTEST_GENERATE_DICTIONARY(
88

99
ROOTTEST_GENERATE_EXECUTABLE(
1010
write_event
11+
write_event.cxx event_v2_dict.cxx
1112
LIBRARIES Core RIO ROOTNTuple
1213
FIXTURES_REQUIRED generated_event_v2_dictionary
13-
FIXTURES_SETUP write_event_excutable)
14-
15-
target_sources(
16-
write_event
17-
PRIVATE write_event.cxx event_v2_dict.cxx
18-
)
14+
FIXTURES_SETUP streamerfield_write_event_excutable)
1915

2016
ROOTTEST_ADD_TEST(write_event
2117
EXEC ./write_event
22-
FIXTURES_REQUIRED write_event_excutable
23-
FIXTURES_SETUP written_event)
18+
FIXTURES_REQUIRED streamerfield_write_event_excutable
19+
FIXTURES_SETUP streamerfield_written_event)
2420

2521
ROOTTEST_GENERATE_DICTIONARY(
2622
event_v3_dict
@@ -32,15 +28,11 @@ ROOTTEST_GENERATE_DICTIONARY(
3228

3329
ROOTTEST_GENERATE_EXECUTABLE(
3430
read_event
31+
read_event.cxx event_v3_dict.cxx
3532
LIBRARIES Core RIO ROOTNTuple
3633
FIXTURES_REQUIRED generated_event_v3_dictionary
37-
FIXTURES_SETUP read_event_executable)
38-
39-
target_sources(
40-
read_event
41-
PRIVATE read_event.cxx event_v3_dict.cxx
42-
)
34+
FIXTURES_SETUP streamerfield_read_event_executable)
4335

4436
ROOTTEST_ADD_TEST(read_event
4537
EXEC ./read_event
46-
FIXTURES_REQUIRED read_event_executable written_event)
38+
FIXTURES_REQUIRED streamerfield_read_event_executable streamerfield_written_event)

roottest/root/ntuple/test_basics.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Processing /home/jakob/Documents/CERN/ROOT/roottest/root/ntuple/basics.C...
1+
Processing basics.C...
22

33
{
44
"E": 137

0 commit comments

Comments
 (0)