From 2d9a325264e3fc81317acc0a68a098f0546c352d Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Thu, 2 Aug 2018 18:48:03 +0200 Subject: [PATCH] Refactor BUILD.gn so can easily be embedded in other projects 1. BUILD.gn: Don't use the extra Chromium clang warnings Also removes the unused .gn secondary_sources. 2. Move fuzzers in test/ instead of testing/ This frees up testing/ to be the git subtree of Chromium's src/testing/ that contains test.gni, gtest, gmock and libfuzzer 3. DEPS: get the whole testing/ subtree of Chromium 4. BUILD.gn: Simplify the standalone gtest targets These targets definitions are inspired from ANGLE's and add a variable that is the path of the googletest directory so that it can be made overridable in future commits. 6. BUILD.gn: Add overridable variables for deps dirs This avoids hardcoded paths to dependencies that make it hard to integrate SPIRV-Tools in other GN projects. --- .gitignore | 2 +- .gn | 2 +- BUILD.gn | 110 ++--- DEPS | 8 +- build_overrides/spirv_tools.gni | 25 ++ {testing => test}/fuzzers/BUILD.gn | 0 .../fuzzers/corpora/spv/simple.spv | Bin .../spvtools_opt_legalization_fuzzer.cpp | 0 .../spvtools_opt_performance_fuzzer.cpp | 0 .../fuzzers/spvtools_opt_size_fuzzer.cpp | 0 .../fuzzers/spvtools_val_fuzzer.cpp | 0 testing/test.gni | 413 ------------------ 12 files changed, 60 insertions(+), 500 deletions(-) create mode 100644 build_overrides/spirv_tools.gni rename {testing => test}/fuzzers/BUILD.gn (100%) rename {testing => test}/fuzzers/corpora/spv/simple.spv (100%) rename {testing => test}/fuzzers/spvtools_opt_legalization_fuzzer.cpp (100%) rename {testing => test}/fuzzers/spvtools_opt_performance_fuzzer.cpp (100%) rename {testing => test}/fuzzers/spvtools_opt_size_fuzzer.cpp (100%) rename {testing => test}/fuzzers/spvtools_val_fuzzer.cpp (100%) delete mode 100644 testing/test.gni diff --git a/.gitignore b/.gitignore index a78c04df..72d61076 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ compile_commands.json /out /TAGS /third_party/llvm-build/ -/testing/libfuzzer/ +/testing /tools/clang/ /utils/clang-format-diff.py diff --git a/.gn b/.gn index ee4734f7..377a97ab 100644 --- a/.gn +++ b/.gn @@ -13,8 +13,8 @@ # limitations under the License. buildconfig = "//build/config/BUILDCONFIG.gn" -secondary_source = "//build/secondary/" default_args = { + clang_use_chrome_plugins = false use_custom_libcxx = false } diff --git a/BUILD.gn b/BUILD.gn index 92636de0..f30cafdb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,14 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build_overrides/spirv_tools.gni") + import("//testing/test.gni") import("//build_overrides/build.gni") -if (build_with_chromium) { - spirv_headers = "//third_party/spirv-headers/src" -} else { - spirv_headers = "external/spirv-headers" -} +spirv_headers = spirv_tools_spirv_headers_dir template("spvtools_core_tables") { assert(defined(invoker.version), "Need version in $target_name generation.") @@ -589,86 +587,42 @@ group("SPIRV-Tools") { } if (!build_with_chromium) { + googletest_dir = spirv_tools_googletest_dir + + config("gtest_config") { + include_dirs = [ + "${googletest_dir}/googletest", + "${googletest_dir}/googletest/include", + ] + } + static_library("gtest") { testonly = true - - defines = [ - # In order to allow regex matches in gtest to be shared between Windows - # and other systems, we tell gtest to always use its internal engine. - "GTEST_HAS_POSIX_RE=0", - - # Enables C++11 features. - "GTEST_LANG_CXX11=1", - - # Prevents gtest from including both and . - "GTEST_HAS_TR1_TUPLE=0", - ] - sources = [ - "external/googletest/googletest/include/gtest/gtest-death-test.h", - "external/googletest/googletest/include/gtest/gtest-message.h", - "external/googletest/googletest/include/gtest/gtest-param-test.h", - "external/googletest/googletest/include/gtest/gtest-printers.h", - "external/googletest/googletest/include/gtest/gtest-spi.h", - "external/googletest/googletest/include/gtest/gtest-test-part.h", - "external/googletest/googletest/include/gtest/gtest-typed-test.h", - "external/googletest/googletest/include/gtest/gtest.h", - "external/googletest/googletest/include/gtest/gtest_pred_impl.h", - "external/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h", - "external/googletest/googletest/include/gtest/internal/gtest-filepath.h", - "external/googletest/googletest/include/gtest/internal/gtest-internal.h", - "external/googletest/googletest/include/gtest/internal/gtest-linked_ptr.h", - "external/googletest/googletest/include/gtest/internal/gtest-param-util-generated.h", - "external/googletest/googletest/include/gtest/internal/gtest-param-util.h", - "external/googletest/googletest/include/gtest/internal/gtest-port.h", - "external/googletest/googletest/include/gtest/internal/gtest-string.h", - "external/googletest/googletest/include/gtest/internal/gtest-tuple.h", - "external/googletest/googletest/include/gtest/internal/gtest-type-util.h", - "external/googletest/googletest/src/gtest-death-test.cc", - "external/googletest/googletest/src/gtest-filepath.cc", - "external/googletest/googletest/src/gtest-internal-inl.h", - "external/googletest/googletest/src/gtest-port.cc", - "external/googletest/googletest/src/gtest-printers.cc", - "external/googletest/googletest/src/gtest-test-part.cc", - "external/googletest/googletest/src/gtest-typed-test.cc", - "external/googletest/googletest/src/gtest.cc", + "${googletest_dir}/googletest/src/gtest-all.cc", ] + public_configs = [ ":gtest_config" ] + } + config("gmock_config") { include_dirs = [ - "external/googletest/googletest/include", - "external/googletest/googletest/", + "${googletest_dir}/googlemock", + "${googletest_dir}/googlemock/include", + "${googletest_dir}/googletest/include", ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] + if (is_clang) { + # TODO: Can remove this if/when the issue is fixed. + # https://github.com/google/googletest/issues/533 + cflags = [ "-Wno-inconsistent-missing-override" ] + } } static_library("gmock") { testonly = true sources = [ - "external/googletest/googlemock/include/gmock/gmock-actions.h", - "external/googletest/googlemock/include/gmock/gmock-cardinalities.h", - "external/googletest/googlemock/include/gmock/gmock-generated-actions.h", - "external/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h", - "external/googletest/googlemock/include/gmock/gmock-generated-matchers.h", - "external/googletest/googlemock/include/gmock/gmock-generated-nice-strict.h", - "external/googletest/googlemock/include/gmock/gmock-matchers.h", - "external/googletest/googlemock/include/gmock/gmock-spec-builders.h", - "external/googletest/googlemock/include/gmock/gmock.h", - "external/googletest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h", - "external/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h", - "external/googletest/googlemock/include/gmock/internal/gmock-port.h", - "external/googletest/googlemock/src/gmock-cardinalities.cc", - "external/googletest/googlemock/src/gmock-internal-utils.cc", - "external/googletest/googlemock/src/gmock-matchers.cc", - "external/googletest/googlemock/src/gmock-spec-builders.cc", - "external/googletest/googlemock/src/gmock.cc", - ] - - include_dirs = [ - "external/googletest/googletest/include", - "external/googletest/googlemock/include", + "${googletest_dir}/googlemock/src/gmock-all.cc", ] + public_configs = [ ":gmock_config" ] } } @@ -754,13 +708,7 @@ test("spvtools_test") { ":gmock", ":gtest", ] - - sources += [ "external/googletest/googletest/src/gtest_main.cc" ] - - include_dirs = [ - "external/googletest/googletest/include", - "external/googletest/googlemock/include", - ] + sources += [ "${googletest_dir}/googletest/src/gtest_main.cc" ] } configs += [ @@ -769,11 +717,11 @@ test("spvtools_test") { ] } -if (!build_with_chromium) { +if (spirv_tools_standalone) { group("fuzzers") { testonly = true deps = [ - "//testing/fuzzers", + "test/fuzzers", ] } } diff --git a/DEPS b/DEPS index a1f24fce..b69f0320 100644 --- a/DEPS +++ b/DEPS @@ -9,7 +9,7 @@ vars = { 'clang_revision': 'abe5e4f9dc0f1df848c7a0efa05256253e77a7b7', 'effcee_revision': '04b624799f5a9dbaf3fa1dbed2ba9dce2fc8dcf2', 'googletest_revision': '98a0d007d7092b72eea0e501bb9ad17908a1a036', - 'libfuzzer_revision': 'c24c2cd3f4d6130e815b6baff8165e4df440d442', + 'testing_revision': '340252637e2e7c72c0901dcbeeacfff419e19b59', 're2_revision': '6cf8ccd82dbaab2668e9b13596c68183c9ecd13f', 'spirv_headers_revision': 'ff684ffc6a35d2a58f0f63108877d0064ea33feb', } @@ -35,9 +35,9 @@ deps = { 'external/re2': Var('github') + '/google/re2.git@' + Var('re2_revision'), - 'testing/libfuzzer': - Var('chromium_git') + '/chromium/src/testing/libfuzzer@' + - Var('libfuzzer_revision'), + 'testing': + Var('chromium_git') + '/chromium/src/testing@' + + Var('testing_revision'), 'tools/clang': Var('chromium_git') + '/chromium/src/tools/clang@' + Var('clang_revision') diff --git a/build_overrides/spirv_tools.gni b/build_overrides/spirv_tools.gni new file mode 100644 index 00000000..24aa033d --- /dev/null +++ b/build_overrides/spirv_tools.gni @@ -0,0 +1,25 @@ +# Copyright 2018 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# These are variables that are overridable by projects that include +# SPIRV-Tools. The values in this file are the defaults for when we are +# building from SPIRV-Tools' repository. + +# Whether we are building from SPIRV-Tools' repository. +# MUST be set to false in other projects. +spirv_tools_standalone = true + +# The path to SPIRV-Tools' dependencies +spirv_tools_googletest_dir = "//external/googletest" +spirv_tools_spirv_headers_dir = "//external/spirv-headers" diff --git a/testing/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn similarity index 100% rename from testing/fuzzers/BUILD.gn rename to test/fuzzers/BUILD.gn diff --git a/testing/fuzzers/corpora/spv/simple.spv b/test/fuzzers/corpora/spv/simple.spv similarity index 100% rename from testing/fuzzers/corpora/spv/simple.spv rename to test/fuzzers/corpora/spv/simple.spv diff --git a/testing/fuzzers/spvtools_opt_legalization_fuzzer.cpp b/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp similarity index 100% rename from testing/fuzzers/spvtools_opt_legalization_fuzzer.cpp rename to test/fuzzers/spvtools_opt_legalization_fuzzer.cpp diff --git a/testing/fuzzers/spvtools_opt_performance_fuzzer.cpp b/test/fuzzers/spvtools_opt_performance_fuzzer.cpp similarity index 100% rename from testing/fuzzers/spvtools_opt_performance_fuzzer.cpp rename to test/fuzzers/spvtools_opt_performance_fuzzer.cpp diff --git a/testing/fuzzers/spvtools_opt_size_fuzzer.cpp b/test/fuzzers/spvtools_opt_size_fuzzer.cpp similarity index 100% rename from testing/fuzzers/spvtools_opt_size_fuzzer.cpp rename to test/fuzzers/spvtools_opt_size_fuzzer.cpp diff --git a/testing/fuzzers/spvtools_val_fuzzer.cpp b/test/fuzzers/spvtools_val_fuzzer.cpp similarity index 100% rename from testing/fuzzers/spvtools_val_fuzzer.cpp rename to test/fuzzers/spvtools_val_fuzzer.cpp diff --git a/testing/test.gni b/testing/test.gni deleted file mode 100644 index d42fe52c..00000000 --- a/testing/test.gni +++ /dev/null @@ -1,413 +0,0 @@ -# Copyright 2018 The Chromium Authors. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# ============================================================================== -# TEST SETUP -# ============================================================================== - -if (is_android) { - import("//build/config/android/config.gni") - import("//build/config/android/rules.gni") - import("//build/config/sanitizers/sanitizers.gni") - import("//build/config/android/extract_unwind_tables.gni") -} - -if (is_fuchsia) { - import("//build/config/chromecast_build.gni") - import("//build/config/fuchsia/rules.gni") - import("//build/config/fuchsia/package.gni") -} - -if (is_chromeos) { - import("//build/config/chromeos/rules.gni") -} - -# Define a test as an executable (or apk on Android) with the "testonly" flag -# set. -# Variable: -# use_raw_android_executable: Use executable() rather than android_apk(). -# use_native_activity: Test implements ANativeActivity_onCreate(). -template("test") { - if (is_android) { - _use_raw_android_executable = defined(invoker.use_raw_android_executable) && - invoker.use_raw_android_executable - - # output_name is used to allow targets with the same name but in different - # packages to still produce unique runner scripts. - _output_name = invoker.target_name - if (defined(invoker.output_name)) { - _output_name = invoker.output_name - } - - _test_runner_target = "${_output_name}__test_runner_script" - _wrapper_script_vars = [ - "ignore_all_data_deps", - "shard_timeout", - ] - - assert(_use_raw_android_executable || enable_java_templates) - - _incremental_apk_only = - incremental_apk_by_default && !_use_raw_android_executable - - if (_use_raw_android_executable) { - _exec_target = "${target_name}__exec" - _dist_target = "${target_name}__dist" - _exec_output = - "$target_out_dir/${invoker.target_name}/${invoker.target_name}" - - executable(_exec_target) { - # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. - configs = [] - data_deps = [] - forward_variables_from(invoker, - "*", - _wrapper_script_vars + [ "extra_dist_files" ]) - testonly = true - - # Thanks to the set_defaults() for test(), configs are initialized with - # the default shared_library configs rather than executable configs. - configs -= [ - "//build/config:shared_library_config", - "//build/config/android:hide_all_but_jni", - ] - configs += [ "//build/config:executable_config" ] - - # Don't output to the root or else conflict with the group() below. - output_name = rebase_path(_exec_output, root_out_dir) - if (is_component_build || is_asan) { - data_deps += [ "//build/android:cpplib_stripped" ] - } - } - - create_native_executable_dist(_dist_target) { - testonly = true - dist_dir = "$root_out_dir/$target_name" - binary = _exec_output - deps = [ - ":$_exec_target", - ] - if (defined(invoker.extra_dist_files)) { - extra_files = invoker.extra_dist_files - } - } - } else { - _library_target = "_${target_name}__library" - _apk_target = "${target_name}_apk" - _apk_specific_vars = [ - "android_manifest", - "android_manifest_dep", - "enable_multidex", - "proguard_configs", - "proguard_enabled", - "use_default_launcher", - "write_asset_list", - "use_native_activity", - ] - - # Adds the unwind tables from unstripped binary as an asset file in the - # apk, if |add_unwind_tables_in_apk| is specified by the test. - if (defined(invoker.add_unwind_tables_in_apk) && - invoker.add_unwind_tables_in_apk) { - _unwind_table_asset_name = "${target_name}_unwind_assets" - unwind_table_asset(_unwind_table_asset_name) { - testonly = true - library_target = _library_target - deps = [ - ":$_library_target", - ] - } - } - - shared_library(_library_target) { - # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. - configs = [] # Prevent list overwriting warning. - configs = invoker.configs - testonly = true - - deps = [] - forward_variables_from( - invoker, - "*", - _apk_specific_vars + _wrapper_script_vars + [ "visibility" ]) - - if (!defined(invoker.use_default_launcher) || - invoker.use_default_launcher) { - deps += [ "//testing/android/native_test:native_test_native_code" ] - } - } - unittest_apk(_apk_target) { - forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) - shared_library = ":$_library_target" - apk_name = invoker.target_name - if (defined(invoker.output_name)) { - apk_name = invoker.output_name - install_script_name = "install_${invoker.output_name}" - } - - # Add the Java classes so that each target does not have to do it. - deps += [ "//base/test:test_support_java" ] - - if (defined(_unwind_table_asset_name)) { - deps += [ ":${_unwind_table_asset_name}" ] - } - - # TODO(agrieve): Remove this data_dep once bots don't build the _apk - # target (post-GYP). - # It's a bit backwards for the apk to depend on the runner script, since - # the apk is conceptually a runtime_dep of the script. However, it is - # currently necessary because the bots build this _apk target directly - # rather than the group() below. - data_deps = [ - ":$_test_runner_target", - ] - } - - _test_runner_target = "${_output_name}__test_runner_script" - _incremental_test_name = "${_output_name}_incremental" - _incremental_test_runner_target = - "${_output_name}_incremental__test_runner_script" - if (_incremental_apk_only) { - _incremental_test_name = _output_name - _incremental_test_runner_target = _test_runner_target - } - - # Incremental test targets work only for .apks. - test_runner_script(_incremental_test_runner_target) { - forward_variables_from(invoker, - _wrapper_script_vars + [ - "data", - "data_deps", - "deps", - "public_deps", - ]) - apk_target = ":$_apk_target" - test_name = _incremental_test_name - test_type = "gtest" - test_suite = _output_name - incremental_install = true - } - group("${target_name}_incremental") { - testonly = true - data_deps = [ - ":$_incremental_test_runner_target", - ] - deps = [ - ":${_apk_target}_incremental", - ] - } - } - - if (!_incremental_apk_only) { - test_runner_script(_test_runner_target) { - forward_variables_from(invoker, - _wrapper_script_vars + [ - "data", - "data_deps", - "deps", - "public_deps", - ]) - - if (_use_raw_android_executable) { - executable_dist_dir = "$root_out_dir/$_dist_target" - } else { - apk_target = ":$_apk_target" - } - test_name = _output_name - test_type = "gtest" - test_suite = _output_name - } - } - - test_runner_script(target_name) { - forward_variables_from(invoker, - _wrapper_script_vars + [ - "data", - "data_deps", - "deps", - "public_deps", - ]) - - if (_use_raw_android_executable) { - executable_dist_dir = "$root_out_dir/$_dist_target" - deps += [ - ":$_dist_target", - ":$_test_runner_target", - ] - } else { - apk_target = ":$_apk_target" - deps += [ ":$_apk_target" ] - if (_incremental_apk_only) { - deps += [ ":${target_name}_incremental" ] - } else { - deps += [ ":$_test_runner_target" ] - } - } - generated_script = "$root_build_dir/$_output_name" - incremental_install = _incremental_apk_only - test_name = _output_name - test_suite = _output_name - test_type = "gtest" - } - } else if (is_fuchsia) { - _output_name = invoker.target_name - _pkg_target = "${_output_name}_pkg" - _gen_runner_target = "${_output_name}_runner" - _exec_target = "${_output_name}__exec" - - group(target_name) { - testonly = true - deps = [ - ":$_gen_runner_target", - ":$_pkg_target", - ] - } - - # Makes the script which invokes the executable. - test_runner_script(_gen_runner_target) { - forward_variables_from(invoker, [ "use_test_server" ]) - test_name = _output_name - package_name = _output_name - } - - executable(_exec_target) { - testonly = true - forward_variables_from(invoker, "*") - output_name = _exec_target - } - - package(_pkg_target) { - testonly = true - package_name = _output_name - sandbox_policy = "//build/config/fuchsia/testing_sandbox_policy" - binary = get_label_info(_exec_target, "name") - deps = [ - ":$_exec_target", - ] - } - } else if (is_ios) { - import("//build/config/ios/ios_sdk.gni") - import("//build/config/ios/rules.gni") - - _test_target = target_name - _resources_bundle_data = target_name + "_resources_bundle_data" - - bundle_data(_resources_bundle_data) { - visibility = [ ":$_test_target" ] - sources = [ - "//testing/gtest_ios/Default.png", - ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] - } - - ios_app_bundle(_test_target) { - testonly = true - - # See above call. - set_sources_assignment_filter([]) - forward_variables_from(invoker, "*", [ "testonly" ]) - - # Provide sensible defaults in case invoker did not define any of those - # required variables. - if (!defined(info_plist) && !defined(info_plist_target)) { - info_plist = "//testing/gtest_ios/unittest-Info.plist" - } - - _bundle_id_suffix = ios_generic_test_bundle_id_suffix - if (!ios_automatically_manage_certs) { - _bundle_id_suffix = "${target_name}" - } - if (!defined(extra_substitutions)) { - extra_substitutions = [] - } - extra_substitutions += [ "GTEST_BUNDLE_ID_SUFFIX=$_bundle_id_suffix" ] - - if (!defined(bundle_deps)) { - bundle_deps = [] - } - bundle_deps += [ ":$_resources_bundle_data" ] - } - } else if (is_chromeos && cros_board != "") { - # When the arg cros_board is set, assume we're in the cros chrome-sdk - # building simplechrome. - - _gen_runner_target = "${target_name}__runner" - _runtime_deps_file = - "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + - "/" + get_label_info(target_name, "name") + ".runtime_deps" - - generate_vm_runner_script(_gen_runner_target) { - testonly = true - generated_script = "$root_build_dir/bin/run_" + invoker.target_name - test_exe = "$root_out_dir/" + get_label_info(invoker.target_name, "name") - runtime_deps_file = _runtime_deps_file - } - - executable(target_name) { - forward_variables_from(invoker, "*") - if (!defined(deps)) { - deps = [] - } - if (!defined(data)) { - data = [] - } - - testonly = true - output_name = target_name - write_runtime_deps = _runtime_deps_file - data += [ _runtime_deps_file ] - deps += [ ":$_gen_runner_target" ] - } - } else { - executable(target_name) { - forward_variables_from(invoker, "*") - if (!defined(deps)) { - deps = [] - } - - testonly = true - deps += [ - # Give tests the default manifest on Windows (a no-op elsewhere). - "//build/win:default_exe_manifest", - ] - } - } -} - -# Test defaults. -set_defaults("test") { - if (is_android) { - configs = default_shared_library_configs - configs -= [ "//build/config/android:hide_all_but_jni_onload" ] - configs += [ "//build/config/android:hide_all_but_jni" ] - } else { - configs = default_executable_configs - } -}