Skip to content

Commit 6e8b562

Browse files
authored
DPL: cleanup creation of DataProcessorInfo (#14096)
- Use aggregate initialisation where possible - Drop unused bits Will simplify the plugins PR.
1 parent 97aeb5f commit 6e8b562

File tree

5 files changed

+32
-34
lines changed

5 files changed

+32
-34
lines changed

Framework/Core/test/test_DataAllocator.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ DataProcessorSpec getSourceSpec()
7373
{
7474
static_assert(enable_root_serialization<o2::test::Polymorphic>::value, "enable_root_serialization<o2::test::Polymorphic> must be true");
7575
auto processingFct = [](ProcessingContext& pc) {
76-
static int counter = 0;
7776
o2::test::TriviallyCopyable a(42, 23, 0xdead);
7877
o2::test::Polymorphic b(0xbeef);
7978
std::vector<o2::test::Polymorphic> c{{0xaffe}, {0xd00f}};

Framework/Core/test/test_DeviceSpecHelpers.cxx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "Framework/DriverConfig.h"
1717
#include "../src/DeviceSpecHelpers.h"
1818
#include <catch_amalgamated.hpp>
19-
#include <algorithm>
2019
#include <sstream>
2120
#include <cstring>
2221
#include <vector>
@@ -67,10 +66,10 @@ void check(const std::vector<std::string>& arguments,
6766
std::vector<DataProcessorInfo> dataProcessorInfos;
6867
for (auto& [name, _] : matrix) {
6968
dataProcessorInfos.push_back(DataProcessorInfo{
70-
name,
71-
"executable-name",
72-
arguments,
73-
workflowOptions,
69+
.name = name,
70+
.executable = "executable-name",
71+
.cmdLineArgs = arguments,
72+
.workflowOptions = workflowOptions,
7473
});
7574
}
7675
DriverConfig driverConfig{};
@@ -184,38 +183,38 @@ TEST_CASE("CheckOptionReworking")
184183
{
185184
{
186185
std::vector<DataProcessorInfo> infos = {
187-
{{}, {}, {"--driver-client-backend", "foo"}},
186+
{.cmdLineArgs = {"--driver-client-backend", "foo"}},
188187
{}};
189188
DeviceSpecHelpers::reworkHomogeneousOption(infos, "--driver-client-backend", "stdout://");
190189
REQUIRE(infos[0].cmdLineArgs[1] == "foo");
191190
REQUIRE(infos[1].cmdLineArgs[1] == "foo");
192191
}
193192
{
194193
std::vector<DataProcessorInfo> infos = {
195-
{{}, {}, {"--driver-client-backend", "foo"}},
196-
{{}, {}, {"--driver-client-backend", "bar"}}};
194+
{.cmdLineArgs = {"--driver-client-backend", "foo"}},
195+
{.cmdLineArgs = {"--driver-client-backend", "bar"}}};
197196
REQUIRE_THROWS_AS(DeviceSpecHelpers::reworkHomogeneousOption(infos, "--driver-client-backend", "stdout://"), o2::framework::RuntimeErrorRef);
198197
}
199198
{
200199
std::vector<DataProcessorInfo> infos = {
201-
{{}, {}, {"--driver-client-backend", "foo"}},
202-
{{}, {}, {"--driver-client-backend", "foo"}}};
200+
{.cmdLineArgs = {"--driver-client-backend", "foo"}},
201+
{.cmdLineArgs = {"--driver-client-backend", "foo"}}};
203202
DeviceSpecHelpers::reworkHomogeneousOption(infos, "--driver-client-backend", "stdout://");
204203
REQUIRE(infos[0].cmdLineArgs[1] == "foo");
205204
REQUIRE(infos[1].cmdLineArgs[1] == "foo");
206205
}
207206
{
208207
std::vector<DataProcessorInfo> infos = {
209-
{{}, {}, {"foo", "bar"}},
210-
{{}, {}, {"fnjcnak", "foo"}}};
208+
{.cmdLineArgs = {"foo", "bar"}},
209+
{.cmdLineArgs = {"fnjcnak", "foo"}}};
211210
DeviceSpecHelpers::reworkHomogeneousOption(infos, "--driver-client-backend", "stdout://");
212211
REQUIRE(infos[0].cmdLineArgs[3] == "stdout://");
213212
REQUIRE(infos[1].cmdLineArgs[3] == "stdout://");
214213
}
215214
{
216215
std::vector<DataProcessorInfo> infos = {
217-
{{}, {}, {"foo", "bar", "--driver-client-backend", "bar"}},
218-
{{}, {}, {"fnjcnak", "foo"}}};
216+
{.cmdLineArgs = {"foo", "bar", "--driver-client-backend", "bar"}},
217+
{.cmdLineArgs = {"fnjcnak", "foo"}}};
219218
DeviceSpecHelpers::reworkHomogeneousOption(infos, "--driver-client-backend", "stdout://");
220219
REQUIRE(infos[0].cmdLineArgs[3] == "bar");
221220
REQUIRE(infos[1].cmdLineArgs[3] == "bar");
@@ -277,8 +276,8 @@ TEST_CASE("CheckIntegerReworking")
277276
}
278277
{
279278
std::vector<DataProcessorInfo> infos = {
280-
{{}, {}, {"foo", "bar", "--readers", "3"}},
281-
{{}, {}, {"--readers", "2"}}};
279+
{.cmdLineArgs = {"foo", "bar", "--readers", "3"}},
280+
{.cmdLineArgs = {"--readers", "2"}}};
282281
DeviceSpecHelpers::reworkIntegerOption(
283282
infos, "--readers", []() { return 1; }, 1, [](long long x, long long y) { return x > y ? x : y; });
284283
REQUIRE(infos[0].cmdLineArgs.size() == 4);

Framework/Core/test/test_FrameworkDataFlowToDDS.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ TEST_CASE("TestDDS")
142142

143143
std::vector<DataProcessorInfo> dataProcessorInfos = {
144144
{
145-
{"A", "bcsadc/foo", {}, workflowOptions},
146-
{"B", "foo", {}, workflowOptions},
147-
{"C", "foo", {}, workflowOptions},
148-
{"D", "foo", {}, workflowOptions},
145+
{.name = "A", .executable = "bcsadc/foo", .workflowOptions = workflowOptions},
146+
{.name = "B", .executable = "foo", .workflowOptions = workflowOptions},
147+
{.name = "C", .executable = "foo", .workflowOptions = workflowOptions},
148+
{.name = "D", .executable = "foo", .workflowOptions = workflowOptions},
149149
}};
150150
DriverConfig driverConfig = {
151151
.batch = true,
@@ -406,10 +406,10 @@ TEST_CASE("TestDDSExpendable")
406406

407407
std::vector<DataProcessorInfo> dataProcessorInfos = {
408408
{
409-
{"A", "bcsadc/foo", {}, workflowOptions},
410-
{"B", "foo", {}, workflowOptions},
411-
{"C", "foo", {}, workflowOptions},
412-
{"D", "foo", {}, workflowOptions},
409+
{.name = "A", .executable = "bcsadc/foo", .workflowOptions = workflowOptions},
410+
{.name = "B", .executable = "foo", .workflowOptions = workflowOptions},
411+
{.name = "C", .executable = "foo", .workflowOptions = workflowOptions},
412+
{.name = "D", .executable = "foo", .workflowOptions = workflowOptions},
413413
}};
414414
DriverConfig driverConfig = {
415415
.batch = true,

Framework/Core/test/test_FrameworkDataFlowToO2Control.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,10 @@ TEST_CASE("TestO2ControlDump")
561561

562562
std::vector<DataProcessorInfo> dataProcessorInfos = {
563563
{
564-
{"A", "bcsadc/foo", {}, workflowOptions},
565-
{"B", "foo", {}, workflowOptions},
566-
{"C", "foo", {}, workflowOptions},
567-
{"D", "foo", {}, workflowOptions},
564+
{.name = "A", .executable = "bcsadc/foo", .workflowOptions = workflowOptions},
565+
{.name = "B", .executable = "foo", .workflowOptions = workflowOptions},
566+
{.name = "C", .executable = "foo", .workflowOptions = workflowOptions},
567+
{.name = "D", .executable = "foo", .workflowOptions = workflowOptions},
568568
}};
569569

570570
DriverConfig driverConfig{

Framework/Core/test/test_WorkflowSerialization.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ TEST_CASE("TestVerifyWorkflowSerialization")
5252
{{"key1", "v\"al'1"}, {"", "val2"}, {"key3", ""}, {"", ""}}}};
5353

5454
std::vector<DataProcessorInfo> dataProcessorInfoOut{
55-
{"A", "test_Framework_test_SerializationWorkflow", {"foo"}, {ConfigParamSpec{"aBool", VariantType::Bool, true, {"A Bool"}}}},
56-
{"B", "test_Framework_test_SerializationWorkflow", {"b-bar", "bfoof", "fbdbfaso"}},
57-
{"C", "test_Framework_test_SerializationWorkflow", {}},
58-
{"D", "test_Framework_test_SerializationWorkflow", {}},
55+
{.name = "A", .executable = "test_Framework_test_SerializationWorkflow", .cmdLineArgs = {"foo"}, .workflowOptions = {ConfigParamSpec{"aBool", VariantType::Bool, true, {"A Bool"}}}},
56+
{.name = "B", .executable = "test_Framework_test_SerializationWorkflow", .cmdLineArgs = {"b-bar", "bfoof", "fbdbfaso"}},
57+
{.name = "C", .executable = "test_Framework_test_SerializationWorkflow"},
58+
{.name = "D", .executable = "test_Framework_test_SerializationWorkflow"},
5959
};
6060

6161
CommandInfo commandInfoOut{"o2-dpl-workflow -b --option 1 --option 2"};
@@ -94,7 +94,7 @@ TEST_CASE("TestVerifyWildcard")
9494
}};
9595

9696
std::vector<DataProcessorInfo> dataProcessorInfoOut{
97-
{"A", "test_Framework_test_SerializationWorkflow", {}},
97+
{.name = "A", .executable = "test_Framework_test_SerializationWorkflow"},
9898
};
9999

100100
CommandInfo commandInfoOut{"o2-dpl-workflow -b --option 1 --option 2"};

0 commit comments

Comments
 (0)