From d6bd7ae81f0f9c12fff750ebe8a357163cd31c12 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:41:11 +0200 Subject: [PATCH 1/3] DPL tests: drop unneeded includes --- Framework/Core/test/test_HTTPParser.cxx | 2 -- Framework/Core/test/test_Parallel.cxx | 2 -- Framework/Core/test/test_RegionInfoCallbackService.cxx | 7 ------- Framework/Core/test/test_Services.cxx | 2 -- Framework/Core/test/test_TimePipeline.cxx | 6 ++---- 5 files changed, 2 insertions(+), 17 deletions(-) diff --git a/Framework/Core/test/test_HTTPParser.cxx b/Framework/Core/test/test_HTTPParser.cxx index b2889f9f305e1..1b87fcf49cfd4 100644 --- a/Framework/Core/test/test_HTTPParser.cxx +++ b/Framework/Core/test/test_HTTPParser.cxx @@ -9,8 +9,6 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include - #include "../src/HTTPParser.h" #include diff --git a/Framework/Core/test/test_Parallel.cxx b/Framework/Core/test/test_Parallel.cxx index 7967f55a7b93d..35b8a52e663a1 100644 --- a/Framework/Core/test/test_Parallel.cxx +++ b/Framework/Core/test/test_Parallel.cxx @@ -17,8 +17,6 @@ #include "Framework/ParallelContext.h" #include "Framework/runDataProcessing.h" -#include - using namespace o2::framework; struct FakeCluster { diff --git a/Framework/Core/test/test_RegionInfoCallbackService.cxx b/Framework/Core/test/test_RegionInfoCallbackService.cxx index f0e7160bcfaad..178d6048545e6 100644 --- a/Framework/Core/test/test_RegionInfoCallbackService.cxx +++ b/Framework/Core/test/test_RegionInfoCallbackService.cxx @@ -8,19 +8,12 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include - -#include "Framework/InputSpec.h" #include "Framework/CallbackService.h" #include "Framework/ControlService.h" #include "Framework/DataProcessorSpec.h" -#include "Framework/ParallelContext.h" #include "Framework/runDataProcessing.h" #include "Framework/Logger.h" -#include -#include - using namespace o2::framework; using DataHeader = o2::header::DataHeader; diff --git a/Framework/Core/test/test_Services.cxx b/Framework/Core/test/test_Services.cxx index 056a3d0d9b6c4..abac9eca5e9b0 100644 --- a/Framework/Core/test/test_Services.cxx +++ b/Framework/Core/test/test_Services.cxx @@ -8,8 +8,6 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include - #include "Framework/ServiceHandle.h" #include "Framework/ServiceRegistry.h" #include "Framework/CallbackService.h" diff --git a/Framework/Core/test/test_TimePipeline.cxx b/Framework/Core/test/test_TimePipeline.cxx index 8740f2ba365cd..5ff3eeae5e6cf 100644 --- a/Framework/Core/test/test_TimePipeline.cxx +++ b/Framework/Core/test/test_TimePipeline.cxx @@ -8,13 +8,11 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/InputSpec.h" + #include "Framework/DataProcessorSpec.h" #include "Framework/ParallelContext.h" #include "Framework/runDataProcessing.h" - -#include - +#include #include using namespace o2::framework; From a2b3223ceef4af742b03810ee940d5c8769705bb Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:41:11 +0200 Subject: [PATCH 2/3] DPL: drop more boost_test usage --- Framework/Core/CMakeLists.txt | 13 ++++++++----- Framework/Core/test/test_InfoLogger.cxx | 10 +++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Framework/Core/CMakeLists.txt b/Framework/Core/CMakeLists.txt index d69194c83285e..f24ac6387649e 100644 --- a/Framework/Core/CMakeLists.txt +++ b/Framework/Core/CMakeLists.txt @@ -315,11 +315,14 @@ set_property(TARGET o2-test-framework-root PROPERTY RUNTIME_OUTPUT_DIRECTORY ${o add_test(NAME framework:root COMMAND o2-test-framework-root --skip-benchmarks) add_test(NAME framework:crash COMMAND sh -e -c "PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$PATH ${CMAKE_CURRENT_LIST_DIR}/test/test_AllCrashTypes.sh") -o2_add_test(InfoLogger NAME test_Framework_test_InfoLogger - SOURCES test/test_InfoLogger.cxx - COMPONENT_NAME Framework - LABELS framework - PUBLIC_LINK_LIBRARIES O2::Framework AliceO2::InfoLogger) +add_executable(o2-test-framework-infologger + test/test_InfoLogger.cxx) +target_link_libraries(o2-test-framework-infologger PRIVATE O2::Framework) +target_link_libraries(o2-test-framework-infologger PRIVATE AliceO2::InfoLogger) +target_link_libraries(o2-test-framework-infologger PRIVATE O2::Catch2) +set_property(TARGET o2-test-framework-infologger + PROPERTY RUNTIME_OUTPUT_DIRECTORY ${outdir}) +add_test(NAME framework:infologger COMMAND o2-test-framework-infologger) o2_add_executable(dpl-null-sink SOURCES src/o2NullSink.cxx diff --git a/Framework/Core/test/test_InfoLogger.cxx b/Framework/Core/test/test_InfoLogger.cxx index 4fde33c8775d7..b3a4e794bdcd4 100644 --- a/Framework/Core/test/test_InfoLogger.cxx +++ b/Framework/Core/test/test_InfoLogger.cxx @@ -8,16 +8,12 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#define BOOST_TEST_MODULE Test Framework InfoLoggerTest -#define BOOST_TEST_MAIN -#define BOOST_TEST_DYN_LINK - -#include +#include #include using namespace AliceO2::InfoLogger; -BOOST_AUTO_TEST_CASE(InfoLoggerTest) +TEST_CASE("InfoLoggerTest") { // define infologger output to stdout, as we don't want to use the default infoLoggerD pipe which might not be running here @@ -27,5 +23,5 @@ BOOST_AUTO_TEST_CASE(InfoLoggerTest) InfoLogger theLog; // log a test message - BOOST_CHECK(theLog.log("This is a log message test to stdout") == 0); + CHECK(theLog.log("This is a log message test to stdout") == 0); } From 9edf987c86730333081fea132fe6629d64b0e1b5 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:41:11 +0200 Subject: [PATCH 3/3] DPL CCDB: move helper initialisation to a separate function --- Framework/CCDBSupport/src/CCDBHelpers.cxx | 97 ++++++++++++----------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/Framework/CCDBSupport/src/CCDBHelpers.cxx b/Framework/CCDBSupport/src/CCDBHelpers.cxx index 71b6282c80086..2d44469c641f4 100644 --- a/Framework/CCDBSupport/src/CCDBHelpers.cxx +++ b/Framework/CCDBSupport/src/CCDBHelpers.cxx @@ -20,10 +20,8 @@ #include "CCDB/CcdbApi.h" #include "CommonConstants/LHCConstants.h" #include "Framework/Signpost.h" -#include #include #include -#include O2_DECLARE_DYNAMIC_LOG(ccdb); @@ -159,6 +157,55 @@ CCDBHelpers::ParserResult CCDBHelpers::parseRemappings(char const* str) } } +void initialiseHelper(CCDBFetcherHelper& helper, ConfigParamRegistry const& options, std::vector const& outputRoutes) +{ + std::unordered_map accountedSpecs; + auto defHost = options.get("condition-backend"); + auto checkRate = options.get("condition-tf-per-query"); + auto checkMult = options.get("condition-tf-per-query-multiplier"); + helper.timeToleranceMS = options.get("condition-time-tolerance"); + helper.queryPeriodGlo = checkRate > 0 ? checkRate : std::numeric_limits::max(); + helper.queryPeriodFactor = checkMult > 0 ? checkMult : 1; + LOGP(info, "CCDB Backend at: {}, validity check for every {} TF{}", defHost, helper.queryPeriodGlo, helper.queryPeriodFactor == 1 ? std::string{} : fmt::format(", (query for high-rate objects downscaled by {})", helper.queryPeriodFactor)); + LOGP(info, "Hook to enable signposts for CCDB messages at {}", (void*)&private_o2_log_ccdb->stacktrace); + auto remapString = options.get("condition-remap"); + CCDBHelpers::ParserResult result = CCDBHelpers::parseRemappings(remapString.c_str()); + if (!result.error.empty()) { + throw runtime_error_f("Error while parsing remapping string %s", result.error.c_str()); + } + helper.remappings = result.remappings; + helper.apis[""].init(defHost); // default backend + LOGP(info, "Initialised default CCDB host {}", defHost); + // + for (auto& entry : helper.remappings) { // init api instances for every host seen in the remapping + if (helper.apis.find(entry.second) == helper.apis.end()) { + helper.apis[entry.second].init(entry.second); + LOGP(info, "Initialised custom CCDB host {}", entry.second); + } + LOGP(info, "{} is remapped to {}", entry.first, entry.second); + } + helper.createdNotBefore = std::to_string(options.get("condition-not-before")); + helper.createdNotAfter = std::to_string(options.get("condition-not-after")); + + for (auto& route : outputRoutes) { + if (route.matcher.lifetime != Lifetime::Condition) { + continue; + } + auto specStr = DataSpecUtils::describe(route.matcher); + if (accountedSpecs.find(specStr) != accountedSpecs.end()) { + continue; + } + accountedSpecs[specStr] = true; + helper.routes.push_back(route); + LOGP(info, "The following route is a condition {}", DataSpecUtils::describe(route.matcher)); + for (auto& metadata : route.matcher.metadata) { + if (metadata.type == VariantType::String) { + LOGP(info, "- {}: {}", metadata.name, metadata.defaultValue.asString()); + } + } + } +} + auto getOrbitResetTime(std::pmr::vector const& v) -> Long64_t { Int_t previousErrorLevel = gErrorIgnoreLevel; @@ -307,51 +354,7 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB() { return adaptStateful([](CallbackService& callbacks, ConfigParamRegistry const& options, DeviceSpec const& spec) { std::shared_ptr helper = std::make_shared(); - std::unordered_map accountedSpecs; - auto defHost = options.get("condition-backend"); - auto checkRate = options.get("condition-tf-per-query"); - auto checkMult = options.get("condition-tf-per-query-multiplier"); - helper->timeToleranceMS = options.get("condition-time-tolerance"); - helper->queryPeriodGlo = checkRate > 0 ? checkRate : std::numeric_limits::max(); - helper->queryPeriodFactor = checkMult > 0 ? checkMult : 1; - LOGP(info, "CCDB Backend at: {}, validity check for every {} TF{}", defHost, helper->queryPeriodGlo, helper->queryPeriodFactor == 1 ? std::string{} : fmt::format(", (query for high-rate objects downscaled by {})", helper->queryPeriodFactor)); - LOGP(info, "Hook to enable signposts for CCDB messages at {}", (void*)&private_o2_log_ccdb->stacktrace); - auto remapString = options.get("condition-remap"); - ParserResult result = CCDBHelpers::parseRemappings(remapString.c_str()); - if (!result.error.empty()) { - throw runtime_error_f("Error while parsing remapping string %s", result.error.c_str()); - } - helper->remappings = result.remappings; - helper->apis[""].init(defHost); // default backend - LOGP(info, "Initialised default CCDB host {}", defHost); - // - for (auto& entry : helper->remappings) { // init api instances for every host seen in the remapping - if (helper->apis.find(entry.second) == helper->apis.end()) { - helper->apis[entry.second].init(entry.second); - LOGP(info, "Initialised custom CCDB host {}", entry.second); - } - LOGP(info, "{} is remapped to {}", entry.first, entry.second); - } - helper->createdNotBefore = std::to_string(options.get("condition-not-before")); - helper->createdNotAfter = std::to_string(options.get("condition-not-after")); - - for (auto &route : spec.outputs) { - if (route.matcher.lifetime != Lifetime::Condition) { - continue; - } - auto specStr = DataSpecUtils::describe(route.matcher); - if (accountedSpecs.find(specStr) != accountedSpecs.end()) { - continue; - } - accountedSpecs[specStr] = true; - helper->routes.push_back(route); - LOGP(info, "The following route is a condition {}", DataSpecUtils::describe(route.matcher)); - for (auto& metadata : route.matcher.metadata) { - if (metadata.type == VariantType::String) { - LOGP(info, "- {}: {}", metadata.name, metadata.defaultValue.asString()); - } - } - } + initialiseHelper(*helper, options, spec.outputs); /// Add a callback on stop which dumps the statistics for the caching per /// path callbacks.set([helper]() {