diff options
author | Jaesung Chung <jaesung@google.com> | 2017-06-15 18:20:34 +0900 |
---|---|---|
committer | Jaesung Chung <jaesung@google.com> | 2017-06-16 19:16:50 +0900 |
commit | 58778e138ee35c6179c8c62ac4157f80a4e63e3c (patch) | |
tree | 863cfd6037443f5da617ffacf3f0eb4ea4ab2a3f /debuggerd/debuggerd_test.cpp | |
parent | 72ca50359e5b0ad4930fbc7e0762285e317e7f85 (diff) |
debuggerd_test: find backtrace frame in all lines in CrasherTest
Kernel can use vsyscall for system calls. The vsyscall implementation in
the kernel gives one more depth in the backtrace. It leads to failures
on CrasherTest. This CL makes tests find a system call frame not only in
the first line but also in all lines on the backtrace.
Bug: 62600694
Test: passes all CrasherTests.
Change-Id: Ice383bb94db097e7e9a9e4f74d8fa5ecc528122a
Diffstat (limited to 'debuggerd/debuggerd_test.cpp')
-rw-r--r-- | debuggerd/debuggerd_test.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp index da8ad37c5..4660f3df4 100644 --- a/debuggerd/debuggerd_test.cpp +++ b/debuggerd/debuggerd_test.cpp @@ -88,6 +88,10 @@ constexpr char kWaitForGdbKey[] = "debug.debuggerd.wait_for_gdb"; } \ } while (0) +#define ASSERT_BACKTRACE_FRAME(result, frame_name) \ + ASSERT_MATCH(result, R"(#\d\d pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX \ + R"(/libc.so \()" frame_name R"(\+)") + static void tombstoned_intercept(pid_t target_pid, unique_fd* intercept_fd, unique_fd* output_fd, InterceptStatus* status, DebuggerdDumpType intercept_type) { intercept_fd->reset(socket_local_client(kTombstonedInterceptSocketName, @@ -307,7 +311,7 @@ TEST_F(CrasherTest, abort) { std::string result; ConsumeFd(std::move(output_fd), &result); - ASSERT_MATCH(result, R"(#00 pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX R"(/libc.so \(tgkill)"); + ASSERT_BACKTRACE_FRAME(result, "tgkill"); } TEST_F(CrasherTest, signal) { @@ -443,7 +447,7 @@ TEST_F(CrasherTest, backtrace) { FinishIntercept(&intercept_result); ASSERT_EQ(1, intercept_result) << "tombstoned reported failure"; ConsumeFd(std::move(output_fd), &result); - ASSERT_MATCH(result, R"(#00 pc [0-9a-f]+ /system/lib)" ARCH_SUFFIX R"(/libc.so \(read\+)"); + ASSERT_BACKTRACE_FRAME(result, "read"); int status; ASSERT_EQ(0, waitpid(crasher_pid, &status, WNOHANG | WUNTRACED)); @@ -454,7 +458,7 @@ TEST_F(CrasherTest, backtrace) { FinishIntercept(&intercept_result); ASSERT_EQ(1, intercept_result) << "tombstoned reported failure"; ConsumeFd(std::move(output_fd), &result); - ASSERT_MATCH(result, R"(#00 pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX R"(/libc.so \(tgkill)"); + ASSERT_BACKTRACE_FRAME(result, "tgkill"); } TEST_F(CrasherTest, PR_SET_DUMPABLE_0_crash) { @@ -474,7 +478,7 @@ TEST_F(CrasherTest, PR_SET_DUMPABLE_0_crash) { std::string result; ConsumeFd(std::move(output_fd), &result); - ASSERT_MATCH(result, R"(#00 pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX R"(/libc.so \(tgkill)"); + ASSERT_BACKTRACE_FRAME(result, "tgkill"); } TEST_F(CrasherTest, capabilities) { @@ -531,7 +535,7 @@ TEST_F(CrasherTest, capabilities) { ASSERT_EQ(1, intercept_result) << "tombstoned reported failure"; ConsumeFd(std::move(output_fd), &result); ASSERT_MATCH(result, R"(name: thread_name\s+>>> .+debuggerd_test(32|64) <<<)"); - ASSERT_MATCH(result, R"(#00 pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX R"(/libc.so \(tgkill)"); + ASSERT_BACKTRACE_FRAME(result, "tgkill"); } TEST_F(CrasherTest, fake_pid) { @@ -562,7 +566,7 @@ TEST_F(CrasherTest, fake_pid) { std::string result; ConsumeFd(std::move(output_fd), &result); - ASSERT_MATCH(result, R"(#00 pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX R"(/libc.so \(tgkill)"); + ASSERT_BACKTRACE_FRAME(result, "tgkill"); } TEST(crash_dump, zombie) { |