From: Matteo Martincigh Date: Wed, 31 Jul 2019 10:05:16 +0000 (+0100) Subject: IVGCVSW-3561 Use absolute path of unit tests X-Git-Tag: submit/tizen/20200316.035456~399 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a77d80e757630e5cbc62f39690df99907ecaf1a6;p=platform%2Fupstream%2Farmnn.git 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 --- diff --git a/src/backends/backendsCommon/test/DynamicBackendTests.hpp b/src/backends/backendsCommon/test/DynamicBackendTests.hpp index 1b3edc5..2bc4558 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));