[llvm] r303289 - Reapply part of rL303015, fixing just the DynamicLibaryTest. Add

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 12:46:49 PDT 2017


Author: dim
Date: Wed May 17 14:46:49 2017
New Revision: 303289

URL: http://llvm.org/viewvc/llvm-project?rev=303289&view=rev
Log:
Reapply part of rL303015, fixing just the DynamicLibaryTest.  Add
retrieval of the original argv[0] from the GoogleTest framework, so it
is more likely the correct main executable path is found.

Modified:
    llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

Modified: llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp?rev=303289&r1=303288&r2=303289&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp Wed May 17 14:46:49 2017
@@ -23,8 +23,10 @@ using namespace llvm::sys;
 extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "ProcessCall"; }
 
 std::string LibPath() {
+  const std::vector<testing::internal::string>& Argvs = testing::internal::GetArgvs();
+  const char *Argv0 = Argvs.size() > 0 ? Argvs[0].c_str() : "DynamicLibraryTests";
   void *Ptr = (void*)(intptr_t)TestA;
-  std::string Path = fs::getMainExecutable("DynamicLibraryTests", Ptr);
+  std::string Path = fs::getMainExecutable(Argv0, Ptr);
   llvm::SmallString<256> Buf(path::parent_path(Path));
   path::append(Buf, "PipSqueak.so");
   return Buf.str();




More information about the llvm-commits mailing list