diff options
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) { |