[PATCH] D56324: [gn build] Add build file for DebugInfoPDBTests

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 16:20:58 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350447: [gn build] Add build file for DebugInfoPDBTests (authored by nico, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56324?vs=180308&id=180338#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56324/new/

https://reviews.llvm.org/D56324

Files:
  llvm/trunk/utils/gn/secondary/llvm/unittests/BUILD.gn
  llvm/trunk/utils/gn/secondary/llvm/unittests/DebugInfo/PDB/BUILD.gn
  llvm/trunk/utils/gn/secondary/llvm/utils/unittest/unittest.gni


Index: llvm/trunk/utils/gn/secondary/llvm/unittests/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/llvm/unittests/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/llvm/unittests/BUILD.gn
@@ -14,9 +14,7 @@
     "DebugInfo/CodeView:DebugInfoCodeViewTests",
     "DebugInfo/DWARF:DebugInfoDWARFTests",
     "DebugInfo/MSF:DebugInfoMSFTests",
-
-    # FIXME: Add.
-    #"DebugInfo/PDB:DebugInfoPDBTests",
+    "DebugInfo/PDB:DebugInfoPDBTests",
     "Demangle:DemangleTests",
 
     # FIXME: Add.
@@ -55,7 +53,7 @@
     "tools/llvm-exegesis:LLVMExegesisTests",
   ]
 
-  # Target-dependend unit tests.
+  # Target-dependent unit tests.
   # FIXME: This matches how they are set up in the cmake build,
   # but if we disable an arch after building with it on, this
   # setup leaves behind stale executables.
Index: llvm/trunk/utils/gn/secondary/llvm/unittests/DebugInfo/PDB/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/llvm/unittests/DebugInfo/PDB/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/llvm/unittests/DebugInfo/PDB/BUILD.gn
@@ -0,0 +1,32 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("DebugInfoPDBTests") {
+  deps = [
+    "//llvm/lib/DebugInfo/CodeView",
+    "//llvm/lib/DebugInfo/MSF",
+    "//llvm/lib/DebugInfo/PDB",
+    "//llvm/lib/Testing/Support",
+  ]
+  sources = [
+    "HashTableTest.cpp",
+    "NativeSymbolReuseTest.cpp",
+    "PDBApiTest.cpp",
+    "StringTableBuilderTest.cpp",
+  ]
+
+  # DebugInfoPDBTests uses llvm::getInputFileDirectory(), which expects
+  # a file called llvm.srcdir.txt next to the test executable that contains
+  # the path of the source directory (which contains this file).
+  # lit doesn't change the cwd while running googletests, so the cwd isn't
+  # well-defined. This means this has to be an absolute path.
+  # FIXME: This doesn't work with swarming. This should really be a data
+  # dependency, and the cwd while tests requiring input files run should
+  # be required to be some fixed directory.
+  # FIXME: Also, the GN way is to write this file at build time. But since
+  # there's only one use of this, and since this is a pattern that hopefully
+  # will disappear again, and since it doesn't have any measurable performance
+  # hit, write the file at GN time.
+  # Note: This line here implicitly depends on unittest() setting output_dir to
+  # target_out_dir.
+  write_file("$target_out_dir/llvm.srcdir.txt", rebase_path("."))
+}
Index: llvm/trunk/utils/gn/secondary/llvm/utils/unittest/unittest.gni
===================================================================
--- llvm/trunk/utils/gn/secondary/llvm/utils/unittest/unittest.gni
+++ llvm/trunk/utils/gn/secondary/llvm/utils/unittest/unittest.gni
@@ -33,6 +33,9 @@
     # run the unit test binary if necessary. Using target_out_dir here
     # means that //clang/unittests/Format gets its binary in
     # out/gn/obj/clang/unittests/Format/FormatTests, which seems fine.
+    #
+    # If you change output_dir here, look through
+    # `git grep target_out_dir '*/unittests/*'` and update those too.
     output_dir = target_out_dir
     deps += [ "//llvm/utils/unittest/UnitTestMain" ]
     testonly = true


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56324.180338.patch
Type: text/x-patch
Size: 3267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190105/196ea6d6/attachment.bin>


More information about the llvm-commits mailing list