|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +#include "Mocking.h" |
| 13 | +#include <catch_amalgamated.hpp> |
| 14 | +#include "Framework/ChannelSpecHelpers.h" |
| 15 | +#include "../src/DeviceSpecHelpers.h" |
| 16 | +#include "../src/GraphvizHelpers.h" |
| 17 | +#include "../src/WorkflowHelpers.h" |
| 18 | +#include "Framework/DeviceSpec.h" |
| 19 | +#include "Framework/WorkflowSpec.h" |
| 20 | +#include "Framework/DataSpecUtils.h" |
| 21 | +#include "../src/SimpleResourceManager.h" |
| 22 | +#include "../src/ComputingResourceHelpers.h" |
| 23 | +#include "test_HelperMacros.h" |
| 24 | +#include "Framework/TopologyPolicyHelpers.h" |
| 25 | + |
| 26 | +using namespace o2::framework; |
| 27 | + |
| 28 | +// This is how you can define your processing in a declarative way |
| 29 | +WorkflowSpec defineDataProcessingWithSporadic() |
| 30 | +{ |
| 31 | + return { |
| 32 | + {.name = "input-proxy", .outputs = {OutputSpec{"QEMC", "CELL", 1}, OutputSpec{"CTF", "DONE", 0}}}, |
| 33 | + {.name = "EMC-Cell-proxy", .inputs = Inputs{InputSpec{"a", "QEMC", "CELL", 1, Lifetime::Sporadic}}}, |
| 34 | + {.name = "calib-output-proxy-barrel-tf", .inputs = {InputSpec{"a", "CTF", "DONE", 0}}}}; |
| 35 | +} |
| 36 | + |
| 37 | +TEST_CASE("TestBrokenSporadic") |
| 38 | +{ |
| 39 | + auto workflow = defineDataProcessingWithSporadic(); |
| 40 | + auto configContext = makeEmptyConfigContext(); |
| 41 | + auto channelPolicies = ChannelConfigurationPolicy::createDefaultPolicies(*configContext); |
| 42 | + auto completionPolicies = CompletionPolicy::createDefaultPolicies(); |
| 43 | + auto callbacksPolicies = CallbacksPolicy::createDefaultPolicies(); |
| 44 | + REQUIRE(channelPolicies.empty() == false); |
| 45 | + REQUIRE(completionPolicies.empty() == false); |
| 46 | + std::vector<DeviceSpec> devices; |
| 47 | + |
| 48 | + std::vector<ComputingResource> resources{ComputingResourceHelpers::getLocalhostResource()}; |
| 49 | + REQUIRE(resources.size() == 1); |
| 50 | + REQUIRE(resources[0].startPort == 22000); |
| 51 | + SimpleResourceManager rm(resources); |
| 52 | + auto offers = rm.getAvailableOffers(); |
| 53 | + REQUIRE(offers.size() == 1); |
| 54 | + REQUIRE(offers[0].startPort == 22000); |
| 55 | + REQUIRE(offers[0].rangeSize == 5000); |
| 56 | + |
| 57 | + DeviceSpecHelpers::dataProcessorSpecs2DeviceSpecs(workflow, channelPolicies, completionPolicies, callbacksPolicies, devices, rm, "workflow-id", *configContext); |
| 58 | + TopologyPolicyHelpers::buildEdges(workflow); |
| 59 | +} |
| 60 | + |
0 commit comments