summaryrefslogtreecommitdiff
path: root/tests/stack_unwinding_test.cpp
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-06-29 16:22:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-06-29 16:22:10 +0000
commitc0fa380b2a08a30c323b26ed749495b1f36d8be6 (patch)
tree3d942a3ac6295515b8e322cd5d6ac6a7dc81bb09 /tests/stack_unwinding_test.cpp
parentaf1f724947d8a37c13e6e7163ba35481b8ba4dcc (diff)
parent5af6b7975694b08e8e363e9435990f248fbb39ca (diff)
Snap for 7441201 from 5af6b7975694b08e8e363e9435990f248fbb39ca to s-keystone-qcom-release
Change-Id: Ia74024ee27474e3df8196cf7de426c84561361dd
Diffstat (limited to 'tests/stack_unwinding_test.cpp')
-rw-r--r--tests/stack_unwinding_test.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/stack_unwinding_test.cpp b/tests/stack_unwinding_test.cpp
index 2f891a6e1..0ff6f30a6 100644
--- a/tests/stack_unwinding_test.cpp
+++ b/tests/stack_unwinding_test.cpp
@@ -66,28 +66,13 @@ static int noinline unwind_one_frame_deeper() {
return count;
}
-static void UnwindTest() {
+TEST(stack_unwinding, easy) {
int count = 0;
_Unwind_Backtrace(FrameCounter, &count);
int deeper_count = unwind_one_frame_deeper();
ASSERT_EQ(count + 1, deeper_count);
}
-TEST(stack_unwinding, easy) {
- UnwindTest();
-}
-
-TEST(stack_unwinding, thread) {
- pthread_t thread;
- ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* {
- UnwindTest();
- return nullptr;
- }, nullptr));
- void *retval;
- ASSERT_EQ(0, pthread_join(thread, &retval));
- EXPECT_EQ(nullptr, retval);
-}
-
struct UnwindData {
volatile bool signal_handler_complete = false;
int expected_frame_count = 0;
@@ -113,7 +98,7 @@ static void verify_unwind_data(const UnwindData& unwind_data) {
EXPECT_EQ(unwind_data.handler_frame_count + 1, unwind_data.handler_one_deeper_frame_count);
}
-static void noinline SignalUnwindTest() {
+static void noinline UnwindTest() {
g_unwind_data = {};
_Unwind_Backtrace(FrameCounter, &g_unwind_data.expected_frame_count);
@@ -129,12 +114,12 @@ static void noinline SignalUnwindTest() {
TEST(stack_unwinding, unwind_through_signal_frame) {
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler);
- SignalUnwindTest();
+ UnwindTest();
}
// On LP32, the SA_SIGINFO flag gets you __restore_rt instead of __restore.
TEST(stack_unwinding, unwind_through_signal_frame_SA_SIGINFO) {
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler, SA_SIGINFO);
- SignalUnwindTest();
+ UnwindTest();
}