diff --git a/test/hotspot/gtest/code/test_codestrings.cpp b/test/hotspot/gtest/code/test_codestrings.cpp index fb45c36c5f2..550c3cc07c8 100644 --- a/test/hotspot/gtest/code/test_codestrings.cpp +++ b/test/hotspot/gtest/code/test_codestrings.cpp @@ -37,10 +37,13 @@ static const char* replace_addr_expr(const char* str) { // Remove any address expression "0x0123456789abcdef" found in order to // aid string comparison. Also remove any trailing printout from a padded - // buffer. + // buffer (too brittle?). - std::basic_string tmp = std::regex_replace(str, std::regex("0x[0-9a-fA-F]+"), ""); - std::basic_string red = std::regex_replace(tmp, std::regex("\\s+:\\s+\\.inst\\t ; undefined"), ""); + std::basic_string tmp1 = std::regex_replace(str, std::regex("0x[0-9a-fA-F]+"), ""); + // Padding: aarch64 + std::basic_string tmp2 = std::regex_replace(tmp1, std::regex("\\s+:\\s+\\.inst\\t ; undefined"), ""); + // Padding: x64 + std::basic_string red = std::regex_replace(tmp2, std::regex("\\s+:\\s+hlt[ \\t]+(?!\\n\\s+;;)"), ""); return os::strdup(red.c_str()); }