From cd2e8b306ca91eaedd50e034995c0e9055cbb079 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Tue, 11 Oct 2022 16:23:54 +0800 Subject: [PATCH] Replace or remove some characters to meet gtest name convention (#13266) ### Description To construct test name, replace whitespace to underscore and remove parentheses ### Motivation and Context gtest name only accepts '_' and alphanumeric --- onnxruntime/test/providers/cpu/model_tests.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/onnxruntime/test/providers/cpu/model_tests.cc b/onnxruntime/test/providers/cpu/model_tests.cc index a2515921e594f..8868e6564a0a0 100644 --- a/onnxruntime/test/providers/cpu/model_tests.cc +++ b/onnxruntime/test/providers/cpu/model_tests.cc @@ -1131,9 +1131,12 @@ auto ExpandModelName = [](const ::testing::TestParamInfo& 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()); }