Pārlūkot izejas kodu

HPCC-21073 Unittests -l generates different result depend on the location where it is executed.

Convert the binary execution path from relative to absolute and use
it to determine the lib path.

Tested manually inside the opt/HPCCSystems/bin/ and outside.
The number of listed test modules are same.

Signed-off-by: Attila Vamos <attila.vamos@gmail.com>
Attila Vamos 6 gadi atpakaļ
vecāks
revīzija
da1fb73ad2
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. 5 1
      testing/unittests/unittests.cpp

+ 5 - 1
testing/unittests/unittests.cpp

@@ -182,9 +182,13 @@ int main(int argc, char* argv[])
 
     if (useDefaultLocations)
     {
+        StringBuffer binDir;
+        makeAbsolutePath(argv[0], binDir, true);
+
         // Default library location depends on the executable location...
         StringBuffer dir;
-        splitFilename(argv[0], &dir, &dir, NULL, NULL);
+        splitFilename(binDir.str(), &dir, &dir, NULL, NULL);
+
         dir.replaceString(PATHSEPSTR "bin" PATHSEPSTR, PATHSEPSTR "lib" PATHSEPSTR);
         if (verbose)
             DBGLOG("Adding default library location %s", dir.str());