Skip to content

Commit e40e565

Browse files
committed
Restructure test directories
1 parent 60b86d9 commit e40e565

File tree

213 files changed

+870
-829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+870
-829
lines changed

CMakeLists.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,14 @@ if(DETRAY_SETUP_BENCHMARK)
264264
endif()
265265

266266
# Set up covfie.
267-
option(DETRAY_SETUP_COVFIE "Set up the covfie target(s) explicitly" TRUE)
267+
if(DETRAY_BUILD_TESTING OR DETRAY_BUILD_BENCHMARKS OR DETRAY_BUILD_CLI_TOOLS)
268+
set(DETRAY_BUILD_COVFIE ON)
269+
endif()
270+
option(
271+
DETRAY_SETUP_COVFIE
272+
"Set up the covfie target(s) explicitly"
273+
${DETRAY_BUILD_COVFIE}
274+
)
268275
option(
269276
DETRAY_USE_SYSTEM_COVFIE
270277
"Pick up an existing installation of covfie from the build environment"

detectors/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ file(
2020
detray_add_library( detray_detectors detectors ${_detray_detectors_headers})
2121
target_link_libraries(
2222
detray_detectors
23-
INTERFACE covfie::core vecmem::core detray::core detray::io
23+
INTERFACE vecmem::core detray::core detray::io
2424
)
2525

2626
unset(_detray_detector_headers)

io/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ file(
2323
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
2424
"include/detray/io/backend/*.hpp"
2525
"include/detray/io/backend/detail/*.hpp"
26-
"include/detray/io/covfie/*.hpp"
2726
"include/detray/io/frontend/*.hpp"
2827
"include/detray/io/frontend/detail/*.hpp"
2928
"include/detray/io/frontend/impl/*.hpp"
@@ -38,7 +37,6 @@ target_link_libraries(
3837
INTERFACE
3938
nlohmann_json::nlohmann_json
4039
vecmem::core
41-
covfie::core
4240
detray::core
4341
detray::io_utils
4442
)

io/include/detray/io/backend/detail/grid_reader.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ class grid_reader {
403403
}
404404
entry.set_volume(volume_idx);
405405
entry.set_index(static_cast<dindex>(c));
406-
vgr_builder->get().template populate<attach<>>(mbin, entry);
406+
grid.template populate<attach<>>(mbin, entry);
407407
}
408408
}
409409
} else {

io/include/detray/io/covfie/read_bfield.hpp

-52
This file was deleted.

plugins/svgtools/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ detray_add_library( detray_svgtools svgtools
1919
)
2020
target_link_libraries(
2121
detray_svgtools
22-
INTERFACE detray::core actsvg::core actsvg::meta
22+
INTERFACE detray::core detray::io actsvg::core actsvg::meta
2323
)
2424

2525
# Clean up.

tests/CMakeLists.txt

+58-40
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#
55
# Mozilla Public License Version 2.0
66

7-
message(STATUS "Building 'detray::test_utils' component")
8-
97
# Set the common C++ flags.
108
include(detray-compiler-options-cpp)
119

@@ -14,37 +12,84 @@ include_directories(
1412
$<TARGET_PROPERTY:covfie::core,INTERFACE_INCLUDE_DIRECTORIES>
1513
)
1614

17-
# Set up a test library, which can be used by downstream projects without
18-
# building the detray unit and integration
15+
# Detray unit and integration test framework (depends on google test)
16+
if(DETRAY_BUILD_TESTING)
17+
message(STATUS "Building 'detray::test_framework' component")
18+
19+
file(
20+
GLOB _detray_test_headers
21+
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
22+
"include/detray/test/framework/*.hpp"
23+
)
24+
25+
add_library(detray_test_framework INTERFACE "${_detray_test_headers}")
26+
add_library(detray::test_framework ALIAS detray_test_framework)
27+
28+
target_include_directories(
29+
detray_test_framework
30+
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include"
31+
)
32+
33+
target_link_libraries(
34+
detray_test_framework
35+
INTERFACE GTest::gtest vecmem::core detray::core detray::detectors
36+
)
37+
38+
unset(_detray_test_headers)
39+
endif()
40+
41+
# Common test dependencies such as test detectors, B-fields and track generators
42+
# (depends on covfie)
1943
if(DETRAY_BUILD_TEST_UTILS)
44+
message(STATUS "Building 'detray::test_common' component")
45+
46+
file(
47+
GLOB _detray_test_common_headers
48+
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
49+
"include/detray/test/common/*.hpp"
50+
"include/detray/test/common/factories/*.hpp"
51+
"include/detray/test/common/event_generator/*.hpp"
52+
)
53+
54+
detray_add_library(detray_test_common test_common "${_detray_test_common_headers}")
55+
56+
target_link_libraries(
57+
detray_test_common
58+
INTERFACE vecmem::core covfie::core detray::core detray::detectors
59+
)
60+
61+
unset(_detray_test_common_headers)
62+
endif()
63+
64+
# Lightweight test utils library without external dependencies
65+
if(DETRAY_BUILD_TEST_UTILS OR DETRAY_BUILD_VALIDATION_TOOLS)
66+
message(STATUS "Building 'detray::test_utils' component")
67+
2068
file(
2169
GLOB _detray_test_utils_headers
2270
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
2371
"include/detray/test/utils/*.hpp"
24-
"include/detray/test/utils/detectors/*.hpp"
25-
"include/detray/test/utils/detectors/factories/*.hpp"
26-
"include/detray/test/utils/simulation/event_generator/*.hpp"
27-
"include/detray/test/utils/simulation/*.hpp"
2872
)
2973

3074
detray_add_library(detray_test_utils test_utils ${_detray_test_utils_headers})
31-
target_link_libraries(
32-
detray_test_utils
33-
INTERFACE vecmem::core detray::core detray::detectors
34-
)
75+
76+
target_link_libraries(detray_test_utils INTERFACE vecmem::core detray::core)
3577

3678
unset(_detray_test_utils_headers)
3779
endif()
3880

39-
# Build extended validation tools
81+
# Build extended validation tools (actsvg and csv depencies)
4082
if(DETRAY_BUILD_VALIDATION_TOOLS)
83+
message(STATUS "Building 'detray::validation_utils' component")
84+
4185
file(
4286
GLOB _detray_validation_headers
4387
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
4488
"include/detray/test/validation/*.hpp"
4589
)
4690

4791
detray_add_library(detray_validation_utils validation_utils ${_detray_validation_headers})
92+
4893
target_link_libraries(
4994
detray_validation_utils
5095
INTERFACE
@@ -58,33 +103,6 @@ if(DETRAY_BUILD_VALIDATION_TOOLS)
58103
unset(_detray_validation_headers)
59104
endif()
60105

61-
# Build the common (host and device) test library (mostly for integration tests)
62-
if(DETRAY_BUILD_TESTING)
63-
message(STATUS "Building 'detray::test_common' component")
64-
65-
file(
66-
GLOB _detray_test_headers
67-
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
68-
"include/detray/test/common/*.hpp"
69-
"include/detray/test/common/detail/*.hpp"
70-
)
71-
72-
add_library(detray_test_common INTERFACE "${_detray_test_headers}")
73-
add_library(detray::test_common ALIAS detray_test_common)
74-
75-
target_include_directories(
76-
detray_test_common
77-
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include"
78-
)
79-
80-
target_link_libraries(
81-
detray_test_common
82-
INTERFACE GTest::gtest vecmem::core detray::core detray::test_utils
83-
)
84-
85-
unset(_detray_test_headers)
86-
endif()
87-
88106
# Include all of the code-holding sub-directories.
89107

90108
# Build the benchmarks

tests/benchmarks/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ target_include_directories(
2828

2929
target_link_libraries(
3030
detray_benchmarks
31-
INTERFACE benchmark::benchmark vecmem::core detray::core detray::test_utils
31+
INTERFACE benchmark::benchmark vecmem::core detray::core detray::test_common
3232
)
3333

3434
unset(_detray_benchmarks_headers)

tests/benchmarks/cpu/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ macro(detray_add_cpu_benchmark algebra)
2424
"intersect_surfaces.cpp"
2525
"masks.cpp"
2626
LINK_LIBRARIES benchmark::benchmark benchmark::benchmark_main vecmem::core detray::benchmarks
27-
detray::core_${algebra} detray::test_utils
27+
detray::core_${algebra} detray::test_common
2828
)
2929

3030
target_compile_options(
@@ -51,7 +51,7 @@ macro(detray_add_cpu_benchmark algebra)
5151
detray_add_executable( benchmark_cpu_propagation_${algebra}
5252
"propagation.cpp"
5353
LINK_LIBRARIES detray::benchmark_cpu benchmark::benchmark_main
54-
vecmem::core detray::core_${algebra} detray::test_utils
54+
vecmem::core detray::core_${algebra} detray::test_common
5555
)
5656

5757
target_compile_options(
@@ -91,7 +91,7 @@ if(DETRAY_VC_SOA_PLUGIN)
9191
detray_add_executable(benchmark_cpu_vc_soa_vs_${algebra}
9292
"intersectors.cpp"
9393
LINK_LIBRARIES benchmark::benchmark benchmark::benchmark_main vecmem::core detray::core_vc_soa detray::core_vc_aos detray::core_${algebra}
94-
detray::test_utils
94+
detray::test_common
9595
)
9696

9797
target_compile_options(

tests/benchmarks/cpu/find_volume.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* Mozilla Public License Version 2.0
66
*/
77

8-
// Detray test include(s).
9-
#include "detray/test/utils/detectors/build_toy_detector.hpp"
10-
#include "detray/test/utils/types.hpp"
8+
// Detray test include(s)
9+
#include "detray/test/common/build_toy_detector.hpp"
10+
#include "detray/test/framework/types.hpp"
1111

1212
// VecMem include(s).
1313
#include <vecmem/memory/host_memory_resource.hpp>

tests/benchmarks/cpu/grid.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "detray/geometry/shapes/rectangle2D.hpp"
1515
#include "detray/utils/grid/detail/concepts.hpp"
1616

17-
// Detray test include(s).
18-
#include "detray/test/utils/types.hpp"
17+
// Detray test include(s)
18+
#include "detray/test/framework/types.hpp"
1919

2020
// VecMem include(s).
2121
#include <vecmem/memory/host_memory_resource.hpp>

tests/benchmarks/cpu/grid2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "detray/grids/populator.hpp"
1515
#include "detray/grids/serializer2.hpp"
1616

17-
// Detray test include(s).
18-
#include "detray/test/utils/types.hpp"
17+
// Detray test include(s)
18+
#include "detray/test/framework/types.hpp"
1919

2020
// VecMem include(s).
2121
#include <vecmem/memory/host_memory_resource.hpp>

tests/benchmarks/cpu/intersect_all.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include "detray/tracks/tracks.hpp"
1616
#include "detray/utils/ranges.hpp"
1717

18-
// Detray test include(s).
19-
#include "detray/test/utils/detectors/build_toy_detector.hpp"
20-
#include "detray/test/utils/simulation/event_generator/track_generators.hpp"
21-
#include "detray/test/utils/types.hpp"
18+
// Detray test include(s)
19+
#include "detray/test/common/build_toy_detector.hpp"
20+
#include "detray/test/common/track_generators.hpp"
21+
#include "detray/test/framework/types.hpp"
2222

2323
// Vecmem include(s)
2424
#include <vecmem/memory/host_memory_resource.hpp>

tests/benchmarks/cpu/intersect_surfaces.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#include "detray/navigation/intersection/ray_intersector.hpp"
1616
#include "detray/tracks/ray.hpp"
1717

18-
// Detray test include(s).
18+
// Detray test include(s)
19+
#include "detray/test/common/track_generators.hpp"
1920
#include "detray/test/utils/planes_along_direction.hpp"
20-
#include "detray/test/utils/simulation/event_generator/track_generators.hpp"
2121

2222
// Google Benchmark include(s)
2323
#include <benchmark/benchmark.h>

tests/benchmarks/cpu/intersectors.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
#include "detray/navigation/intersection/ray_intersector.hpp"
2121
#include "detray/tracks/ray.hpp"
2222

23-
// Detray test include(s).
23+
// Detray test include(s)
24+
#include "detray/test/common/track_generators.hpp"
25+
#include "detray/test/framework/types.hpp"
2426
#include "detray/test/utils/planes_along_direction.hpp"
25-
#include "detray/test/utils/simulation/event_generator/track_generators.hpp"
26-
#include "detray/test/utils/types.hpp"
2727

2828
// Google Benchmark include(s)
2929
#include <benchmark/benchmark.h>

tests/benchmarks/cpu/masks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "detray/geometry/shapes.hpp"
1717
#include "detray/navigation/intersection/intersection.hpp"
1818

19-
// Detray test include(s).
20-
#include "detray/test/utils/types.hpp"
19+
// Detray test include(s)
20+
#include "detray/test/framework/types.hpp"
2121

2222
// Google benchmark include(s).
2323
#include <benchmark/benchmark.h>

0 commit comments

Comments
 (0)