Fix asan builds
When rolling this into Chrome, we got compile failures due to DoNullPointerDereference being undefined but the new FirstChanceHandlerRuns tests depends on this and was still defined. The fix is to only enable the FirstChanceHandlerRuns test on non-asan builds. Bug: Change-Id: I5a3da0a21e2d0dd663ffc01137496d16905293a6 Reviewed-on: https://chromium-review.googlesource.com/544186 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
1628d99f7b
commit
66856d617b
1 changed files with 23 additions and 23 deletions
|
@ -465,6 +465,29 @@ TEST(ExceptionHandlerTest, StackedHandlersUnhandledToBottom) {
|
|||
ASSERT_NO_FATAL_FAILURE(WaitForProcessToTerminate(child, SIGKILL));
|
||||
}
|
||||
|
||||
namespace {
|
||||
const int kSimpleFirstChanceReturnStatus = 42;
|
||||
bool SimpleFirstChanceHandler(int, void*, void*) {
|
||||
exit(kSimpleFirstChanceReturnStatus);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ExceptionHandlerTest, FirstChanceHandlerRuns) {
|
||||
AutoTempDir temp_dir;
|
||||
|
||||
const pid_t child = fork();
|
||||
if (child == 0) {
|
||||
ExceptionHandler handler(
|
||||
MinidumpDescriptor(temp_dir.path()), NULL, NULL, NULL, true, -1);
|
||||
google_breakpad::SetFirstChanceExceptionHandler(SimpleFirstChanceHandler);
|
||||
DoNullPointerDereference();
|
||||
}
|
||||
int status;
|
||||
ASSERT_NE(HANDLE_EINTR(waitpid(child, &status, 0)), -1);
|
||||
ASSERT_TRUE(WIFEXITED(status));
|
||||
ASSERT_EQ(kSimpleFirstChanceReturnStatus, WEXITSTATUS(status));
|
||||
}
|
||||
|
||||
#endif // !ADDRESS_SANITIZER
|
||||
|
||||
const unsigned char kIllegalInstruction[] = {
|
||||
|
@ -1177,26 +1200,3 @@ TEST(ExceptionHandlerTest, WriteMinidumpForChild) {
|
|||
close(fds[1]);
|
||||
unlink(minidump_filename.c_str());
|
||||
}
|
||||
|
||||
namespace {
|
||||
const int kSimpleFirstChanceReturnStatus = 42;
|
||||
bool SimpleFirstChanceHandler(int, void*, void*) {
|
||||
exit(kSimpleFirstChanceReturnStatus);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ExceptionHandlerTest, FirstChanceHandlerRuns) {
|
||||
AutoTempDir temp_dir;
|
||||
|
||||
const pid_t child = fork();
|
||||
if (child == 0) {
|
||||
ExceptionHandler handler(
|
||||
MinidumpDescriptor(temp_dir.path()), NULL, NULL, NULL, true, -1);
|
||||
google_breakpad::SetFirstChanceExceptionHandler(SimpleFirstChanceHandler);
|
||||
DoNullPointerDereference();
|
||||
}
|
||||
int status;
|
||||
ASSERT_NE(HANDLE_EINTR(waitpid(child, &status, 0)), -1);
|
||||
ASSERT_TRUE(WIFEXITED(status));
|
||||
ASSERT_EQ(kSimpleFirstChanceReturnStatus, WEXITSTATUS(status));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue