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 
TEST(thread_properties_test,iterate_dts)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   ExecTestHelper eth;
28   eth.SetArgs({helper.c_str(), nullptr});
29   eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, expected_out);
30 #endif
31 }
32 
TEST(thread_properties_test,thread_exit_cb)33 TEST(thread_properties_test, thread_exit_cb) {
34 #if defined(__BIONIC__)
35   // tests/libs/thread_exit_cb_helper.cpp
36   const char expected_out[] = "exit_cb_1 called exit_cb_2 called exit_cb_3 called";
37   std::string helper = GetTestLibRoot() + "thread_exit_cb_helper/thread_exit_cb_helper";
38   ExecTestHelper eth;
39   eth.SetArgs({helper.c_str(), nullptr});
40   eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, expected_out);
41 #endif
42 }
43