Bläddra i källkod

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 år sedan
förälder
incheckning
da1fb73ad2
1 ändrade filer med 5 tillägg och 1 borttagningar
  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());