Dimitry Ivanov | 927877c | 2016-09-21 11:17:13 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 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_globals.h" |
| 18 | |
| 19 | #include <gtest/gtest.h> |
| 20 | #include "utils.h" |
| 21 | |
| 22 | #include <string> |
| 23 | |
| 24 | static std::string get_testlib_root() { |
| 25 | std::string out_path; |
| 26 | const char* data_dir = getenv("ANDROID_DATA"); |
| 27 | if (data_dir == nullptr) { |
| 28 | out_path = "/data"; |
| 29 | } else { |
| 30 | out_path = data_dir; |
| 31 | } |
| 32 | |
| 33 | out_path = out_path + "/nativetest"; |
| 34 | #if defined(__LP64__) |
| 35 | out_path += "64"; |
| 36 | #endif |
| 37 | out_path += "/bionic-loader-test-libs"; |
| 38 | std::string real_path; |
| 39 | if (!get_realpath(out_path, &real_path)) { |
| 40 | abort(); |
| 41 | } |
| 42 | |
| 43 | return real_path; |
| 44 | } |
| 45 | |
| 46 | const std::string g_testlib_root = get_testlib_root(); |