Vy Nguyen | d500751 | 2020-07-14 17:37:04 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <gtest/gtest.h> |
| 18 | |
| 19 | #include "gtest_globals.h" |
| 20 | #include "utils.h" |
| 21 | |
| 22 | TEST(thread_properties_test, iterate_dts) { |
| 23 | #if defined(__BIONIC__) |
| 24 | const char expected_out[] = |
| 25 | "got test_static_tls_bounds\niterate_cb i = 0\ndone_iterate_dynamic_tls\n"; |
| 26 | std::string helper = GetTestLibRoot() + "tls_properties_helper/tls_properties_helper"; |
| 27 | chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607 |
| 28 | |
| 29 | ExecTestHelper eth; |
| 30 | eth.SetArgs({helper.c_str(), nullptr}); |
| 31 | eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, expected_out); |
| 32 | #endif |
| 33 | } |
| 34 | |
| 35 | TEST(thread_properties_test, thread_exit_cb) { |
| 36 | #if defined(__BIONIC__) |
| 37 | // tests/libs/thread_exit_cb_helper.cpp |
| 38 | const char expected_out[] = "exit_cb_1 called exit_cb_2 called exit_cb_3 called"; |
| 39 | std::string helper = GetTestLibRoot() + "thread_exit_cb_helper/thread_exit_cb_helper"; |
| 40 | chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607 |
| 41 | |
| 42 | ExecTestHelper eth; |
| 43 | eth.SetArgs({helper.c_str(), nullptr}); |
| 44 | eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, expected_out); |
| 45 | |
| 46 | #endif |
| 47 | } |