瀏覽代碼

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 年之前
父節點
當前提交
da1fb73ad2
共有 1 個文件被更改,包括 5 次插入1 次删除
  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());