forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_TopologyPolicies.cxx
More file actions
59 lines (53 loc) · 2.5 KB
/
test_TopologyPolicies.cxx
File metadata and controls
59 lines (53 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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 "Mocking.h"
#include <catch_amalgamated.hpp>
#include "Framework/ChannelSpecHelpers.h"
#include "../src/DeviceSpecHelpers.h"
#include "../src/GraphvizHelpers.h"
#include "../src/WorkflowHelpers.h"
#include "Framework/DeviceSpec.h"
#include "Framework/WorkflowSpec.h"
#include "Framework/DataSpecUtils.h"
#include "../src/SimpleResourceManager.h"
#include "../src/ComputingResourceHelpers.h"
#include "test_HelperMacros.h"
#include "Framework/TopologyPolicyHelpers.h"
using namespace o2::framework;
// This is how you can define your processing in a declarative way
WorkflowSpec defineDataProcessingWithSporadic()
{
return {
{.name = "input-proxy", .outputs = {OutputSpec{"QEMC", "CELL", 1}, OutputSpec{"CTF", "DONE", 0}}},
{.name = "EMC-Cell-proxy", .inputs = Inputs{InputSpec{"a", "QEMC", "CELL", 1, Lifetime::Sporadic}}},
{.name = "calib-output-proxy-barrel-tf", .inputs = {InputSpec{"a", "CTF", "DONE", 0}}}};
}
TEST_CASE("TestBrokenSporadic")
{
auto workflow = defineDataProcessingWithSporadic();
auto configContext = makeEmptyConfigContext();
auto channelPolicies = ChannelConfigurationPolicy::createDefaultPolicies(*configContext);
auto completionPolicies = CompletionPolicy::createDefaultPolicies();
auto callbacksPolicies = CallbacksPolicy::createDefaultPolicies();
REQUIRE(channelPolicies.empty() == false);
REQUIRE(completionPolicies.empty() == false);
std::vector<DeviceSpec> devices;
std::vector<ComputingResource> resources{ComputingResourceHelpers::getLocalhostResource()};
REQUIRE(resources.size() == 1);
REQUIRE(resources[0].startPort == 22000);
SimpleResourceManager rm(resources);
auto offers = rm.getAvailableOffers();
REQUIRE(offers.size() == 1);
REQUIRE(offers[0].startPort == 22000);
REQUIRE(offers[0].rangeSize == 5000);
DeviceSpecHelpers::dataProcessorSpecs2DeviceSpecs(workflow, channelPolicies, completionPolicies, callbacksPolicies, devices, rm, "workflow-id", *configContext);
TopologyPolicyHelpers::buildEdges(workflow);
}