Commit 1f5ea041 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[build] Add include_dirs option to nocompile_test

In order to work around the inability to inspect the contents of
include_dirs when creating an action within the nocompile_test template,
this change adds a dedicated include_dirs parameter to the template.
This allows callers to provide extra include dirs explicitly, which will
e.g. be required once classes in base include Abseil headers, and thus
affecting base's nocompile tests as well.

Bug: None
Change-Id: I2354dd428e5ada8c5a41bb9b2c3e7007a3df9282
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2351772Reviewed-by: default avatarBrett Wilson <brettw@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797760}
parent e28b585f
...@@ -3390,6 +3390,10 @@ if (enable_nocompile_tests) { ...@@ -3390,6 +3390,10 @@ if (enable_nocompile_tests) {
"//base/test:run_all_unittests", "//base/test:run_all_unittests",
"//testing/gtest", "//testing/gtest",
] ]
# Since the nocompile test is not able to inspect the contents of
# include_dirs, we need to specify the Abseil include dir manually.
include_dirs = [ "//third_party/abseil-cpp" ]
} }
} }
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
# 'nc_testset_1.nc', # 'nc_testset_1.nc',
# 'nc_testset_2.nc', # 'nc_testset_2.nc',
# ] # ]
#
# # optional extra include dirs:
# include_dirs = [ ... ]
# } # }
# #
# The .nc files are C++ files that contain code we wish to assert will not # The .nc files are C++ files that contain code we wish to assert will not
...@@ -61,8 +64,8 @@ import("//testing/test.gni") ...@@ -61,8 +64,8 @@ import("//testing/test.gni")
declare_args() { declare_args() {
# TODO(crbug.com/105388): make sure no-compile test is not flaky. # TODO(crbug.com/105388): make sure no-compile test is not flaky.
enable_nocompile_tests = enable_nocompile_tests = (is_linux || is_chromeos || is_apple) && is_clang &&
(is_linux || is_chromeos || is_apple) && is_clang && host_cpu == target_cpu host_cpu == target_cpu
} }
if (enable_nocompile_tests) { if (enable_nocompile_tests) {
...@@ -103,6 +106,14 @@ if (enable_nocompile_tests) { ...@@ -103,6 +106,14 @@ if (enable_nocompile_tests) {
# TODO(https://crbug.com/989932): Track build/config/compiler/BUILD.gn # TODO(https://crbug.com/989932): Track build/config/compiler/BUILD.gn
"-Wno-implicit-int-float-conversion", "-Wno-implicit-int-float-conversion",
] ]
# Iterate over any extra include dirs and append them to the command line.
if (defined(invoker.include_dirs)) {
foreach(include_dir, invoker.include_dirs) {
args += [ "-I" + rebase_path(include_dir, root_build_dir) ]
}
}
if (sysroot != "") { if (sysroot != "") {
args += [ args += [
"--sysroot", "--sysroot",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment