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") |
+ } |
+ } |
+} |