-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gn build] Make
ninja check-lld
also run LLD's unit tests
And add build files for gtest. With this, the build files for //lld are complete. Differential Revision: https://reviews.llvm.org/D55838 llvm-svn: 349704
- Loading branch information
Showing
6 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
group("unittests") { | ||
deps = [ | ||
"DriverTests", | ||
"MachOTests", | ||
] | ||
testonly = true | ||
} |
15 changes: 15 additions & 0 deletions
15
llvm/utils/gn/secondary/lld/unittests/DriverTests/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
executable("DriverTests") { | ||
# test/Unit/lit.cfg expects unittests in LLD_BINARY_DIR/unittest | ||
output_dir = target_out_dir | ||
|
||
configs += [ "//llvm/utils/gn/build:lld_code" ] | ||
deps = [ | ||
"//lld/lib/Driver", | ||
"//lld/lib/ReaderWriter/MachO", | ||
"//llvm/utils/unittest/UnitTestMain", | ||
] | ||
sources = [ | ||
"DarwinLdDriverTest.cpp", | ||
] | ||
testonly = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
executable("MachOTests") { | ||
# test/Unit/lit.cfg expects unittests in LLD_BINARY_DIR/unittest | ||
output_dir = target_out_dir | ||
|
||
configs += [ "//llvm/utils/gn/build:lld_code" ] | ||
deps = [ | ||
"//lld/lib/Driver", | ||
"//lld/lib/ReaderWriter/MachO", | ||
"//lld/lib/ReaderWriter/YAML", | ||
"//llvm/utils/unittest/UnitTestMain", | ||
] | ||
sources = [ | ||
"MachONormalizedFileBinaryReaderTests.cpp", | ||
"MachONormalizedFileBinaryWriterTests.cpp", | ||
"MachONormalizedFileToAtomsTests.cpp", | ||
"MachONormalizedFileYAMLTests.cpp", | ||
] | ||
testonly = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import("//llvm/utils/gn/build/libs/pthread/enable.gni") | ||
|
||
# Used to push the gtest include directories to things depending on :googletest. | ||
config("googletest_config") { | ||
include_dirs = [ | ||
"googlemock/include", | ||
"googletest/include", | ||
] | ||
|
||
# LLVM requires C++11 but gtest doesn't correctly detect the availability | ||
# of C++11 on MSVC, so we force it on. | ||
defines = [ | ||
"GTEST_LANG_CXX11", | ||
"GTEST_HAS_TR1_TUPLE=0", | ||
] | ||
if (host_os == "win") { | ||
defines += [ "GTEST_OS_WINDOWS" ] | ||
} | ||
if (!llvm_enable_threads) { | ||
defines += [ "GTEST_HAS_PTHREAD=0" ] | ||
} | ||
defines += [ "GTEST_HAS_RTTI=0" ] | ||
} | ||
|
||
static_library("gtest") { | ||
deps = [ | ||
"//llvm/lib/Support", | ||
] | ||
include_dirs = [ | ||
"googletest", # For including src/gtest.cc | ||
"googlemock", # For including src/gmock.cc | ||
] | ||
public_configs = [ ":googletest_config" ] | ||
configs -= [ "//llvm/utils/gn/build:warn_covered_switch_default" ] | ||
sources = [ | ||
"googlemock/src/gmock-all.cc", | ||
"googletest/src/gtest-all.cc", | ||
] | ||
testonly = true | ||
} |
25 changes: 25 additions & 0 deletions
25
llvm/utils/gn/secondary/llvm/utils/unittest/UnitTestMain/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
source_set("UnitTestMain") { | ||
deps = [ | ||
"//llvm/lib/Support", | ||
] | ||
|
||
# Make targets depending on this also depend on gtest, to get the gtest | ||
# include_dir. | ||
public_deps = [ | ||
"..:gtest", | ||
] | ||
sources = [ | ||
"TestMain.cpp", | ||
] | ||
testonly = true | ||
} | ||
|
||
# Nothing depends on this target, but llvm-config expects it to exist when | ||
# it runs with `--link-static --system-libs`, so humor it. | ||
static_library("gtest_main") { | ||
deps = [ | ||
":UnitTestMain", | ||
] | ||
complete_static_lib = true | ||
testonly = true | ||
} |