From a77d80e757630e5cbc62f39690df99907ecaf1a6 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Wed, 31 Jul 2019 11:05:16 +0100 Subject: IVGCVSW-3561 Use absolute path of unit tests * Using the absolute path of the unit tests executable so that the unit tests can be run from anywhere and the relative path to the test shared objects would still work Signed-off-by: Matteo Martincigh Change-Id: I57401daa162570e9ab1717d28a54a19f421afb0e --- src/backends/backendsCommon/test/DynamicBackendTests.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backends/backendsCommon/test/DynamicBackendTests.hpp b/src/backends/backendsCommon/test/DynamicBackendTests.hpp index 1b3edc5e22..2bc4558500 100644 --- a/src/backends/backendsCommon/test/DynamicBackendTests.hpp +++ b/src/backends/backendsCommon/test/DynamicBackendTests.hpp @@ -15,6 +15,7 @@ #include #include +#include static std::string g_TestSharedObjectSubDir = "src/backends/backendsCommon/test/"; static std::string g_TestSharedObjectFileName = "libarmnnTestSharedObject.so"; @@ -31,8 +32,8 @@ std::string GetTestFilePath(const std::string& fileName) { using namespace boost::filesystem; - path currentPath(current_path()); - path sharedObjectPath = currentPath.append(g_TestSharedObjectSubDir); + path programLocation = boost::dll::program_location().parent_path(); + path sharedObjectPath = programLocation.append(g_TestSharedObjectSubDir); path sharedObjectFile = sharedObjectPath.append(fileName); BOOST_TEST(exists(sharedObjectFile)); -- cgit v1.2.1