Pārlūkot izejas kodu

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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303289 91177308-0d34-0410-b5e6-96231b3b80d8

Dimitry Andric 8 gadi atpakaļ
vecāks
revīzija
2d82d17117

+ 3 - 1
unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

@@ -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();