Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 205d51d3 authored by Jaesung Chung's avatar Jaesung Chung Committed by android-build-merger
Browse files

Merge "debuggerd_test: find backtrace frame in all lines in CrasherTest" am: fae8ec25

am: 82e543af

Change-Id: Ib0a0ec0c94d8fff34d1390d44623697a51a0e317
parents fe361ae7 82e543af
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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) {