Project
Loading...
Searching...
No Matches
test_ComputingResourceHelpers.cxx
Go to the documentation of this file.
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 <catch_amalgamated.hpp>
13
14#include "../src/ComputingResourceHelpers.h"
15#include <string>
16#include <vector>
17
18using namespace o2::framework;
19
20TEST_CASE("TestResourceParsing")
21{
22 auto test1 = "foo:16:1000:22000:23000";
23 auto test2 = "foo:16:1000:22000:23000,bar:8:500:22000:23000";
24
25 auto resources = ComputingResourceHelpers::parseResources(test1);
26 REQUIRE(resources.size() == 1);
27 REQUIRE(resources[0].cpu == 16);
28 REQUIRE(resources[0].memory == 1000000000);
29 REQUIRE(resources[0].hostname == "foo");
30 REQUIRE(resources[0].startPort == 22000);
31 REQUIRE(resources[0].lastPort == 23000);
32
34 REQUIRE(resources.size() == 2);
35 REQUIRE(resources[0].cpu == 16);
36 REQUIRE(resources[0].memory == 1000000000);
37 REQUIRE(resources[0].hostname == "foo");
38 REQUIRE(resources[0].startPort == 22000);
39 REQUIRE(resources[0].lastPort == 23000);
40 REQUIRE(resources[1].cpu == 8);
41 REQUIRE(resources[1].memory == 500000000);
42 REQUIRE(resources[1].hostname == "bar");
43 REQUIRE(resources[1].startPort == 22000);
44 REQUIRE(resources[1].lastPort == 23000);
45}
uint32_t cpu
Definition RawData.h:6
GLuint memory
Definition glcorearb.h:5234
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
static std::vector< ComputingResource > parseResources(std::string const &resourceString)
TEST_CASE("TestResourceParsing")