@@ -656,3 +656,90 @@ BOOST_AUTO_TEST_CASE(TestTopologyLayeredTimePipeline)
656656 BOOST_CHECK_EQUAL (devices[5 ].inputChannels [2 ].port , 22008 );
657657 BOOST_REQUIRE_EQUAL (devices[5 ].outputChannels .size (), 0 );
658658}
659+
660+ // Test the case in which we have one source with two
661+ // description and a wildcard for both description and
662+ // subspec on the receiving side:
663+ //
664+ // A/1
665+ // \ B
666+ // /
667+ // A/2
668+ WorkflowSpec defineDataProcessing8 ()
669+ {
670+ return {
671+ {" A" , Inputs{InputSpec{" timer" , " DPL" , " TIMER" , 0 , Lifetime::Timer}}, {OutputSpec{" A" , " 1" }, OutputSpec{" A" , " 2" }}},
672+ {" B" , {InputSpec{" x" , DataSpecUtils::dataDescriptorMatcherFrom (o2::header::DataOrigin{" A" })}}},
673+ {" internal-dpl-timer" , {}, {OutputSpec{" DPL" , " TIMER" , 0 , Lifetime::Timer}}}};
674+ }
675+ BOOST_AUTO_TEST_CASE (TestSimpleWildcard)
676+ {
677+ auto workflow = defineDataProcessing8 ();
678+ SimpleResourceManager rm (22000 , 1000 );
679+ auto resources = rm.getAvailableResources ();
680+ auto channelPolicies = ChannelConfigurationPolicy::createDefaultPolicies ();
681+
682+ std::vector<DeviceSpec> devices;
683+ std::vector<DeviceId> deviceIndex;
684+ std::vector<DeviceConnectionId> connections;
685+ std::vector<LogicalForwardInfo> availableForwardsInfo;
686+
687+ std::vector<OutputSpec> globalOutputs = {OutputSpec{" A" , " 1" },
688+ OutputSpec{" A" , " 2" },
689+ OutputSpec{" DPL" , " TIMER" , 0 , Lifetime::Timer}};
690+
691+ // See values in test_WorkflowHelpers.cxx
692+ std::vector<size_t > edgeOutIndex{1 , 2 , 0 };
693+ std::vector<size_t > edgeInIndex{0 , 1 , 2 };
694+ std::vector<DeviceConnectionEdge> logicalEdges = {
695+ {2 , 0 , 0 , 0 , 2 , 0 , false , ConnectionKind::Out},
696+ {0 , 1 , 0 , 0 , 0 , 0 , false , ConnectionKind::Out},
697+ {0 , 1 , 0 , 0 , 1 , 0 , false , ConnectionKind::Out},
698+ };
699+
700+ // See values in test_WorkflowHelpers.cxx
701+ std::vector<EdgeAction> outActions{
702+ EdgeAction{true , true },
703+ EdgeAction{true , true },
704+ EdgeAction{false , false },
705+ };
706+
707+ // See values in test_WorkflowHelpers.cxx
708+ std::vector<EdgeAction> inActions{
709+ EdgeAction{true , true },
710+ EdgeAction{true , true },
711+ EdgeAction{false , false },
712+ };
713+
714+ DeviceSpecHelpers::processOutEdgeActions (devices, deviceIndex, connections, resources, edgeOutIndex, logicalEdges,
715+ outActions, workflow, globalOutputs, channelPolicies);
716+
717+ BOOST_REQUIRE_EQUAL (devices.size (), 2 ); // Two devices have outputs: A and Timer
718+ BOOST_CHECK_EQUAL (devices[0 ].name , " A" );
719+ BOOST_CHECK_EQUAL (devices[1 ].name , " internal-dpl-timer" );
720+ BOOST_REQUIRE_EQUAL (deviceIndex.size (), 2 );
721+ BOOST_CHECK_EQUAL (deviceIndex[0 ].processorIndex , 0 ); // A is the first processor in the workflow
722+ BOOST_CHECK_EQUAL (deviceIndex[0 ].timeslice , 0 ); // There is no time pipelining
723+ BOOST_CHECK_EQUAL (deviceIndex[0 ].deviceIndex , 0 ); // It's also the first device created
724+ BOOST_CHECK_EQUAL (deviceIndex[1 ].processorIndex , 2 ); // TIMER is added only at the end
725+ BOOST_CHECK_EQUAL (deviceIndex[1 ].timeslice , 0 ); // There is no time pipelining
726+ BOOST_CHECK_EQUAL (deviceIndex[1 ].deviceIndex , 1 ); // It's the second device created
727+
728+ std::sort (connections.begin (), connections.end ());
729+
730+ DeviceSpecHelpers::processInEdgeActions (devices, deviceIndex, resources, connections, edgeInIndex, logicalEdges,
731+ inActions, workflow, availableForwardsInfo, channelPolicies);
732+
733+ BOOST_REQUIRE_EQUAL (devices.size (), 3 ); // Now we also have B
734+ BOOST_CHECK_EQUAL (devices[0 ].name , " A" );
735+ BOOST_CHECK_EQUAL (devices[1 ].name , " internal-dpl-timer" );
736+ BOOST_CHECK_EQUAL (devices[2 ].name , " B" );
737+ BOOST_REQUIRE_EQUAL (deviceIndex.size (), 3 );
738+ BOOST_CHECK_EQUAL (deviceIndex[1 ].processorIndex , 1 ); // B is the second processor in the workflow
739+ BOOST_CHECK_EQUAL (deviceIndex[1 ].timeslice , 0 ); // There is no time pipelining
740+ BOOST_CHECK_EQUAL (deviceIndex[1 ].deviceIndex , 2 ); // It's the last device created because it's a sink
741+
742+ // We should have only one input, because the two outputs of A can
743+ // be captured by the generic matcher in B
744+ BOOST_REQUIRE_EQUAL (devices[2 ].inputs .size (), 1 );
745+ }
0 commit comments