[CPU] Exclude colon characters from test names (#5243)

* [CPU] Exclude colon characters from test names

":" is used for specifying list of filters in '--gtest_filter=' option
So when a test name contains a colon char it is impossible to run such
test by its full name.
There is now way to escape this colon char as well.
This commit is contained in:
Egor Duplensky 2021-04-26 12:30:02 +03:00 committed by GitHub
parent af6f315071
commit 93f63ceb6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -79,10 +79,10 @@ cpu_memory_format_t CPUTestsBase::cpu_str2fmt(const char *str) {
return undef;
}
std::string CPUTestsBase::fmts2str(const std::vector<cpu_memory_format_t> &fmts) {
std::string CPUTestsBase::fmts2str(const std::vector<cpu_memory_format_t> &fmts, const std::string &prefix) {
std::string str;
for (auto &fmt : fmts) {
((str += "cpu:") += cpu_fmt2str(fmt)) += ",";
((str += prefix) += cpu_fmt2str(fmt)) += ",";
}
if (!str.empty()) {
str.pop_back();
@ -190,10 +190,10 @@ std::string CPUTestsBase::getTestCaseName(CPUSpecificParams params) {
std::string selectedType;
std::tie(inFmts, outFmts, priority, selectedType) = params;
if (!inFmts.empty()) {
result << "_inFmts=" << fmts2str(inFmts);
result << "_inFmts=" << fmts2str(inFmts, "");
}
if (!outFmts.empty()) {
result << "_outFmts=" << fmts2str(outFmts);
result << "_outFmts=" << fmts2str(outFmts, "");
}
if (!selectedType.empty()) {
result << "_primitive=" << selectedType;
@ -225,11 +225,11 @@ CPUTestsBase::makeCPUInfo(std::vector<cpu_memory_format_t> inFmts, std::vector<c
if (!inFmts.empty()) {
cpuInfo.insert({std::string(ngraph::MLKDNNInputMemoryFormatsAttr),
std::make_shared<ngraph::VariantWrapper<ngraph::MLKDNNInputMemoryFormats>>(ngraph::MLKDNNInputMemoryFormats(fmts2str(inFmts)))});
std::make_shared<ngraph::VariantWrapper<ngraph::MLKDNNInputMemoryFormats>>(ngraph::MLKDNNInputMemoryFormats(fmts2str(inFmts, "cpu:")))});
}
if (!outFmts.empty()) {
cpuInfo.insert({std::string(ngraph::MLKDNNOutputMemoryFormatsAttr),
std::make_shared<ngraph::VariantWrapper<ngraph::MLKDNNOutputMemoryFormats>>(ngraph::MLKDNNOutputMemoryFormats(fmts2str(outFmts)))});
std::make_shared<ngraph::VariantWrapper<ngraph::MLKDNNOutputMemoryFormats>>(ngraph::MLKDNNOutputMemoryFormats(fmts2str(outFmts, "cpu:")))});
}
if (!priority.empty()) {
cpuInfo.insert({"PrimitivesPriority", std::make_shared<ngraph::VariantWrapper<std::string>>(impls2str(priority))});

View File

@ -91,7 +91,7 @@ public:
static std::string getTestCaseName(CPUSpecificParams params);
static const char *cpu_fmt2str(cpu_memory_format_t v);
static cpu_memory_format_t cpu_str2fmt(const char *str);
static std::string fmts2str(const std::vector<cpu_memory_format_t> &fmts);
static std::string fmts2str(const std::vector<cpu_memory_format_t> &fmts, const std::string &prefix);
static std::string impls2str(const std::vector<std::string> &priority);
static CPUInfo makeCPUInfo(std::vector<cpu_memory_format_t> inFmts,
std::vector<cpu_memory_format_t> outFmts,