Skip to content

Commit a0d0f21

Browse files
committed
8314752: Use google test string comparison macros
Reviewed-by: coleenp, kbarrett
1 parent 7e843c2 commit a0d0f21

14 files changed

+69
-76
lines changed

test/hotspot/gtest/logging/test_logConfiguration.cpp

+13-11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include "unittest.hpp"
3737
#include "utilities/ostream.hpp"
3838

39+
using testing::HasSubstr;
40+
3941
class LogConfigurationTest : public LogTestFixture {
4042
protected:
4143
static char _all_decorators[256];
@@ -71,26 +73,26 @@ TEST_VM_F(LogConfigurationTest, describe) {
7173
const char* description = ss.as_string();
7274

7375
// Verify that stdout and stderr are listed by default
74-
EXPECT_PRED2(string_contains_substring, description, LogConfiguration::StdoutLog->name());
75-
EXPECT_PRED2(string_contains_substring, description, LogConfiguration::StderrLog->name());
76+
EXPECT_THAT(description, HasSubstr(LogConfiguration::StdoutLog->name()));
77+
EXPECT_THAT(description, HasSubstr(LogConfiguration::StderrLog->name()));
7678

7779
// Verify that each tag, level and decorator is listed
7880
for (size_t i = 0; i < LogTag::Count; i++) {
79-
EXPECT_PRED2(string_contains_substring, description, LogTag::name(static_cast<LogTagType>(i)));
81+
EXPECT_THAT(description, HasSubstr(LogTag::name(static_cast<LogTagType>(i))));
8082
}
8183
for (size_t i = 0; i < LogLevel::Count; i++) {
82-
EXPECT_PRED2(string_contains_substring, description, LogLevel::name(static_cast<LogLevelType>(i)));
84+
EXPECT_THAT(description, HasSubstr(LogLevel::name(static_cast<LogLevelType>(i))));
8385
}
8486
for (size_t i = 0; i < LogDecorators::Count; i++) {
85-
EXPECT_PRED2(string_contains_substring, description, LogDecorators::name(static_cast<LogDecorators::Decorator>(i)));
87+
EXPECT_THAT(description, HasSubstr(LogDecorators::name(static_cast<LogDecorators::Decorator>(i))));
8688
}
8789

8890
// Verify that the default configuration is printed
8991
char expected_buf[256];
9092
int ret = jio_snprintf(expected_buf, sizeof(expected_buf), "=%s", LogLevel::name(LogLevel::Default));
9193
ASSERT_NE(-1, ret);
92-
EXPECT_PRED2(string_contains_substring, description, expected_buf);
93-
EXPECT_PRED2(string_contains_substring, description, "#1: stderr all=off");
94+
EXPECT_THAT(description, HasSubstr(expected_buf));
95+
EXPECT_THAT(description, HasSubstr("#1: stderr all=off"));
9496

9597
// Verify default decorators are listed
9698
LogDecorators default_decorators;
@@ -107,7 +109,7 @@ TEST_VM_F(LogConfigurationTest, describe) {
107109
ASSERT_NE(-1, ret);
108110
}
109111
}
110-
EXPECT_PRED2(string_contains_substring, description, expected_buf);
112+
EXPECT_THAT(description, HasSubstr(expected_buf));
111113

112114
// Add a new output and verify that it gets described after it has been added
113115
const char* what = "all=trace";
@@ -493,8 +495,8 @@ TEST_VM_F(LogConfigurationTest, parse_invalid_tagset) {
493495
bool success = LogConfiguration::parse_log_arguments("stdout", invalid_tagset, NULL, NULL, &ss);
494496
const char* msg = ss.as_string();
495497
EXPECT_TRUE(success) << "Should only cause a warning, not an error";
496-
EXPECT_TRUE(string_contains_substring(msg, "No tag set matches selection:"));
497-
EXPECT_TRUE(string_contains_substring(msg, invalid_tagset));
498+
EXPECT_THAT(msg, HasSubstr("No tag set matches selection:"));
499+
EXPECT_THAT(msg, HasSubstr(invalid_tagset));
498500
}
499501

500502
TEST_VM_F(LogConfigurationTest, output_name_normalization) {
@@ -559,7 +561,7 @@ TEST_VM_F(LogConfigurationTest, suggest_similar_selection) {
559561

560562
const char* suggestion = ss.as_string();
561563
SCOPED_TRACE(suggestion);
562-
EXPECT_TRUE(string_contains_substring(ss.as_string(), "Did you mean any of the following?"));
564+
EXPECT_THAT(suggestion, HasSubstr("Did you mean any of the following?"));
563565
EXPECT_TRUE(string_contains_substring(suggestion, "logging") ||
564566
string_contains_substring(suggestion, "start") ||
565567
string_contains_substring(suggestion, "exit") ||

test/hotspot/gtest/logging/test_logFileOutput.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ TEST_VM(LogFileOutput, invalid_file) {
188188
EXPECT_FALSE(bad_file.initialize("", &ss))
189189
<< "file was initialized when there was an existing directory with the same name";
190190
char* logger_output = ss.as_string();
191-
EXPECT_TRUE(string_contains_substring(logger_output, expected_output_substring))
191+
EXPECT_THAT(logger_output, testing::HasSubstr(expected_output_substring))
192192
<< "missing expected error message, received msg: %s" << logger_output;
193193
delete_empty_directory(path);
194194
}

test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TEST_VM(LogTagSetDescriptions, describe) {
4242
ResourceMark rm;
4343
stringStream stream;
4444
LogConfiguration::describe(&stream);
45-
EXPECT_PRED2(string_contains_substring, stream.as_string(), expected)
45+
EXPECT_THAT(stream.base(), testing::HasSubstr(expected))
4646
<< "missing log tag set descriptions in LogConfiguration::describe";
4747
}
4848
}

test/hotspot/gtest/memory/test_guardedMemory.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ TEST(GuardedMemory, wrap) {
139139
if (HasFatalFailure()) {
140140
return;
141141
}
142-
EXPECT_EQ(0, strcmp(str, str_copy)) << "Not identical copy";
142+
EXPECT_STREQ(str, str_copy) << "Not identical copy";
143143
EXPECT_TRUE(GuardedMemory::free_copy(str_copy)) << "Free copy failed to verify";
144144

145145
void* no_data = NULL;

test/hotspot/gtest/oops/test_cpCache_output.cpp

+16-26
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,21 @@ TEST_VM(ConstantPoolCache, print_on) {
4242
klass->constants()->cache()->print_on(&ss);
4343

4444
const char* output = ss.freeze();
45-
// method entry test
46-
ASSERT_TRUE(strstr(output, "this") != NULL) << "must have \"this\"";
47-
ASSERT_TRUE(strstr(output, "bytecode 1:") != NULL) << "must have \"bytecode 1\"";
48-
ASSERT_TRUE(strstr(output, "bytecode 2:") != NULL) << "must have \"bytecode 2\"";
49-
ASSERT_TRUE(strstr(output, "cp index:") != NULL) << "must have constant pool index";
50-
ASSERT_TRUE(strstr(output, "F1:") != NULL) << "must have F1 value";
51-
ASSERT_TRUE(strstr(output, "F2:") != NULL) << "must have F2 value";
52-
ASSERT_TRUE(strstr(output, "method:") != NULL) << "must have a method";
53-
ASSERT_TRUE(strstr(output, "flag values:") != NULL) << "must have a flag";
54-
ASSERT_TRUE(strstr(output, "tos:") != NULL) << "must have result type";
55-
ASSERT_TRUE(strstr(output, "local signature:") != NULL) << "must have local signature flag";
56-
ASSERT_TRUE(strstr(output, "has appendix:") != NULL) << "must have appendix flag";
57-
ASSERT_TRUE(strstr(output, "forced virtual:") != NULL) << "must have forced virtual flag";
58-
ASSERT_TRUE(strstr(output, "final:") != NULL) << "must have final flag";
59-
ASSERT_TRUE(strstr(output, "virtual final:") != NULL) << "must have virtual final flag";
60-
ASSERT_TRUE(strstr(output, "resolution failed:") != NULL) << "must have resolution failed flag";
61-
ASSERT_TRUE(strstr(output, "num parameters:") != NULL) << "must have number of parameters";
45+
static const char* const expected_strings[] = {
46+
// Method entry tests:
47+
"this", "bytecode 1:", "bytecode 2:", "cp index:", "F1:", "F2:",
48+
"method:", "flag values:", "tos:", "local signature:", "has appendix:",
49+
"forced virtual:", "final:", "virtual final:", "resolution failed:",
50+
"num parameters:",
51+
52+
// field entry test
53+
"Offset:", "Field Index:", "CP Index:", "TOS:", "Is Final:", "Is Volatile:",
54+
"Put Bytecode:", "Get Bytecode:",
55+
nullptr
56+
};
57+
58+
for (int i = 0; expected_strings[i] != nullptr; i++) {
59+
ASSERT_THAT(output, testing::HasSubstr(expected_strings[i]));
60+
}
6261

63-
// field entry test
64-
ASSERT_TRUE(strstr(output, "Offset:") != NULL) << "must have field offset";
65-
ASSERT_TRUE(strstr(output, "Field Index:") != NULL) << "must have field index";
66-
ASSERT_TRUE(strstr(output, "CP Index:") != NULL) << "must have constant pool index";
67-
ASSERT_TRUE(strstr(output, "TOS:") != NULL) << "must have type";
68-
ASSERT_TRUE(strstr(output, "Is Final:") != NULL) << "must have final flag";
69-
ASSERT_TRUE(strstr(output, "Is Volatile:") != NULL) << "must have volatile flag";
70-
ASSERT_TRUE(strstr(output, "Put Bytecode:") != NULL) << "must have \"put code\"";
71-
ASSERT_TRUE(strstr(output, "Get Bytecode:") != NULL) << "must have \"get code\"";
7262
}

test/hotspot/gtest/oops/test_instanceKlass.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "runtime/interfaceSupport.inline.hpp"
3434
#include "unittest.hpp"
3535

36+
using testing::HasSubstr;
37+
3638
// Tests for InstanceKlass::is_class_loader_instance_klass() function
3739
TEST_VM(InstanceKlass, class_loader_class) {
3840
InstanceKlass* klass = vmClasses::ClassLoader_klass();
@@ -51,20 +53,20 @@ TEST_VM(InstanceKlass, class_loader_printer) {
5153
stringStream st;
5254
loader->print_on(&st);
5355
// See if injected loader_data field is printed in string
54-
ASSERT_TRUE(strstr(st.as_string(), "injected 'loader_data'") != NULL) << "Must contain injected fields";
56+
ASSERT_THAT(st.base(), HasSubstr("injected 'loader_data'")) << "Must contain injected fields";
5557
st.reset();
5658
// See if mirror injected fields are printed.
5759
oop mirror = vmClasses::ClassLoader_klass()->java_mirror();
5860
mirror->print_on(&st);
59-
ASSERT_TRUE(strstr(st.as_string(), "injected 'protection_domain'") != NULL) << "Must contain injected fields";
61+
ASSERT_THAT(st.base(), HasSubstr("injected 'protection_domain'")) << "Must contain injected fields";
6062
// We should test other printing functions too.
6163
#ifndef PRODUCT
6264
st.reset();
6365
// method printing is non-product
6466
Method* method = vmClasses::ClassLoader_klass()->methods()->at(0); // we know there's a method here!
6567
method->print_on(&st);
66-
ASSERT_TRUE(strstr(st.as_string(), "method holder:") != NULL) << "Must contain method_holder field";
67-
ASSERT_TRUE(strstr(st.as_string(), "'java/lang/ClassLoader'") != NULL) << "Must be in ClassLoader";
68+
ASSERT_THAT(st.base(), HasSubstr("method holder:")) << "Must contain method_holder field";
69+
ASSERT_THAT(st.base(), HasSubstr("'java/lang/ClassLoader'")) << "Must be in ClassLoader";
6870
#endif
6971
}
7072

test/hotspot/gtest/oops/test_markWord.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,11 @@
4040

4141
// The test doesn't work for PRODUCT because it needs WizardMode
4242
#ifndef PRODUCT
43-
static bool test_pattern(stringStream* st, const char* pattern) {
44-
return (strstr(st->as_string(), pattern) != NULL);
45-
}
4643

4744
static void assert_test_pattern(Handle object, const char* pattern) {
4845
stringStream st;
4946
object->print_on(&st);
50-
ASSERT_TRUE(test_pattern(&st, pattern)) << pattern << " not in " << st.as_string();
47+
ASSERT_THAT(st.base(), testing::HasSubstr(pattern));
5148
}
5249

5350
class LockerThread : public JavaTestThread {

test/hotspot/gtest/runtime/test_classPrinter.cpp

+13-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "utilities/ostream.hpp"
3030
#include "unittest.hpp"
3131

32+
using testing::HasSubstr;
33+
3234
TEST_VM(ClassPrinter, print_classes) {
3335
JavaThread* THREAD = JavaThread::current();
3436
ThreadInVMfromNative invm(THREAD);
@@ -38,9 +40,9 @@ TEST_VM(ClassPrinter, print_classes) {
3840
ClassPrinter::print_classes("java/lang/Object", 0x03, &ss);
3941
const char* output = ss.freeze();
4042

41-
ASSERT_TRUE(strstr(output, "class java/lang/Object loader data:") != NULL) << "must find java/lang/Object";
42-
ASSERT_TRUE(strstr(output, "method wait : (J)V") != NULL) << "must find java/lang/Object::wait";
43-
ASSERT_TRUE(strstr(output, "method finalize : ()V\n 0 return") != NULL) << "must find java/lang/Object::finalize and disasm";
43+
ASSERT_THAT(output, HasSubstr("class java/lang/Object loader data:")) << "must find java/lang/Object";
44+
ASSERT_THAT(output, HasSubstr("method wait : (J)V")) << "must find java/lang/Object::wait";
45+
ASSERT_THAT(output, HasSubstr("method finalize : ()V\n 0 return")) << "must find java/lang/Object::finalize and disasm";
4446
}
4547

4648
TEST_VM(ClassPrinter, print_methods) {
@@ -51,16 +53,16 @@ TEST_VM(ClassPrinter, print_methods) {
5153
stringStream s1;
5254
ClassPrinter::print_methods("*ang/Object*", "wait", 0x1, &s1);
5355
const char* o1 = s1.freeze();
54-
ASSERT_TRUE(strstr(o1, "class java/lang/Object loader data:") != NULL) << "must find java/lang/Object";
55-
ASSERT_TRUE(strstr(o1, "method wait : (J)V") != NULL) << "must find java/lang/Object::wait(long)";
56-
ASSERT_TRUE(strstr(o1, "method wait : ()V") != NULL) << "must find java/lang/Object::wait()";
57-
ASSERT_TRUE(strstr(o1, "method finalize : ()V") == NULL) << "must not find java/lang/Object::finalize";
56+
ASSERT_THAT(o1, HasSubstr("class java/lang/Object loader data:")) << "must find java/lang/Object";
57+
ASSERT_THAT(o1, HasSubstr("method wait : (J)V")) << "must find java/lang/Object::wait(long)";
58+
ASSERT_THAT(o1, HasSubstr("method wait : ()V")) << "must find java/lang/Object::wait()";
59+
ASSERT_THAT(o1, Not(HasSubstr("method finalize : ()V"))) << "must not find java/lang/Object::finalize";
5860

5961
stringStream s2;
6062
ClassPrinter::print_methods("j*ang/Object*", "wait:(*J*)V", 0x1, &s2);
6163
const char* o2 = s2.freeze();
62-
ASSERT_TRUE(strstr(o2, "class java/lang/Object loader data:") != NULL) << "must find java/lang/Object";
63-
ASSERT_TRUE(strstr(o2, "method wait : (J)V") != NULL) << "must find java/lang/Object::wait(long)";
64-
ASSERT_TRUE(strstr(o2, "method wait : (JI)V") != NULL) << "must find java/lang/Object::wait(long,int)";
65-
ASSERT_TRUE(strstr(o2, "method wait : ()V") == NULL) << "must not find java/lang/Object::wait()";
64+
ASSERT_THAT(o2, HasSubstr("class java/lang/Object loader data:")) << "must find java/lang/Object";
65+
ASSERT_THAT(o2, HasSubstr("method wait : (J)V")) << "must find java/lang/Object::wait(long)";
66+
ASSERT_THAT(o2, HasSubstr("method wait : (JI)V")) << "must find java/lang/Object::wait(long,int)";
67+
ASSERT_THAT(o2, Not(HasSubstr("method wait : ()V"))) << "must not find java/lang/Object::wait()";
6668
}

test/hotspot/gtest/runtime/test_globals.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,19 @@ TEST_VM(FlagGuard, ccstr_flag) {
7777
TEST_VM(FlagAccess, ccstr_flag) {
7878
FLAG_SET_CMDLINE(SharedArchiveConfigFile, "");
7979
ASSERT_EQ(FLAG_IS_CMDLINE(SharedArchiveConfigFile), true);
80-
ASSERT_EQ(strcmp(SharedArchiveConfigFile, ""), 0);
80+
EXPECT_STREQ(SharedArchiveConfigFile, "");
8181

8282
FLAG_SET_ERGO(SharedArchiveConfigFile, "foobar");
8383
ASSERT_EQ(FLAG_IS_ERGO(SharedArchiveConfigFile), true);
84-
ASSERT_EQ(strcmp(SharedArchiveConfigFile, "foobar") , 0);
84+
EXPECT_STREQ(SharedArchiveConfigFile, "foobar");
8585

8686
FLAG_SET_ERGO(SharedArchiveConfigFile, nullptr);
8787
ASSERT_EQ(FLAG_IS_ERGO(SharedArchiveConfigFile), true);
8888
ASSERT_EQ(SharedArchiveConfigFile, nullptr);
8989

9090
FLAG_SET_ERGO(SharedArchiveConfigFile, "xyz");
9191
ASSERT_EQ(FLAG_IS_ERGO(SharedArchiveConfigFile), true);
92-
ASSERT_EQ(strcmp(SharedArchiveConfigFile, "xyz"), 0);
92+
EXPECT_STREQ(SharedArchiveConfigFile, "xyz");
9393
}
9494

9595
template <typename T, int type_enum>

test/hotspot/gtest/runtime/test_os.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#include "os_windows.hpp"
3939
#endif
4040

41+
using testing::HasSubstr;
42+
4143
static size_t small_page_size() {
4244
return os::vm_page_size();
4345
}
@@ -171,7 +173,7 @@ static void do_test_print_hex_dump(address addr, size_t len, int unitsize, const
171173
os::print_hex_dump(&ss, addr, addr + len, unitsize);
172174
// tty->print_cr("expected: %s", expected);
173175
// tty->print_cr("result: %s", buf);
174-
EXPECT_THAT(buf, testing::HasSubstr(expected));
176+
EXPECT_THAT(buf, HasSubstr(expected));
175177
}
176178

177179
TEST_VM(os, test_print_hex_dump) {
@@ -768,7 +770,7 @@ TEST_VM(os, pagesizes_test_print) {
768770
char buffer[256];
769771
stringStream ss(buffer, sizeof(buffer));
770772
pss.print_on(&ss);
771-
ASSERT_EQ(strcmp(expected, buffer), 0);
773+
EXPECT_STREQ(expected, buffer);
772774
}
773775

774776
TEST_VM(os, dll_address_to_function_and_library_name) {
@@ -777,9 +779,9 @@ TEST_VM(os, dll_address_to_function_and_library_name) {
777779
stringStream st(output, sizeof(output));
778780

779781
#define EXPECT_CONTAINS(haystack, needle) \
780-
EXPECT_NE(::strstr(haystack, needle), (char*)NULL)
782+
EXPECT_THAT(haystack, HasSubstr(needle));
781783
#define EXPECT_DOES_NOT_CONTAIN(haystack, needle) \
782-
EXPECT_EQ(::strstr(haystack, needle), (char*)NULL)
784+
EXPECT_THAT(haystack, Not(HasSubstr(needle)));
783785
// #define LOG(...) tty->print_cr(__VA_ARGS__); // enable if needed
784786
#define LOG(...)
785787

test/hotspot/gtest/runtime/test_os_linux.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ TEST(os_linux, addr_to_function_valid) {
433433
int offset = -1;
434434
address valid_function_pointer = (address)JNI_CreateJavaVM;
435435
ASSERT_TRUE(os::dll_address_to_function_name(valid_function_pointer, buf, sizeof(buf), &offset, true));
436-
ASSERT_TRUE(strstr(buf, "JNI_CreateJavaVM") != nullptr);
436+
ASSERT_THAT(buf, testing::HasSubstr("JNI_CreateJavaVM"));
437437
ASSERT_TRUE(offset >= 0);
438438
}
439439

@@ -444,7 +444,7 @@ TEST_VM(os_linux, decoder_get_source_info_valid) {
444444
int line = -1;
445445
address valid_function_pointer = (address)ReportJNIFatalError;
446446
ASSERT_TRUE(Decoder::get_source_info(valid_function_pointer, buf, sizeof(buf), &line));
447-
ASSERT_TRUE(strcmp(buf, "jniCheck.hpp") == 0);
447+
EXPECT_STREQ(buf, "jniCheck.hpp");
448448
ASSERT_TRUE(line > 0);
449449
}
450450

@@ -471,7 +471,7 @@ TEST_VM(os_linux, decoder_get_source_info_valid_overflow) {
471471
int line = -1;
472472
address valid_function_pointer = (address)ReportJNIFatalError;
473473
ASSERT_TRUE(Decoder::get_source_info(valid_function_pointer, buf, 11, &line));
474-
ASSERT_TRUE(strcmp(buf, "<OVERFLOW>") == 0);
474+
EXPECT_STREQ(buf, "<OVERFLOW>");
475475
ASSERT_TRUE(line > 0);
476476
}
477477

@@ -482,7 +482,7 @@ TEST_VM(os_linux, decoder_get_source_info_valid_overflow_minimal) {
482482
int line = -1;
483483
address valid_function_pointer = (address)ReportJNIFatalError;
484484
ASSERT_TRUE(Decoder::get_source_info(valid_function_pointer, buf, 2, &line));
485-
ASSERT_TRUE(strcmp(buf, "L") == 0); // Overflow message does not fit, so we fall back to "L:line_number"
485+
EXPECT_STREQ(buf, "L"); // Overflow message does not fit, so we fall back to "L:line_number"
486486
ASSERT_TRUE(line > 0); // Line should correctly be found and returned
487487
}
488488
#endif // clang

test/hotspot/gtest/utilities/test_globalDefinitions.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,9 @@ TEST(globalDefinitions, array_size) {
226226
stringStream out; \
227227
out.print((format), (value)); \
228228
const char* result = out.as_string(); \
229-
EXPECT_EQ(strcmp(result, (expected)), 0) << "Failed with" \
229+
EXPECT_STREQ((result), (expected)) << "Failed with" \
230230
<< " format '" << (format) << "'" \
231-
<< " value '" << (value) << "'" \
232-
<< " result '" << result << "'" \
233-
<< " expected '" << (expected) << "'"; \
231+
<< " value '" << (value); \
234232
} while (false)
235233

236234
TEST(globalDefinitions, format_specifiers) {

test/hotspot/gtest/utilities/test_parse_memory_size.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static void do_test_valid(T expected_value, const char* pattern) {
6666
ASSERT_TRUE(rc);
6767
ASSERT_EQ(value, expected_value);
6868
ASSERT_EQ(end, ss.base() + strlen(pattern));
69-
ASSERT_EQ(strcmp(end, ":-)"), 0);
69+
EXPECT_STREQ(end, ":-)");
7070

7171
rc = parse_integer(ss.base(), &value);
7272
ASSERT_FALSE(rc);

test/hotspot/gtest/utilities/test_resourceHash.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ TEST_VM_F(ResourceHashtablePrintTest, print_test) {
468468
const char* strings[] = {
469469
"Number of buckets", "Number of entries", "300", "Number of literals", "Average bucket size", "Maximum bucket size" };
470470
for (const auto& str : strings) {
471-
ASSERT_TRUE(strstr(st.as_string(), str) != nullptr) << "string not present " << str;
471+
ASSERT_THAT(st.base(), testing::HasSubstr(str));
472472
}
473473
// Cleanup: need to delete pointers in entries
474474
TableDeleter deleter;

0 commit comments

Comments
 (0)