Skip to content

Commit f7a922b

Browse files
authored
Merge d7fc45c into sapling-pr-archive-ktf
2 parents 0a56c3c + d7fc45c commit f7a922b

6 files changed

Lines changed: 63 additions & 57 deletions

File tree

Framework/Core/CMakeLists.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ o2_add_library(Framework
160160
src/DPLWebSocket.cxx
161161
src/StatusWebSocketHandler.cxx
162162
src/TimerParamSpec.cxx
163-
test/TestClasses.cxx
164163
TARGETVARNAME targetName
165164
PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/src
166165
PUBLIC_LINK_LIBRARIES AliceO2::Configuration
@@ -189,9 +188,16 @@ o2_add_library(Framework
189188
target_include_directories(${targetName} PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/DataFormats/simulation/include>)
190189

191190
o2_target_root_dictionary(Framework
191+
HEADERS include/Framework/StepTHn.h
192+
LINKDEF src/StepTHnLinkDef.h)
193+
194+
# o2::test::* support classes for unit tests, kept out of production libO2Framework.
195+
o2_add_library(FrameworkTestSupport
196+
SOURCES test/TestClasses.cxx
197+
PUBLIC_LINK_LIBRARIES O2::Framework)
198+
o2_target_root_dictionary(FrameworkTestSupport
192199
HEADERS test/TestClasses.h
193-
include/Framework/StepTHn.h
194-
LINKDEF test/FrameworkCoreTestLinkDef.h)
200+
LINKDEF test/TestClassesLinkDef.h)
195201

196202
add_executable(o2-test-framework-core
197203
test/test_AlgorithmSpec.cxx
@@ -268,6 +274,7 @@ add_executable(o2-test-framework-core
268274
test/unittest_DataSpecUtils.cxx
269275
)
270276
target_link_libraries(o2-test-framework-core PRIVATE O2::Framework)
277+
target_link_libraries(o2-test-framework-core PRIVATE O2::FrameworkTestSupport)
271278
target_link_libraries(o2-test-framework-core PRIVATE O2::Catch2)
272279

273280
get_filename_component(outdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../tests ABSOLUTE)
@@ -374,7 +381,6 @@ foreach(w
374381
RegionInfoCallbackService
375382
DanglingInputs
376383
DanglingOutputs
377-
DataAllocator
378384
StaggeringWorkflow
379385
Forwarding
380386
ParallelPipeline
@@ -403,6 +409,15 @@ foreach(w
403409
COMMAND_LINE_ARGS ${DPL_WORKFLOW_TESTS_EXTRA_OPTIONS} --run --shm-segment-size 20000000)
404410
endforeach()
405411

412+
o2_add_test(DataAllocator NAME test_Framework_test_DataAllocator
413+
SOURCES test/test_DataAllocator.cxx
414+
COMPONENT_NAME Framework
415+
LABELS framework workflow
416+
PUBLIC_LINK_LIBRARIES O2::Framework O2::FrameworkTestSupport
417+
TIMEOUT 30
418+
NO_BOOST_TEST
419+
COMMAND_LINE_ARGS ${DPL_WORKFLOW_TESTS_EXTRA_OPTIONS} --run --shm-segment-size 20000000)
420+
406421
if (BUILD_TESTING)
407422
# TODO: DanglingInput test not working for the moment [ERROR] Unable to relay
408423
# part. [WARN] Incoming data is already obsolete, not relaying.

Framework/Core/include/Framework/HistogramRegistry.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@
1313
#define FRAMEWORK_HISTOGRAMREGISTRY_H_
1414

1515
#include "Framework/HistogramSpec.h"
16-
#include "Framework/ASoA.h"
17-
#include "Framework/FunctionalHelpers.h"
18-
#include "Framework/Logger.h"
1916
#include "Framework/OutputRef.h"
2017
#include "Framework/OutputObjHeader.h"
2118
#include "Framework/OutputSpec.h"
22-
#include "Framework/SerializationMethods.h"
23-
#include "Framework/TableBuilder.h"
2419
#include "Framework/RuntimeError.h"
20+
#include "Framework/Expressions.h"
2521
#include "StepTHn.h"
2622

2723
#include <TDataMember.h>
@@ -294,20 +290,14 @@ void HistFiller::fillHistAny(std::shared_ptr<T> hist, Ts... positionAndWeight)
294290
}
295291

296292
template <typename... Cs, typename R, typename T>
297-
void HistFiller::fillHistAny(std::shared_ptr<R> hist, const T& table, const o2::framework::expressions::Filter& filter)
293+
void HistFiller::fillHistAny(std::shared_ptr<R>, const T&, const o2::framework::expressions::Filter&)
298294
requires(!ValidComplexFillStep<R, sizeof...(Cs)>) && requires(T t) { t.asArrowTable(); }
299295
{
300-
auto s = o2::framework::expressions::createSelection(table.asArrowTable(), filter);
301-
auto filtered = o2::soa::Filtered<T>{{table.asArrowTable()}, s};
302-
for (auto& t : filtered) {
303-
fillHistAny(hist, (*(static_cast<Cs>(t).getIterator()))...);
304-
}
305296
}
306297

307298
template <typename... Cs, typename R, typename T>
308-
void HistFiller::fillHistAny(std::shared_ptr<R> hist, const T& table, const o2::framework::expressions::Filter& filter)
299+
void HistFiller::fillHistAny(std::shared_ptr<R>, const T&, const o2::framework::expressions::Filter&)
309300
{
310-
HistFiller::badHistogramFill(hist->GetName());
311301
}
312302

313303
template <typename T>
@@ -485,6 +475,5 @@ void HistogramRegistry::fill(const HistName& histName, const T& table, const o2:
485475
{
486476
std::visit([&table, &filter](auto&& hist) { HistFiller::fillHistAny<Cs...>(hist, table, filter); }, mRegistryValue[getHistIndex(histName)]);
487477
}
488-
489478
} // namespace o2::framework
490479
#endif // FRAMEWORK_HISTOGRAMREGISTRY_H_

Framework/Core/src/HistogramRegistry.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "Framework/HistogramRegistry.h"
13+
#include "Framework/ASoA.h"
1314
#include <regex>
1415
#include <TList.h>
1516
#include <TClass.h>

Framework/Core/test/benchmark_HistogramRegistry.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "Framework/HistogramRegistry.h"
13-
#include "Framework/Logger.h"
1413

1514
#include "TList.h"
1615

@@ -19,7 +18,6 @@
1918

2019
using namespace o2::framework;
2120
using namespace arrow;
22-
using namespace o2::soa;
2321

2422
/// Number of lookups to perform
2523
const int nLookups = 100000;

Framework/Core/test/test_HistogramRegistry.cxx

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "Framework/HistogramRegistry.h"
13+
#include "Framework/ASoA.h"
14+
#include "Framework/TableBuilder.h"
1315
#include <catch_amalgamated.hpp>
1416

1517
using namespace o2;
@@ -70,40 +72,41 @@ TEST_CASE("HistogramRegistryLookup")
7072
*/
7173
}
7274

73-
TEST_CASE("HistogramRegistryExpressionFill")
74-
{
75-
TableBuilder builderA;
76-
auto rowWriterA = builderA.persist<float, float>({"x", "y"});
77-
rowWriterA(0, 0.0f, -2.0f);
78-
rowWriterA(0, 1.0f, -4.0f);
79-
rowWriterA(0, 2.0f, -1.0f);
80-
rowWriterA(0, 3.0f, -5.0f);
81-
rowWriterA(0, 4.0f, 0.0f);
82-
rowWriterA(0, 5.0f, -9.0f);
83-
rowWriterA(0, 6.0f, -7.0f);
84-
rowWriterA(0, 7.0f, -4.0f);
85-
auto tableA = builderA.finalize();
86-
REQUIRE(tableA->num_rows() == 8);
87-
using TestA = o2::soa::InPlaceTable<"A/1"_h, o2::soa::Index<>, test::X, test::Y>;
88-
TestA tests{tableA};
89-
REQUIRE(8 == tests.size());
90-
91-
/// Construct a registry object with direct declaration
92-
HistogramRegistry registry{
93-
"registry", {
94-
{"x", "test x", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, //
95-
{"xy", "test xy", {HistType::kTH2F, {{100, -10.0f, 10.01f}, {100, -10.0f, 10.01f}}}} //
96-
} //
97-
};
98-
99-
/// Fill histogram with expression and table
100-
registry.fill<test::X>(HIST("x"), tests, test::x > 3.0f);
101-
REQUIRE(registry.get<TH1>(HIST("x"))->GetEntries() == 4);
102-
103-
/// Fill histogram with expression and table
104-
registry.fill<test::X, test::Y>(HIST("xy"), tests, test::x > 3.0f && test::y > -5.0f);
105-
REQUIRE(registry.get<TH2>(HIST("xy"))->GetEntries() == 2);
106-
}
75+
// FIXME: feature not used in its current state, requires rework
76+
// TEST_CASE("HistogramRegistryExpressionFill")
77+
// {
78+
// TableBuilder builderA;
79+
// auto rowWriterA = builderA.persist<float, float>({"x", "y"});
80+
// rowWriterA(0, 0.0f, -2.0f);
81+
// rowWriterA(0, 1.0f, -4.0f);
82+
// rowWriterA(0, 2.0f, -1.0f);
83+
// rowWriterA(0, 3.0f, -5.0f);
84+
// rowWriterA(0, 4.0f, 0.0f);
85+
// rowWriterA(0, 5.0f, -9.0f);
86+
// rowWriterA(0, 6.0f, -7.0f);
87+
// rowWriterA(0, 7.0f, -4.0f);
88+
// auto tableA = builderA.finalize();
89+
// REQUIRE(tableA->num_rows() == 8);
90+
// using TestA = o2::soa::InPlaceTable<"A/1"_h, o2::soa::Index<>, test::X, test::Y>;
91+
// TestA tests{tableA};
92+
// REQUIRE(8 == tests.size());
93+
94+
// /// Construct a registry object with direct declaration
95+
// HistogramRegistry registry{
96+
// "registry", {
97+
// {"x", "test x", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, //
98+
// {"xy", "test xy", {HistType::kTH2F, {{100, -10.0f, 10.01f}, {100, -10.0f, 10.01f}}}} //
99+
// } //
100+
// };
101+
102+
// /// Fill histogram with expression and table
103+
// registry.fill<test::X>(HIST("x"), tests, test::x > 3.0f);
104+
// REQUIRE(registry.get<TH1>(HIST("x"))->GetEntries() == 4);
105+
106+
// /// Fill histogram with expression and table
107+
// registry.fill<test::X, test::Y>(HIST("xy"), tests, test::x > 3.0f && test::y > -5.0f);
108+
// REQUIRE(registry.get<TH2>(HIST("xy"))->GetEntries() == 2);
109+
// }
107110

108111
TEST_CASE("HistogramRegistryStepTHn")
109112
{

Framework/Utils/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ o2_add_executable(output-proxy
3434
o2_add_test(RootTreeWriterWorkflow
3535
NO_BOOST_TEST
3636
SOURCES test/test_RootTreeWriterWorkflow.cxx
37-
PUBLIC_LINK_LIBRARIES O2::DPLUtils
37+
PUBLIC_LINK_LIBRARIES O2::DPLUtils O2::FrameworkTestSupport
3838
COMPONENT_NAME DPLUtils
3939
LABELS dplutils
4040
COMMAND_LINE_ARGS ${DPL_WORKFLOW_TESTS_EXTRA_OPTIONS} --run)
4141

4242
o2_add_test(RootTreeReader
4343
NO_BOOST_TEST
4444
SOURCES test/test_RootTreeReader.cxx
45-
PUBLIC_LINK_LIBRARIES O2::DPLUtils
45+
PUBLIC_LINK_LIBRARIES O2::DPLUtils O2::FrameworkTestSupport
4646
COMPONENT_NAME DPLUtils
4747
LABELS dplutils
4848
COMMAND_LINE_ARGS ${DPL_WORKFLOW_TESTS_EXTRA_OPTIONS} --run)
@@ -53,7 +53,7 @@ add_executable(o2-test-framework-utils
5353
test/test_DPLRawParser.cxx
5454
test/test_DPLRawPageSequencer.cxx
5555
)
56-
target_link_libraries(o2-test-framework-utils PRIVATE O2::Framework O2::DPLUtils O2::DetectorsRaw)
56+
target_link_libraries(o2-test-framework-utils PRIVATE O2::Framework O2::DPLUtils O2::DetectorsRaw O2::FrameworkTestSupport)
5757
target_link_libraries(o2-test-framework-utils PRIVATE O2::Catch2)
5858

5959
get_filename_component(outdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../tests ABSOLUTE)

0 commit comments

Comments
 (0)