[PATCH] D51745: Add libgtest_main as a dependency of libLLVMTestingSupport

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 6 14:01:35 PDT 2018


dschuff updated this revision to Diff 164284.
dschuff added a comment.

- Pass the binary name as a parameter instead


Repository:
  rL LLVM

https://reviews.llvm.org/D51745

Files:
  include/llvm/Testing/Support/SupportHelpers.h
  lib/Testing/Support/SupportHelpers.cpp
  unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp


Index: unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp
===================================================================
--- unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp
+++ unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp
@@ -23,8 +23,10 @@
 using namespace llvm;
 using namespace llvm::pdb;
 
+extern const char *TestMainArgv0;
+
 TEST(NativeSymbolReuseTest, GlobalSymbolReuse) {
-  SmallString<128> InputsDir = unittest::getInputFileDirectory();
+  SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0);
   llvm::sys::path::append(InputsDir, "empty.pdb");
 
   std::unique_ptr<IPDBSession> S;
@@ -51,7 +53,7 @@
 }
 
 TEST(NativeSymbolReuseTest, CompilandSymbolReuse) {
-  SmallString<128> InputsDir = unittest::getInputFileDirectory();
+  SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0);
   llvm::sys::path::append(InputsDir, "empty.pdb");
 
   std::unique_ptr<IPDBSession> S;
@@ -93,7 +95,7 @@
 }
 
 TEST(NativeSymbolReuseTest, CompilandSymbolReuseBackwards) {
-  SmallString<128> InputsDir = unittest::getInputFileDirectory();
+  SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0);
   llvm::sys::path::append(InputsDir, "empty.pdb");
 
   std::unique_ptr<IPDBSession> S;
Index: lib/Testing/Support/SupportHelpers.cpp
===================================================================
--- lib/Testing/Support/SupportHelpers.cpp
+++ lib/Testing/Support/SupportHelpers.cpp
@@ -13,10 +13,8 @@
 using namespace llvm;
 using namespace llvm::unittest;
 
-extern const char *TestMainArgv0;
-
-SmallString<128> llvm::unittest::getInputFileDirectory() {
-  llvm::SmallString<128> Result = llvm::sys::path::parent_path(TestMainArgv0);
+SmallString<128> llvm::unittest::getInputFileDirectory(const char *TestBinary) {
+  llvm::SmallString<128> Result = llvm::sys::path::parent_path(TestBinary);
   llvm::sys::fs::make_absolute(Result);
   llvm::sys::path::append(Result, "llvm.srcdir.txt");
 
Index: include/llvm/Testing/Support/SupportHelpers.h
===================================================================
--- include/llvm/Testing/Support/SupportHelpers.h
+++ include/llvm/Testing/Support/SupportHelpers.h
@@ -56,7 +56,7 @@
 } // namespace detail
 
 namespace unittest {
-SmallString<128> getInputFileDirectory();
+SmallString<128> getInputFileDirectory(const char *TestBinary);
 }
 } // namespace llvm
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51745.164284.patch
Type: text/x-patch
Size: 2392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180906/654672a8/attachment.bin>


More information about the llvm-commits mailing list