restore sigprocmask in setjmp/longjmp test.
Bug: 18571921
Change-Id: Ib8ca7a36abd3ccc729c20c0e32d45b1b33069f65
diff --git a/tests/stack_unwinding_test.cpp b/tests/stack_unwinding_test.cpp
index 3fc45c5..3d3f22d 100644
--- a/tests/stack_unwinding_test.cpp
+++ b/tests/stack_unwinding_test.cpp
@@ -73,6 +73,7 @@
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 @@
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 @@
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 @@
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) {}
}