Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static test cases definition + supporting multi-model cases in MemLeaks tests #7378

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
3a3da15
Merge pull request #1 from openvinotoolkit/master
alexander-shchepetov May 5, 2021
e9e9eeb
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov May 20, 2021
fe3e70c
Merge pull request #3 from openvinotoolkit/master
alexander-shchepetov Jun 1, 2021
bb07941
Merge pull request #4 from openvinotoolkit/master
alexander-shchepetov Jun 7, 2021
bd6a132
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Jun 10, 2021
f0ef85a
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Jun 15, 2021
4538551
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Jun 15, 2021
4c88e89
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Jun 18, 2021
5a47b43
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Jul 5, 2021
9aa1ed4
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Jul 8, 2021
0fecdd7
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Jul 13, 2021
d11237c
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 2, 2021
7123f8d
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 10, 2021
cefa436
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 12, 2021
6bfb252
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 16, 2021
9060efd
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 17, 2021
e1e8c55
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 18, 2021
1d6796e
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 19, 2021
3fe7f20
.
alexander-shchepetov Aug 19, 2021
0f183b5
.
alexander-shchepetov Aug 19, 2021
8b14e0a
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 19, 2021
6efbce2
.
alexander-shchepetov Aug 20, 2021
3b8b7ba
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 20, 2021
8a6d403
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Aug 25, 2021
a808353
add multimodel memleaks test runner
alexander-shchepetov Aug 25, 2021
01577be
Merge branch 'master' of https://github.com/alexander-shchepetov/open…
alexander-shchepetov Aug 25, 2021
cf390cf
.
alexander-shchepetov Aug 30, 2021
ee67d99
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 1, 2021
f7d3f79
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 2, 2021
1cf863f
Add support for is_equal_data, get_source_tensor, get_target_tensor m…
Aug 17, 2021
e35aa44
Change ngraph public api (#6920)
ilyachur Aug 17, 2021
2ef0bf7
[LPT] LP Transformations refactoring after dynamic shapes support (#6…
v-Golubev Aug 17, 2021
3952d5a
[GPU] Fix ScatterNDUpdate unit tests (#7103)
sshlyapn Aug 17, 2021
ef8933c
Deprecate ngraph file utils. Need to have common functions (#7105)
ilyachur Aug 18, 2021
f102c0d
[GPU] Get rid of memory alloc for input_layout in internal networks (…
vladimir-paramuzov Aug 18, 2021
94e6c17
Renamed component name (#7110)
ishariko Aug 18, 2021
3b47f62
Propose new MaxPool-8 operation (#5359)
postrational Aug 18, 2021
d6de72b
MaxPool-8: pads_value attribute removal from the operator definition …
Aug 18, 2021
ec512f4
Remove deprecated option and enable compilation without device (#6022)
DariaMityagina Aug 18, 2021
7574dd0
Build openvino wheel package from setup.py (#7091)
slyubimt Aug 18, 2021
46cbdcd
Support unregistered operations in MO IR Reader (#6837)
Aug 18, 2021
8bd9ef4
First stage of the AUTO-MULTI merge: redirecting AUTO to the MULTI de…
mashoujiang Aug 18, 2021
528562a
[CPU] Deform. conv. - reference enforced (#6945)
yury-intel Aug 18, 2021
962972a
[CPU] Bump up MKLDNN version to get fix of c26453 warning (#7089)
vurusovs Aug 18, 2021
b8e9fe5
OpenVINO ONNX CI Azure - update onnx/models on demand only (#7125)
rblaczkowski Aug 18, 2021
fded5f6
[CPU] Added improvements for StridedSlice (#6658)
a-sidorova Aug 18, 2021
ddb7799
Removal of FusedOp inheritance leftovers (#7113)
mitruska Aug 18, 2021
9c063ae
Move ngraph::element::Type to ov namespace (#7124)
ilyachur Aug 18, 2021
7563ee9
[GNA] Fix order of SwapMatMulInput transformations (#7137)
elilobanova Aug 18, 2021
d03f687
Moved Dimension, PartialShape, Interval, Rank to ov namespace (#7136)
ilyachur Aug 19, 2021
70b3fbd
Mo implementation for If with tf extractor (#6662)
evolosen Aug 19, 2021
7bb51e6
[GPU] Fixed 'assigned to self' error in loop_inst.h (#7126)
ahnyoung-paul Aug 19, 2021
c058b6b
[GPU] Fix build for gcc 10 (#7142)
vladimir-paramuzov Aug 19, 2021
1cec359
[GNA] Set input scale factors for imported model (#7139)
mryzhov Aug 19, 2021
2ada917
add doc:'Paddle_Support.md' (#7122)
liubo-intel Aug 19, 2021
f00f836
Remove local configs and it's copying to bin/ for stress tests (#7131)
omartiny Aug 19, 2021
4c3f393
Moved DEPRECATION macro and ITT domains to ov namespace (#7153)
ilyachur Aug 19, 2021
642d8a2
Enable NormalizeL2Fusion and LeakyReluFusion inside MOC (#7096)
GlebKazantaev Aug 19, 2021
1c9c819
Add support for ONNX Crop operator (#6956)
postrational Aug 19, 2021
3cecddc
Review/update spec for NotEqual operation (#6797)
nsemaev Aug 19, 2021
3846d20
Moved DiscreteTypeInfo to ov namespace (#7127)
ilyachur Aug 20, 2021
ad40ece
Revise CTCLoss OP (#6953)
Aug 20, 2021
0bd6696
Enable PriorBoxClustered tests (#7078)
Aug 20, 2021
3062be0
CumSum spec revision (#6966)
mitruska Aug 20, 2021
5228c41
Added common.hpp file with aliases (#7158)
apankratovantonp Aug 20, 2021
a9ddf79
CumSum reference implementation revision (#6915)
mitruska Aug 20, 2021
cf75c3f
[LPT] MarkupCanBeQuantized: handled unsupported concat (#7045)
v-Golubev Aug 20, 2021
866c693
CVS-56144 Enable all OMZ scope (#7084)
Aug 20, 2021
319473b
Install layer tests with CMake (#6892)
alexander-shchepetov Aug 20, 2021
01e1491
ReverseSequence specification refactored (#7112)
ggalieroc Aug 20, 2021
a834881
MemCheck add INT8 models to pre-commit (#7166)
omartiny Aug 20, 2021
57ca523
parametrize proxy (#7174)
rblaczkowski Aug 20, 2021
e849b75
Updated list of supported operations. (#6981)
popovaan Aug 20, 2021
d5be5df
[MO] turn on MarkSubGraphsWithCorrectLayout for TF NCHW (#7150)
pavel-esir Aug 20, 2021
eaa9c12
[CPU][TESTS][LPT] MatMulTransformations test-cases removed from skip …
v-Golubev Aug 23, 2021
555c8b8
Fixed ngraph_onnx_importer compatibility target creation for older cm…
mshabunin Aug 23, 2021
38ac9a2
[GPU] Fix clBuildProgram failure with ssd_mobilnet_v1_coco and batch=…
andrew-k-park Aug 23, 2021
570e4fe
Fix v0::MVN default constructor (#7175)
mitruska Aug 23, 2021
d84d3bd
[GPU] Fixes for correct MultiDevice plugin and inference request beha…
Aug 23, 2021
ed1b4bf
Fix op category section in operations spec (#7130)
ggalieroc Aug 23, 2021
4bbcdc4
add ngraph::pass::LSTMCellDecomposition as mandatory (#7028)
evkotov Aug 23, 2021
d03e142
[IE] Convert to unsigned NMS:0 ->Gather path (#6474)
pavel-esir Aug 23, 2021
50959e9
[nG] [IE] use GatherBase in negative indices resolver (#7145)
pavel-esir Aug 23, 2021
ad366b8
Nested loop (#6710)
sadolini Aug 23, 2021
42ff8ff
install necessary dirs for tests (#7044)
Aug 23, 2021
86597a4
Added openvino infer request API (#7151)
apankratovantonp Aug 24, 2021
c3de89f
[CPU] Removed eltwise overhead on execution stage (#6760)
a-sidorova Aug 24, 2021
5ac7011
[GNA] For similar records, the pattern length was increased to 4 in …
dmitriikhurtin Aug 24, 2021
ecf5280
[CPU] Enable direct copy implementation for u8->u8 reorder. (#7043)
IvanNovoselov Aug 24, 2021
c4e873d
[CPU] Fix not expected No-Preprocess Exception with RGB to BGR conver…
apertovs Aug 24, 2021
94003a2
[CPU] Avoid inserting additional transpose + reorder after RNN node. …
nshchego Aug 24, 2021
f989b33
[MO] Replacing StridedSlice with Squeeze/Unsqueeze (#6693)
yekruglov Aug 24, 2021
4ce9d96
[VPU] Added ConvertGather7ToGather1 pass to frontend (#7183)
Aug 24, 2021
b4b0bf7
[MO] Add transformation for single CTCGreedyDecoder operation (#7023)
Aug 24, 2021
bd958bd
Add support opset11 for gemm normalizer (#6733)
iimironov Aug 24, 2021
a2b03e2
Add support for ONNX RandomUniform and RandomUniformLike ops (#7190)
postrational Aug 24, 2021
58c58eb
remove adaptive pool2d shape check in ngraph paddle frontend (#7074)
meiyang-intel Aug 25, 2021
a1f1a83
Revise ReverseSequence reference implementation (#7117)
ggalieroc Aug 25, 2021
e925f1f
Moved attribute_adapter, attribute_visitor files to ov namespave (#7179)
ilyachur Aug 25, 2021
d469113
memleaks multimodel supporting
alexander-shchepetov Aug 30, 2021
9036e41
resolve mc
alexander-shchepetov Sep 5, 2021
6ce9590
resolve mc 2
alexander-shchepetov Sep 5, 2021
ed5b565
revert rebase mistake
alexander-shchepetov Sep 5, 2021
46da1dd
add newline at the end of config file
alexander-shchepetov Sep 5, 2021
30878f2
fix log messages
alexander-shchepetov Sep 5, 2021
5bf5935
refine memelaks test case class
alexander-shchepetov Sep 5, 2021
14dcf2a
remove temporary decision designed to save in memory pipeline functi…
alexander-shchepetov Sep 5, 2021
77f33b7
code consistency
alexander-shchepetov Sep 5, 2021
b97ce27
rework example of new memleak tests config format
alexander-shchepetov Sep 5, 2021
b3980ae
oop in testcases
alexander-shchepetov Sep 5, 2021
5ce7592
mistype
alexander-shchepetov Sep 5, 2021
fa30679
set num of iterations in example test config to previous value
alexander-shchepetov Sep 5, 2021
acd63a9
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 6, 2021
879ea1d
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 8, 2021
9623f33
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 9, 2021
b4550ce
Merge branch 'memleaks-multimodel' of https://github.com/alexander-sh…
alexander-shchepetov Sep 9, 2021
b1af67a
Merge branch 'master' of https://github.com/alexander-shchepetov/open…
alexander-shchepetov Sep 9, 2021
ed20ade
.
alexander-shchepetov Sep 9, 2021
560cc81
add multiproc stress unit tests
alexander-shchepetov Sep 9, 2021
a1001a2
Add more cases
alexander-shchepetov Sep 9, 2021
a2a2106
.
alexander-shchepetov Sep 12, 2021
02a9d42
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 12, 2021
0ac592c
Merge branch 'memleaks-multimodel' of https://github.com/alexander-sh…
alexander-shchepetov Sep 12, 2021
0157e3c
remove unique_ptr test objects saving logic
alexander-shchepetov Sep 13, 2021
deac5dc
switch memleak test configs to new format
alexander-shchepetov Sep 13, 2021
e338f21
swith weekly memleak test config to new format
alexander-shchepetov Sep 13, 2021
b43800c
Clarify new get_testdata script arg
alexander-shchepetov Sep 13, 2021
82d58d8
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 14, 2021
27e7c44
Merge branch 'master' of https://github.com/alexander-shchepetov/open…
alexander-shchepetov Sep 14, 2021
fbcc0a1
clang-format
alexander-shchepetov Sep 14, 2021
a75389a
wrong changes
alexander-shchepetov Sep 14, 2021
f928936
Add docstring to generateTestsParamsMemLeaks()
alexander-shchepetov Sep 14, 2021
950e34f
add explanation what update_item_for_name() doing
alexander-shchepetov Sep 14, 2021
0749734
Autodetect stress framework while parsing models
alexander-shchepetov Sep 14, 2021
66a6d2b
adjust the wording
alexander-shchepetov Sep 14, 2021
91b3231
Shorten test cases names
alexander-shchepetov Sep 15, 2021
89b6880
fix get_testdata for memcheck tests
alexander-shchepetov Sep 15, 2021
a5e22a8
Merge branch 'unittest-nproc' of https://github.com/alexander-shchepe…
alexander-shchepetov Sep 15, 2021
bf0342a
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 17, 2021
c97bc00
update branch from master
alexander-shchepetov Sep 17, 2021
77919ac
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 17, 2021
e126156
Merge branch 'master' of https://github.com/alexander-shchepetov/open…
alexander-shchepetov Sep 17, 2021
a0cb67c
Merge branch 'openvinotoolkit:master' into master
alexander-shchepetov Sep 17, 2021
b3d0d3e
Merge branch 'master' of https://github.com/alexander-shchepetov/open…
alexander-shchepetov Sep 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<attributes>
<processes>
<value>1</value>
</processes>
<threads>
<value>1</value>
</threads>
<iterations>
<value>1000</value>
</iterations>
<devices>
<value>CPU</value>
<value>GPU</value>
</devices>
<models>
<!-- Alexnet model contains MatMul node which is needed to cover *-52623 -->
<cases>

<device name="CPU" iterations="1000" processes="1" threads="1">
<model name="alexnet" precision="FP32" source="omz" />
<model name="mobilenet-ssd" precision="FP32" source="omz" />
<model name="mtcnn-r" precision="FP32" source="omz" />
</models>
</attributes>
</device>

<device name="GPU" iterations="1000" processes="1" threads="1">
<model name="alexnet" precision="FP32" source="omz" />
<model name="mobilenet-ssd" precision="FP32" source="omz" />
<model name="mtcnn-r" precision="FP32" source="omz" />
</device>

</cases>
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
<attributes>
<processes>
<value>1</value>
</processes>
<threads>
<value>1</value>
</threads>
<iterations>
<value>1000</value>
</iterations>
<devices>
<value>MYRIAD</value>
</devices>
<models>
<cases>

<device name="MYRIAD" iterations="1000" processes="1" threads="1">
<model name="alexnet" precision="FP32" source="omz" />
<model name="mobilenet-ssd" precision="FP32" source="omz" />
<model name="mtcnn-r" precision="FP32" source="omz" />
</models>
</attributes>
</device>

</cases>
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<attributes>
<processes>
<value>1</value>
</processes>
<threads>
<value>1</value>
</threads>
<iterations>
<value>30</value>
</iterations>
<devices>
<value>CPU</value>
<value>GPU</value>
</devices>
<models>
<cases>

<device name="CPU" iterations="30" processes="1" threads="1">
<model name="mobilenet-ssd" precision="FP32" source="omz" />
</models>
</attributes>
</device>

<device name="GPU" iterations="30" processes="1" threads="1">
<model name="mobilenet-ssd" precision="FP32" source="omz" />
</device>

</cases>
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<attributes>
<processes>
<value>1</value>
</processes>
<threads>
<value>1</value>
</threads>
<iterations>
<value>5000</value>
</iterations>
<devices>
<value>CPU</value>
<value>GPU</value>
</devices>
<models>
<!-- Alexnet model contains MatMul node which is needed to cover *-52623 -->
<cases>

<device name="CPU" iterations="5000" processes="1" threads="1">
<model name="alexnet" precision="FP32" source="omz" />
<model name="mobilenet-ssd" precision="FP32" source="omz" />
<model name="mtcnn-r" precision="FP32" source="omz" />
</models>
</attributes>
</device>

<device name="GPU" iterations="5000" processes="1" threads="1">
<model name="alexnet" precision="FP32" source="omz" />
<model name="mobilenet-ssd" precision="FP32" source="omz" />
<model name="mtcnn-r" precision="FP32" source="omz" />
</device>

</cases>
69 changes: 55 additions & 14 deletions tests/stress_tests/common/tests_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@
#include "tests_utils.h"

#include <gtest/gtest.h>
#include <map>
#include <pugixml.hpp>
#include <string>

#define DEBUG_MODE false

const pugi::xml_document & Environment::getTestConfig() {
return _test_config;
}
const pugi::xml_document &Environment::getTestConfig() { return _test_config; }

void Environment::setTestConfig(const pugi::xml_document &test_config) {
_test_config.reset(test_config);
}
void Environment::setTestConfig(const pugi::xml_document &test_config) { _test_config.reset(test_config); }

std::vector<TestCase> generateTestsParams(std::initializer_list<std::string> fields) {
std::vector<TestCase> tests_cases;
const pugi::xml_document & test_config = Environment::Instance().getTestConfig();
const pugi::xml_document &test_config = Environment::Instance().getTestConfig();

std::vector<int> processes, threads, iterations;
std::vector<std::string> devices, models, models_names, precisions;
Expand Down Expand Up @@ -49,7 +46,8 @@ std::vector<TestCase> generateTestsParams(std::initializer_list<std::string> fie
std::string full_path = val.attribute("full_path").as_string();
std::string path = val.attribute("path").as_string();
if (full_path.empty() || path.empty())
throw std::logic_error("One of the 'model' records from test config doesn't contain 'full_path' or 'path' attributes");
throw std::logic_error("One of the 'model' records from test config doesn't contain 'full_path' or "
"'path' attributes");
else {
models.push_back(full_path);
models_names.push_back(path);
Expand All @@ -61,9 +59,9 @@ std::vector<TestCase> generateTestsParams(std::initializer_list<std::string> fie
}

// Initialize variables with default value if it weren't filled
processes = !processes.empty() ? processes: std::vector<int>{1};
threads = !threads.empty() ? threads: std::vector<int>{1};
iterations = !iterations.empty() ? iterations: std::vector<int>{1};
processes = !processes.empty() ? processes : std::vector<int>{1};
threads = !threads.empty() ? threads : std::vector<int>{1};
iterations = !iterations.empty() ? iterations : std::vector<int>{1};
devices = !devices.empty() ? devices : std::vector<std::string>{"NULL"};
models = !models.empty() ? models : std::vector<std::string>{"NULL"};
precisions = !precisions.empty() ? precisions : std::vector<std::string>{"NULL"};
Expand All @@ -74,14 +72,58 @@ std::vector<TestCase> generateTestsParams(std::initializer_list<std::string> fie
for (auto &numiters : iterations)
for (auto &device : devices)
for (int i = 0; i < models.size(); i++)
tests_cases.push_back(TestCase(numprocesses, numthreads, numiters, device, models[i], models_names[i], precisions[i]));
tests_cases.push_back(TestCase(numprocesses, numthreads, numiters, device, models[i],
models_names[i], precisions[i]));
return tests_cases;
}

// Generate multi-model test cases from config file with static test definition.
std::vector<MemLeaksTestCase> generateTestsParamsMemLeaks() {
std::vector<MemLeaksTestCase> tests_cases;
const pugi::xml_document &test_config = Environment::Instance().getTestConfig();

int numprocesses, numthreads, numiterations;
std::string device_name;

pugi::xml_node cases;
cases = test_config.child("cases");

for (pugi::xml_node device = cases.first_child(); device; device = device.next_sibling()) {
device_name = device.attribute("name").as_string("NULL");
numprocesses = device.attribute("processes").as_int(1);
numthreads = device.attribute("threads").as_int(1);
numiterations = device.attribute("iterations").as_int(1);

std::vector<std::map<std::string, std::string>> models;

for (pugi::xml_node model = device.first_child(); model; model = model.next_sibling()) {
std::string full_path = model.attribute("full_path").as_string();
std::string path = model.attribute("path").as_string();
if (full_path.empty() || path.empty())
throw std::logic_error(
"One of the 'model' records from test config doesn't contain 'full_path' or 'path' attributes");
std::string name = model.attribute("name").as_string();
std::string precision = model.attribute("precision").as_string();
std::map<std::string, std::string> model_map{{"name", name},
{"path", path},
{"full_path", full_path},
{"precision", precision}};
models.push_back(model_map);
}
tests_cases.push_back(MemLeaksTestCase(numprocesses, numthreads, numiterations, device_name, models));
}

return tests_cases;
}

std::string getTestCaseName(const testing::TestParamInfo<TestCase> &obj) {
return obj.param.test_case_name;
}

std::string getTestCaseNameMemLeaks(const testing::TestParamInfo<MemLeaksTestCase> &obj) {
return obj.param.test_case_name;
}

void test_wrapper(const std::function<void(std::string, std::string, int)> &tests_pipeline, const TestCase &params) {
tests_pipeline(params.model, params.device, params.numiters);
}
Expand All @@ -94,8 +136,7 @@ void runTest(const std::function<void(std::string, std::string, int)> &tests_pip
#if DEBUG_MODE
tests_pipeline(params.model, params.device, params.numiters);
#else
int status = run_in_processes(params.numprocesses, [&](){ _runTest(tests_pipeline, params); });
int status = run_in_processes(params.numprocesses, [&]() { _runTest(tests_pipeline, params); });
ASSERT_EQ(status, 0) << "Test failed with exitcode " << std::to_string(status);
#endif
}

73 changes: 47 additions & 26 deletions tests/stress_tests/common/tests_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,90 @@
#include <gtest/gtest.h>
#include <pugixml.hpp>
#include <string>
#include <vector>
#include <thread>
#include <vector>


enum TestStatus
{
TEST_NOT_STARTED = 0,
TEST_FAILED,
TEST_OK
};
enum TestStatus { TEST_NOT_STARTED = 0, TEST_FAILED, TEST_OK };

using TestResult = std::pair<TestStatus, std::string>;

class TestCase {
class TestCaseBase {
public:
int numprocesses;
int numthreads;
int numiters;
std::string device;
std::string model_name;
std::string model;
std::string precision;
std::string test_case_name;
std::string model_name;
std::string device;

TestCase(int _numprocesses, int _numthreads, int _numiters, std::string _device, const std::string& _model, const std::string& _model_name, const std::string& _precision) {
numprocesses = _numprocesses, numthreads = _numthreads, numiters = _numiters, device = _device, model = _model, model_name = _model_name, precision = _precision;
test_case_name =
"Numprocesses_" + std::to_string(numprocesses) + "_Numthreads_" + std::to_string(numthreads) +
"_Numiters_" + std::to_string(numiters) + "_Device_" + update_item_for_name(device) + "_Precision_" +
update_item_for_name(precision) + "_Model_" + update_item_for_name(model_name);
}

private:
protected:
// Replace non-alphabetic/numeric symbols with "_" to prevent logging errors
std::string update_item_for_name(const std::string &item) {
std::string _item(item);
for (std::string::size_type index = 0; index < _item.size(); ++index) {
if (!isalnum(_item[index]) && _item[index] != '_')
_item[index] = '_';
if (!isalnum(_item[index]) && _item[index] != '_') _item[index] = '_';
}
return _item;
}
};

class TestCase : public TestCaseBase {
public:
std::string model;

TestCase(int _numprocesses, int _numthreads, int _numiters, std::string _device, const std::string &_model,
const std::string &_model_name, const std::string &_precision) {
numprocesses = _numprocesses, numthreads = _numthreads, numiters = _numiters, device = _device, model = _model,
model_name = _model_name, precision = _precision;
test_case_name = "Numprocesses_" + std::to_string(numprocesses) + "_Numthreads_" + std::to_string(numthreads) +
"_Numiters_" + std::to_string(numiters) + "_Device_" + update_item_for_name(device) +
"_Precision_" + update_item_for_name(precision) + "_Model_" + update_item_for_name(model_name);
}
};

class MemLeaksTestCase : public TestCaseBase {
public:
std::vector<std::map<std::string, std::string>> models;

MemLeaksTestCase(int _numprocesses, int _numthreads, int _numiters, std::string _device,
std::vector<std::map<std::string, std::string>> _models) {
numprocesses = _numprocesses, numthreads = _numthreads, numiters = _numiters, device = _device,
models = _models;
test_case_name = "Numprocesses_" + std::to_string(numprocesses) + "_Numthreads_" + std::to_string(numthreads) +
"_Numiters_" + std::to_string(numiters) + "_Device_" + update_item_for_name(device);
for (int i = 0; i < models.size(); i++) {
test_case_name += "_Model" + std::to_string(i + 1) + "_" + update_item_for_name(models[i]["name"]) + "_" +
update_item_for_name(models[i]["precision"]);
model_name += "\"" + models[i]["path"] + "\"" + (i < models.size() - 1 ? ", " : "");
}
}
};

class Environment {
private:
pugi::xml_document _test_config;
bool _collect_results_only = false;

Environment() = default;
Environment(const Environment&) = delete;
Environment& operator=(const Environment&) = delete;
Environment(const Environment &) = delete;
Environment &operator=(const Environment &) = delete;

public:
static Environment& Instance(){
static Environment &Instance() {
static Environment env;
return env;
}

const pugi::xml_document & getTestConfig();
const pugi::xml_document &getTestConfig();
void setTestConfig(const pugi::xml_document &test_config);
};

std::vector<TestCase> generateTestsParams(std::initializer_list<std::string> items);
std::vector<MemLeaksTestCase> generateTestsParamsMemLeaks();
std::string getTestCaseName(const testing::TestParamInfo<TestCase> &obj);
std::string getTestCaseNameMemLeaks(const testing::TestParamInfo<MemLeaksTestCase> &obj);

void runTest(const std::function<void(std::string, std::string, int)> &tests_pipeline, const TestCase &params);
void _runTest(const std::function<void(std::string, std::string, int)> &tests_pipeline, const TestCase &params);
Expand Down
Loading