diff options
author | Steven Moreland <smoreland@google.com> | 2017-07-14 12:49:28 -0700 |
---|---|---|
committer | Zhuoyao Zhang <zhuoyao@google.com> | 2017-07-20 22:15:21 -0700 |
commit | f7dea69ebaf7ab297715f93e4102af3ad16089e5 (patch) | |
tree | f18c84f5b05a411229d99aaea78c4c0aba979599 | |
parent | 5b14b7d285debc383467082066b31f4facd3eea1 (diff) | |
download | libhidl-f7dea69ebaf7ab297715f93e4102af3ad16089e5.tar.gz |
Allow VTS to load test HALs from data.
* This uses the TREBLE_TESTING_OVERRIDE flag which was previously only set by hidl-gen code.
b/63707685 is filed for this coupling.
* Lookup additional directory VTS_ROOT_PATH/system/lib(64) to search for -impl.so where
VTS_ROOT_PATH is an enviroment variable.
Test: make vts
vts-tradefed run vts -m VtsHidlUniTest.
Bug: 63707685
Bug: 63704014
Change-Id: Icdc486cc862adb2d93c4916f1cdf3bcafa971c69
-rw-r--r-- | transport/ServiceManagement.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp index 8be2c76..663c6b5 100644 --- a/transport/ServiceManagement.cpp +++ b/transport/ServiceManagement.cpp @@ -271,9 +271,21 @@ struct PassthroughServiceManager : IServiceManager { dlerror(); // clear - for (const std::string &path : { - HAL_LIBRARY_PATH_ODM, HAL_LIBRARY_PATH_VENDOR, HAL_LIBRARY_PATH_SYSTEM - }) { + std::vector<std::string> paths = {HAL_LIBRARY_PATH_ODM, HAL_LIBRARY_PATH_VENDOR, + HAL_LIBRARY_PATH_SYSTEM}; +#ifdef LIBHIDL_TARGET_DEBUGGABLE + const char* env = std::getenv("TREBLE_TESTING_OVERRIDE"); + const bool trebleTestingOverride = env && !strcmp(env, "true"); + if (trebleTestingOverride) { + const char* vtsRootPath = std::getenv("VTS_ROOT_PATH"); + if (vtsRootPath && strlen(vtsRootPath) > 0) { + const std::string halLibraryPathVtsOverride = + std::string(vtsRootPath) + HAL_LIBRARY_PATH_SYSTEM; + paths.push_back(halLibraryPathVtsOverride); + } + } +#endif + for (const std::string& path : paths) { std::vector<std::string> libs = search(path, prefix, ".so"); for (const std::string &lib : libs) { |