Skip to content

Commit

Permalink
Replace or remove some characters to meet gtest name convention (#13266)
Browse files Browse the repository at this point in the history
### Description
To construct test name, replace whitespace to underscore and remove
parentheses

### Motivation and Context
gtest name only accepts '_' and alphanumeric
  • Loading branch information
mszhanyi authored Oct 11, 2022
1 parent febd5fa commit cd2e8b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion onnxruntime/test/providers/cpu/model_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1131,9 +1131,12 @@ auto ExpandModelName = [](const ::testing::TestParamInfo<ModelTest::ParamType>&
std::replace(name.begin(), name.end(), '/', '_');
std::replace(name.begin(), name.end(), '\\', '_');

// in case there's whitespace in directory name
std::replace(name.begin(), name.end(), ' ', '_');

// Note: test name only accepts '_' and alphanumeric
// remove '.', '-', ':'
char chars[] = ".-:";
char chars[] = ".-:()";
for (unsigned int i = 0; i < strlen(chars); ++i) {
name.erase(std::remove(name.begin(), name.end(), chars[i]), name.end());
}
Expand Down

0 comments on commit cd2e8b3

Please sign in to comment.