2016-09-21 20:17:13 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gtest_globals.h"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "utils.h"
|
|
|
|
|
2017-03-16 19:34:13 +01:00
|
|
|
#include <android-base/file.h>
|
|
|
|
|
2016-09-21 20:17:13 +02:00
|
|
|
#include <string>
|
|
|
|
|
2024-03-12 23:37:13 +01:00
|
|
|
std::string GetTestLibRoot() {
|
2020-06-16 00:22:10 +02:00
|
|
|
// Typically the executable is /data/nativetest[64]/bionic-unit-tests/bionic-unit-tests, and the
|
2021-09-25 02:49:58 +02:00
|
|
|
// test libraries are in /data/nativetest[64]/bionic-unit-tests/bionic-loader-test-libs.
|
|
|
|
std::string path = android::base::GetExecutableDirectory();
|
2017-01-24 22:12:07 +01:00
|
|
|
|
2016-09-21 20:17:13 +02:00
|
|
|
std::string out_path;
|
2017-03-16 19:34:13 +01:00
|
|
|
if (!android::base::Realpath(path.c_str(), &out_path)) {
|
2020-05-31 01:46:20 +02:00
|
|
|
printf("Failed to get realpath for \"%s\"\n", path.c_str());
|
2017-01-24 22:12:07 +01:00
|
|
|
abort();
|
2016-09-21 20:17:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
out_path += "/bionic-loader-test-libs";
|
2016-11-25 21:23:11 +01:00
|
|
|
|
2016-09-21 20:17:13 +02:00
|
|
|
std::string real_path;
|
2017-03-16 19:34:13 +01:00
|
|
|
if (!android::base::Realpath(out_path, &real_path)) {
|
2020-05-31 01:46:20 +02:00
|
|
|
printf("\"%s\": does not exists\n", out_path.c_str());
|
2016-09-21 20:17:13 +02:00
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
return real_path;
|
|
|
|
}
|