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 @@ -8,9 +8,7 @@ "BinaryFormat:BinaryFormatTests", "Bitcode:BitcodeTests", "CodeGen:CodeGenTests", - - # FIXME: Add. - #"CodeGen/GlobalISel:GlobalISelTests", + "CodeGen/GlobalISel:GlobalISelTests", "DebugInfo/CodeView:DebugInfoCodeViewTests", "DebugInfo/DWARF:DebugInfoDWARFTests", "DebugInfo/MSF:DebugInfoMSFTests", @@ -24,9 +22,7 @@ "LineEditor:LineEditorTests", "Linker:LinkerTests", "MC:MCTests", - - # FIXME: Add. - #"MI:MITests", + "MI:MITests", "Object:ObjectTests", "ObjectYAML:ObjectYAMLTests", "OptRemarks:OptRemarksTests", @@ -41,9 +37,7 @@ "Transforms/Utils:UtilsTests", "Transforms/Vectorize:VectorizeTests", "XRay:XRayTests", - - # FIXME: Add more: - #"tools/llvm-cfi-verify:CFIVerifyTests", + "tools/llvm-cfi-verify:CFIVerifyTests", "tools/llvm-exegesis:LLVMExegesisTests", ] Index: llvm/trunk/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel/BUILD.gn @@ -0,0 +1,20 @@ +import("//llvm/utils/unittest/unittest.gni") + +unittest("GlobalISelTests") { + deps = [ + "//llvm/lib/CodeGen", + "//llvm/lib/CodeGen/GlobalISel", + "//llvm/lib/CodeGen/MIRParser", + "//llvm/lib/IR", + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target", + "//llvm/lib/Target:TargetsToBuild", + ] + sources = [ + "LegalizerHelperTest.cpp", + "LegalizerInfoTest.cpp", + "PatternMatchTest.cpp", + ] + has_custom_main = true +} Index: llvm/trunk/utils/gn/secondary/llvm/unittests/MI/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/unittests/MI/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/unittests/MI/BUILD.gn @@ -0,0 +1,17 @@ +import("//llvm/utils/unittest/unittest.gni") + +unittest("MITests") { + deps = [ + "//llvm/lib/CodeGen", + "//llvm/lib/CodeGen/MIRParser", + "//llvm/lib/IR", + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target", + "//llvm/lib/Target:TargetsToBuild", + ] + sources = [ + "LiveIntervalTest.cpp", + ] + has_custom_main = true +} Index: llvm/trunk/utils/gn/secondary/llvm/unittests/tools/llvm-cfi-verify/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/unittests/tools/llvm-cfi-verify/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/unittests/tools/llvm-cfi-verify/BUILD.gn @@ -0,0 +1,22 @@ +import("//llvm/utils/unittest/unittest.gni") + +unittest("CFIVerifyTests") { + deps = [ + "//llvm/lib/DebugInfo/Symbolize", + "//llvm/lib/MC", + "//llvm/lib/MC/MCParser", + "//llvm/lib/Object", + "//llvm/lib/Support", + "//llvm/lib/Target:AllTargetsAsmParsers", + "//llvm/lib/Target:AllTargetsAsmPrinters", + "//llvm/lib/Target:AllTargetsDescs", + "//llvm/lib/Target:AllTargetsDisassemblers", + "//llvm/lib/Target:AllTargetsInfos", + "//llvm/tools/llvm-cfi-verify/lib", + ] + sources = [ + "FileAnalysis.cpp", + "GraphBuilder.cpp", + ] + has_custom_main = true +} 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 @@ -1,7 +1,11 @@ # This file defines a template for adding a unittest binary. # # It's a thin wrapper around GN's built-in executable() target type and -# accepts the same parameters. +# accepts the same parameters, and in addition this paramater: +# +# has_custom_main (optional) +# [bool] If set, link against gtest instead of UnitTestMain; for tests +# that define their own main() function. # # Example use: # @@ -12,7 +16,9 @@ template("unittest") { executable(target_name) { - # Foward everything (configs, sources, deps, ...). + has_custom_main = false # Default value. + + # Foward everything (has_custom_main if set; configs, sources, deps, ...). forward_variables_from(invoker, "*") assert(!defined(invoker.output_dir), "cannot set unittest output_dir") assert(!defined(invoker.testonly), "cannot set unittest testonly") @@ -37,7 +43,12 @@ # 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" ] + + if (has_custom_main) { + deps += [ "//llvm/utils/unittest:gtest" ] + } else { + deps += [ "//llvm/utils/unittest/UnitTestMain" ] + } testonly = true } }