llvm.org GIT mirror llvm / 2d82d17
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 3 years ago
1 changed file(s) with 3 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
2222 extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "ProcessCall"; }
2323
2424 std::string LibPath() {
25 const std::vector& Argvs = testing::internal::GetArgvs();
26 const char *Argv0 = Argvs.size() > 0 ? Argvs[0].c_str() : "DynamicLibraryTests";
2527 void *Ptr = (void*)(intptr_t)TestA;
26 std::string Path = fs::getMainExecutable("DynamicLibraryTests", Ptr);
28 std::string Path = fs::getMainExecutable(Argv0, Ptr);
2729 llvm::SmallString<256> Buf(path::parent_path(Path));
2830 path::append(Buf, "PipSqueak.so");
2931 return Buf.str();