Fix the stack protector death test.

Now __stack_chk_fail calls abort(3) directly, we terminate with
SIGSEGV rather than SIGABRT. (Because of the workaround for the
debuggerd lossage in the abort(3) implementation, which was the
motivation for switching __stack_chk_fail over to abort(3).)

Also clarify the comment on the weird pthread death test, so it
doesn't get copied and pasted onto real death tests.

Change-Id: Ie832eaded61359c99e7a10db65e28f35e8f63eed
This commit is contained in:
Elliott Hughes 2013-02-14 16:33:52 -08:00
parent 0a2cb81597
commit 7fd803cdfa
2 changed files with 4 additions and 6 deletions

View File

@ -149,12 +149,12 @@ static void TestBug37410() {
pthread_exit(NULL); pthread_exit(NULL);
} }
// We have to say "DeathTest" here so gtest knows to run this test (which exits) // Even though this isn't really a death test, we have to say "DeathTest" here so gtest knows to
// in its own process. // run this test (which exits normally) in its own process.
TEST(pthread_DeathTest, pthread_bug_37410) { TEST(pthread_DeathTest, pthread_bug_37410) {
// http://code.google.com/p/android/issues/detail?id=37410 // http://code.google.com/p/android/issues/detail?id=37410
::testing::FLAGS_gtest_death_test_style = "threadsafe"; ::testing::FLAGS_gtest_death_test_style = "threadsafe";
EXPECT_EXIT(TestBug37410(), ::testing::ExitedWithCode(0), ""); ASSERT_EXIT(TestBug37410(), ::testing::ExitedWithCode(0), "");
} }
#endif #endif

View File

@ -117,11 +117,9 @@ static void do_modify_stack_chk_guard() {
__stack_chk_guard = 0x12345678; __stack_chk_guard = 0x12345678;
} }
// We have to say "DeathTest" here so gtest knows to run this test (which exits)
// in its own process.
TEST(stack_protector_DeathTest, modify_stack_protector) { TEST(stack_protector_DeathTest, modify_stack_protector) {
::testing::FLAGS_gtest_death_test_style = "threadsafe"; ::testing::FLAGS_gtest_death_test_style = "threadsafe";
ASSERT_EXIT(do_modify_stack_chk_guard(), testing::KilledBySignal(SIGABRT), ""); ASSERT_EXIT(do_modify_stack_chk_guard(), testing::KilledBySignal(SIGSEGV), "");
} }
#endif #endif