Rewrite the pattern we want to match in hlo_execution_profile_test.

For some reason, the existing pattern failed when run on MacOS.
But we can avoid the \b and instead check that the number is followed by
the word "cycles". This makes the check stricter than before, but also
makes it pass on MacOS.

PiperOrigin-RevId: 291702473
Change-Id: Id40cf8628b420bc1e9f75d612779dd15b67f6cb8
This commit is contained in:
Adrian Kuegel 2020-01-27 05:19:22 -08:00 committed by TensorFlower Gardener
parent d2663cbc07
commit 2e98e89091
2 changed files with 2 additions and 4 deletions

View File

@ -2526,8 +2526,6 @@ cc_library(
tf_cc_test( tf_cc_test(
name = "hlo_execution_profile_test", name = "hlo_execution_profile_test",
srcs = ["hlo_execution_profile_test.cc"], srcs = ["hlo_execution_profile_test.cc"],
# TODO(b/148275965) The test fails on macOS.
tags = ["nomac"],
deps = [ deps = [
":cpu_plugin", ":cpu_plugin",
":hlo_cost_analysis", ":hlo_cost_analysis",

View File

@ -66,9 +66,9 @@ TEST_F(HloExecutionProfileTest, Basic) {
EXPECT_THAT(execution_profile.ToString( EXPECT_THAT(execution_profile.ToString(
backend().default_stream_executor()->GetDeviceDescription()), backend().default_stream_executor()->GetDeviceDescription()),
AllOf(ContainsRegex(StrCat(dot_cycles, R"(\b.*%)", AllOf(ContainsRegex(StrCat(dot_cycles, " cycles.*%",
dot_instruction->name())), dot_instruction->name())),
ContainsRegex(StrCat(add_cycles, R"(\b.*%)", ContainsRegex(StrCat(add_cycles, " cycles.*%",
add_instruction->name())))); add_instruction->name()))));
} }
} // namespace } // namespace