| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # This file is meant to be included into an target to create a unittest that | 5 # This file is meant to be included into an target to create a unittest that |
| 6 # invokes a set of no-compile tests. A no-compile test is a test that asserts | 6 # invokes a set of no-compile tests. A no-compile test is a test that asserts |
| 7 # a particular construct will not compile. | 7 # a particular construct will not compile. |
| 8 # | 8 # |
| 9 # Also see: | 9 # Also see: |
| 10 # http://dev.chromium.org/developers/testing/no-compile-tests | 10 # http://dev.chromium.org/developers/testing/no-compile-tests |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 # least processed when things go right. | 56 # least processed when things go right. |
| 57 | 57 |
| 58 import("//testing/test.gni") | 58 import("//testing/test.gni") |
| 59 | 59 |
| 60 declare_args() { | 60 declare_args() { |
| 61 # TODO(crbug.com/105388): Disabled until http://crbug.com/105388 is resolved. | 61 # TODO(crbug.com/105388): Disabled until http://crbug.com/105388 is resolved. |
| 62 enable_nocompile_tests = false | 62 enable_nocompile_tests = false |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (enable_nocompile_tests) { | 65 if (enable_nocompile_tests) { |
| 66 import("//build/config/sysroot.gni") |
| 66 template("nocompile_test") { | 67 template("nocompile_test") { |
| 67 nocompile_target = target_name + "_run_nocompile" | 68 nocompile_target = target_name + "_run_nocompile" |
| 68 | 69 |
| 69 action_foreach(nocompile_target) { | 70 action_foreach(nocompile_target) { |
| 70 script = "//tools/nocompile_driver.py" | 71 script = "//tools/nocompile_driver.py" |
| 71 sources = invoker.sources | 72 sources = invoker.sources |
| 72 | 73 |
| 73 result_path = "$target_gen_dir/{{source_name_part}}_nc.cc" | 74 result_path = "$target_gen_dir/{{source_name_part}}_nc.cc" |
| 74 depfile = "${result_path}.d" | 75 depfile = "${result_path}.d" |
| 75 outputs = [ | 76 outputs = [ |
| 76 result_path, | 77 result_path, |
| 77 ] | 78 ] |
| 79 sysroot_args = "" |
| 80 if (sysroot != "") { |
| 81 sysroot_args = " --sysroot " + rebase_path(sysroot, root_build_dir) |
| 82 } |
| 78 args = [ | 83 args = [ |
| 79 "4", # number of compilers to invoke in parallel. | 84 "4", # number of compilers to invoke in parallel. |
| 80 "{{source}}", | 85 "{{source}}", |
| 81 "-Wall -Werror -Wfatal-errors " + "-I" + | 86 "-Wall -Werror -Wfatal-errors " + "-I" + |
| 82 rebase_path("//", root_build_dir), | 87 rebase_path("//", root_build_dir) + sysroot_args, |
| 83 "{{output}}", | 88 "{{output}}", |
| 84 ] | 89 ] |
| 85 } | 90 } |
| 86 | 91 |
| 87 test(target_name) { | 92 test(target_name) { |
| 88 deps = invoker.deps + [ ":$nocompile_target" ] | 93 deps = invoker.deps + [ ":$nocompile_target" ] |
| 89 sources = get_target_outputs(":$nocompile_target") | 94 sources = get_target_outputs(":$nocompile_target") |
| 90 } | 95 } |
| 91 } | 96 } |
| 92 } | 97 } |
| OLD | NEW |