aboutsummaryrefslogtreecommitdiff
path: root/tests/stack_unwinding_test.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2014-12-02 09:57:45 -0800
committerYabin Cui <yabinc@google.com>2014-12-02 10:35:25 -0800
commite323e99ffbf9e508e74a261f1075433f5a81677f (patch)
tree25b285da6eaebd2978c6a5e6627e9cc0f1b54394 /tests/stack_unwinding_test.cpp
parent8374a5481394e89c46ecc0b7cf60381637edaaa5 (diff)
downloadbionic-e323e99ffbf9e508e74a261f1075433f5a81677f.tar.gz
restore sigprocmask in setjmp/longjmp test.
Bug: 18571921 Change-Id: Ib8ca7a36abd3ccc729c20c0e32d45b1b33069f65
Diffstat (limited to 'tests/stack_unwinding_test.cpp')
-rw-r--r--tests/stack_unwinding_test.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/stack_unwinding_test.cpp b/tests/stack_unwinding_test.cpp
index 3fc45c537..3d3f22df5 100644
--- a/tests/stack_unwinding_test.cpp
+++ b/tests/stack_unwinding_test.cpp
@@ -73,6 +73,7 @@ TEST(stack_unwinding, easy) {
ASSERT_EQ(count + 1, deeper_count);
}
+static volatile bool signal_handler_run = false;
static int killer_count = 0;
static int handler_count = 0;
static int handler_one_deeper_count = 0;
@@ -83,6 +84,7 @@ static void noinline UnwindSignalHandler(int) {
handler_one_deeper_count = unwind_one_frame_deeper();
ASSERT_EQ(handler_count + 1, handler_one_deeper_count);
+ signal_handler_run = true;
}
TEST(stack_unwinding, unwind_through_signal_frame) {
@@ -90,8 +92,9 @@ TEST(stack_unwinding, unwind_through_signal_frame) {
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler);
_Unwind_Backtrace(FrameCounter, &killer_count);
-
+ signal_handler_run = false;
ASSERT_EQ(0, kill(getpid(), SIGUSR1));
+ while (!signal_handler_run) {}
}
// On LP32, the SA_SIGINFO flag gets you __restore_rt instead of __restore.
@@ -100,6 +103,7 @@ TEST(stack_unwinding, unwind_through_signal_frame_SA_SIGINFO) {
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler, SA_SIGINFO);
_Unwind_Backtrace(FrameCounter, &killer_count);
-
+ signal_handler_run = false;
ASSERT_EQ(0, kill(getpid(), SIGUSR1));
+ while (!signal_handler_run) {}
}