summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Josh Gao <jmgao@google.com> 2021-03-23 14:18:01 -0700
committer Josh Gao <jmgao@google.com> 2021-03-24 17:54:29 +0000
commit25e60fc34a1a746c377c80cf36284cd60d4204c8 (patch)
treee06f268e2cc1527164e916e53c6f37eb22c28724
parent43c9cd7938a53265ea9899a604b409ce070cc2c5 (diff)
Properly fix sigchain EnsureFrontOfChain test.
Test: art_sigchain_tests on host Change-Id: I051062192b0068571732af1f968455952b9a3207
-rw-r--r--sigchainlib/sigchain_test.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sigchainlib/sigchain_test.cc b/sigchainlib/sigchain_test.cc
index dfa3b37fcf..249fff1a5e 100644
--- a/sigchainlib/sigchain_test.cc
+++ b/sigchainlib/sigchain_test.cc
@@ -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);