2 * Copyright (C) 2016 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "gtest_globals.h"
19 #include <gtest/gtest.h>
24 static std::string init_testlib_root() {
25 // Calculate ANDROID_DATA assuming the binary is in "$ANDROID_DATA/somedir/binary-dir/binary"
26 std::string path = get_executable_path();
28 path = get_dirname(path.c_str());
32 if (!get_realpath(path.c_str(), &out_path)) {
33 printf("Failed to get realpath for \"%s\"", path.c_str());
37 out_path += "/bionic-loader-test-libs";
39 std::string real_path;
40 if (!get_realpath(out_path, &real_path)) {
41 printf("\"%s\": does not exists", out_path.c_str());
48 const std::string& get_testlib_root() {
49 static const std::string testlib_root = init_testlib_root();