Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: build/nocompile.gni

Issue 1526933002: Add no-compile test support to GN build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/nocompile.gni
diff --git a/build/nocompile.gypi b/build/nocompile.gni
similarity index 60%
copy from build/nocompile.gypi
copy to build/nocompile.gni
index 8c0f288b5a55f70fcfb38013e509b0b0b4b549c4..4da66a581da3c9de335c774af10b267b02f9c72c 100644
--- a/build/nocompile.gypi
+++ b/build/nocompile.gni
@@ -10,14 +10,13 @@
# http://dev.chromium.org/developers/testing/no-compile-tests
#
# To use this, create a gyp target with the following form:
-# {
-# 'target_name': 'my_module_nc_unittests',
-# 'type': 'executable',
-# 'sources': [
+#
+# import("//build/nocompile.gni")
+# nocompile_test("my_module_nc_unittests") {
+# sources = [
# 'nc_testset_1.nc',
# 'nc_testset_2.nc',
-# ],
-# 'includes': ['path/to/this/gypi/file'],
+# ]
# }
#
# The .nc files are C++ files that contain code we wish to assert will not
@@ -56,41 +55,35 @@
# something goes wrong, and know during the unittest run that the test was at
# least processed when things go right.
-{
- # TODO(awong): Disabled until http://crbug.com/105388 is resolved.
- 'sources/': [['exclude', '\\.nc$']],
- 'conditions': [
- [ 'OS!="win" and clang==1', {
- 'rules': [
- {
- 'variables': {
- 'nocompile_driver': '<(DEPTH)/tools/nocompile_driver.py',
- 'nc_result_path': ('<(INTERMEDIATE_DIR)/<(module_dir)/'
- '<(RULE_INPUT_ROOT)_nc.cc'),
- },
- 'rule_name': 'run_nocompile',
- 'extension': 'nc',
- 'inputs': [
- '<(nocompile_driver)',
- ],
- 'outputs': [
- '<(nc_result_path)'
- ],
- 'action': [
- 'python',
- '<(nocompile_driver)',
- '4', # number of compilers to invoke in parallel.
- '<(RULE_INPUT_PATH)',
- '-Wall -Werror -Wfatal-errors -I<(DEPTH)',
- '<(nc_result_path)',
- ],
- 'message': 'Generating no compile results for <(RULE_INPUT_PATH)',
- 'process_outputs_as_sources': 1,
- },
- ],
- }, {
- 'sources/': [['exclude', '\\.nc$']]
- }], # 'OS!="win" and clang=="1"'
- ],
+import("//testing/test.gni")
+
+declare_args() {
+ # TODO(crbug.com/105388): Disabled until http://crbug.com/105388 is resolved.
+ enable_nocompile_tests = false
}
+if (enable_nocompile_tests) {
+ template("nocompile_test") {
+ nocompile_target = target_name + "_run_nocompile"
+
+ action_foreach(nocompile_target) {
+ script = "//tools/nocompile_driver.py"
+ sources = invoker.sources
+ outputs = [
+ "$target_gen_dir/{{source_name_part}}_nc.cc",
+ ]
+ args = [
+ "4", # number of compilers to invoke in parallel.
+ "{{source}}",
+ "-Wall -Werror -Wfatal-errors " + "-I" +
+ rebase_path("//", root_build_dir),
+ "{{output}}",
+ ]
+ }
+
+ test(target_name) {
+ deps = invoker.deps + [ ":$nocompile_target" ]
+ sources = get_target_outputs(":$nocompile_target")
+ }
+ }
+}
« no previous file with comments | « base/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698