Skip to content

Commit 63322a2

Browse files
Abseil Teamcopybara-github
authored andcommitted
Replace CHECKs with ASSERTs and EXPECTs -- no reason to crash on failure.
PiperOrigin-RevId: 666760220 Change-Id: I9e85d4db0442546bdebc13b0a6e6d9c7f8d3c459
1 parent fd58e18 commit 63322a2

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

absl/debugging/symbolize_test.cc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithReturnAddress() {
167167
#if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE)
168168
void *return_address = __builtin_return_address(0);
169169
const char *symbol = TrySymbolize(return_address);
170-
CHECK_NE(symbol, nullptr) << "TestWithReturnAddress failed";
171-
CHECK_STREQ(symbol, "main") << "TestWithReturnAddress failed";
172-
std::cout << "TestWithReturnAddress passed" << std::endl;
170+
ASSERT_NE(symbol, nullptr) << "TestWithReturnAddress failed";
171+
EXPECT_STREQ(symbol, "main") << "TestWithReturnAddress failed";
173172
#endif
174173
}
175174

@@ -490,10 +489,9 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
490489
(defined(__i386__) || defined(__x86_64__))
491490
void *pc = non_inline_func();
492491
const char *symbol = TrySymbolize(pc);
493-
CHECK_NE(symbol, nullptr) << "TestWithPCInsideNonInlineFunction failed";
494-
CHECK_STREQ(symbol, "non_inline_func")
492+
ASSERT_NE(symbol, nullptr) << "TestWithPCInsideNonInlineFunction failed";
493+
EXPECT_STREQ(symbol, "non_inline_func")
495494
<< "TestWithPCInsideNonInlineFunction failed";
496-
std::cout << "TestWithPCInsideNonInlineFunction passed" << std::endl;
497495
#endif
498496
}
499497

@@ -502,9 +500,8 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
502500
(defined(__i386__) || defined(__x86_64__))
503501
void *pc = inline_func(); // Must be inlined.
504502
const char *symbol = TrySymbolize(pc);
505-
CHECK_NE(symbol, nullptr) << "TestWithPCInsideInlineFunction failed";
506-
CHECK_STREQ(symbol, __FUNCTION__) << "TestWithPCInsideInlineFunction failed";
507-
std::cout << "TestWithPCInsideInlineFunction passed" << std::endl;
503+
ASSERT_NE(symbol, nullptr) << "TestWithPCInsideInlineFunction failed";
504+
EXPECT_STREQ(symbol, __FUNCTION__) << "TestWithPCInsideInlineFunction failed";
508505
#endif
509506
}
510507
}
@@ -545,9 +542,8 @@ __attribute__((target("arm"))) int ArmThumbOverlapArm(int x) {
545542
void ABSL_ATTRIBUTE_NOINLINE TestArmThumbOverlap() {
546543
#if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE)
547544
const char *symbol = TrySymbolize((void *)&ArmThumbOverlapArm);
548-
CHECK_NE(symbol, nullptr) << "TestArmThumbOverlap failed";
549-
CHECK_STREQ("ArmThumbOverlapArm()", symbol) << "TestArmThumbOverlap failed";
550-
std::cout << "TestArmThumbOverlap passed" << std::endl;
545+
ASSERT_NE(symbol, nullptr) << "TestArmThumbOverlap failed";
546+
EXPECT_STREQ("ArmThumbOverlapArm()", symbol) << "TestArmThumbOverlap failed";
551547
#endif
552548
}
553549

0 commit comments

Comments
 (0)