Skip to content

Commit

Permalink
Properly fix sigchain EnsureFrontOfChain test. am: 25e60fc am: 3afeaa0
Browse files Browse the repository at this point in the history
…am: 039355d

Original change: https://android-review.googlesource.com/c/platform/art/+/1650662

Change-Id: Ia1a8415f9afcff08f00ec14d4477b340e437d363
  • Loading branch information
jmgao authored and android-build-merge-worker-robot committed Mar 24, 2021
2 parents 5cb8258 + 039355d commit 5fbbb2c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sigchainlib/sigchain_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,20 @@ TEST_F(SigchainTest, EnsureFrontOfChain) {
void* libc = dlopen(kLibcSoName, RTLD_LAZY | RTLD_NOLOAD);
ASSERT_TRUE(libc);

auto libc_sigaction = reinterpret_cast<decltype(&sigaction)>(dlsym(libc, "sigaction"));
ASSERT_TRUE(libc_sigaction);

static sig_atomic_t called = 0;
struct sigaction action = {};
action.sa_flags = SA_SIGINFO;
action.sa_sigaction = [](int, siginfo_t*, void*) { called = 1; };

ASSERT_EQ(0, sigaction(SIGSEGV, &action, nullptr));
ASSERT_EQ(0, libc_sigaction(SIGSEGV, &action, nullptr));

// Try before EnsureFrontOfChain.
RaiseHandled();
ASSERT_EQ(0, called);
ASSERT_EQ(1, called);
called = 0;

RaiseUnhandled();
ASSERT_EQ(1, called);
Expand Down

0 comments on commit 5fbbb2c

Please sign in to comment.