Commit 71c10e67 authored by Dirk Pranke's avatar Dirk Pranke Committed by Commit Bot

Change blink_web_tests and blink_python_tests test types.

This CL changes the GN blink_web_tests and blink_python_tests
targets to use a new script_test() GN template.

A script_test is a kind of test target that implements the
[test executable API](//docs/testing/test_executable_api.md)
via a Python script (rather than being an executable target).

:blink_web_tests, :blink_python_tests are examples of this type
of test; other targets will be switched over in future CLs as well.

Most importantly, using script_test() will ensure that
the $root_build_dir/bin/run_$target_name test wrappers are
generated with all of the appropriate arguments, simplifying the
invocation of the test both for devs and for the bots.

Bug: 816629
Change-Id: Ib4bfd2342d762db24cdef75b64ed5dd7fbf3c10e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380936
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Reviewed-by: default avatarRakib Hasan <rmhasan@google.com>
Cr-Commit-Position: refs/heads/master@{#812523}
parent 78a5b827
......@@ -1108,9 +1108,6 @@ if (!is_ios) {
}
data = [
"//testing/scripts/common.py",
"//testing/scripts/run_isolated_script_test.py",
"//testing/xvfb.py",
"//third_party/blink/tools/",
"//third_party/blink/web_tests/VirtualTestSuites",
"//third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json",
......@@ -1146,25 +1143,38 @@ if (!is_ios) {
}
# https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_tests.md
generate_wrapper("blink_web_tests") {
testonly = true
wrapper_script = "${root_build_dir}/bin/run_blink_web_tests"
executable = "//third_party/blink/tools/run_web_tests.py"
executable_args = []
script_test("blink_web_tests") {
script = "//testing/scripts/run_isolated_script_test.py"
args = [ "@WrappedPath(" +
rebase_path("//third_party/blink/tools/run_web_tests.py",
root_build_dir) + ")" ]
if (is_debug) {
executable_args += [ "--debug" ]
args += [ "--debug" ]
} else {
executable_args += [ "--release" ]
args += [ "--release" ]
}
if (is_android) {
executable_args += [
args += [
"--platform",
"android",
]
}
args += [
"--seed",
"4",
"--no-show-results",
"--zero-tests-executed-ok",
"--clobber-old-results",
"--exit-after-n-failures",
"5000",
"--exit-after-n-crashes-or-timeouts",
"100",
]
data_deps = [ ":blink_web_tests_support_data" ]
data = [
"//third_party/blink/perf_tests/",
......@@ -1227,14 +1237,15 @@ if (!is_ios) {
deps = [ "//mojo/public/js:bindings_lite" ]
}
group("blink_python_tests") {
script_test("blink_python_tests") {
script = "//testing/scripts/run_isolated_script_test.py"
args = [ "@WrappedPath(" +
rebase_path("//third_party/blink/tools/run_blinkpy_tests.py",
root_build_dir) + ")" ]
data = [
"//build/android/",
"//components/crash/content/tools/generate_breakpad_symbols.py",
"//testing/scripts/common.py",
"//testing/scripts/run_isolated_script_test.py",
"//testing/test_env.py",
"//testing/xvfb.py",
"//third_party/blink/renderer/bindings/scripts/",
"//third_party/blink/renderer/build/scripts/",
"//third_party/blink/tools/",
......
......@@ -92,5 +92,9 @@ template("generate_wrapper") {
"--",
]
args += _wrapped_arguments
if (defined(invoker.write_runtime_deps)) {
write_runtime_deps = invoker.write_runtime_deps
}
}
}
......@@ -245,12 +245,8 @@
"type": "console_test_launcher",
},
"blink_python_tests": {
"args": [
"../../third_party/blink/tools/run_blinkpy_tests.py",
],
"label": "//:blink_python_tests",
"script": "//testing/scripts/run_isolated_script_test.py",
"type": "script",
"type": "generated_script",
},
"blink_tests": {
"label": "//:blink_tests",
......@@ -261,23 +257,12 @@
"type": "console_test_launcher",
},
"blink_web_tests": {
"label": "//:blink_web_tests",
"type": "generated_script",
"args": [
"../../third_party/blink/tools/run_web_tests.py",
"--seed",
"4",
"--no-show-results",
"--zero-tests-executed-ok",
"--clobber-old-results",
"--exit-after-n-failures",
"5000",
"--exit-after-n-crashes-or-timeouts",
"100",
"--results-directory",
"${ISOLATED_OUTDIR}",
],
"label": "//:blink_web_tests",
"script": "//testing/scripts/run_isolated_script_test.py",
"type": "script",
},
"boundary_interface_example_apk": {
"label": "//android_webview/support_library/boundary_interfaces:boundary_interface_example_apk",
......
......@@ -24,6 +24,7 @@ if (is_fuchsia) {
if (is_chromeos) {
import("//build/config/chromeos/rules.gni")
import("//build/util/generate_wrapper.gni")
}
if (is_ios) {
......@@ -555,6 +556,66 @@ template("test") {
}
}
# Defines a type of test that invokes a script to run, rather than
# invoking an executable.
#
# The script must implement the
# [test executable API](//docs/testing/test_executable_api.md).
#
# The template must be passed the `script` parameter, which specifies
# the path to the script to run. It may optionally be passed a
# `script_args` parameter, which can be used to include a list of
# args to be specified by default. The template will produce
# a `$root_build_dir/run_$target_name` wrapper and write the runtime_deps
# for the target to $root_build_dir/${target_name}.runtime_deps, as per
# the conventions listed in the
# [test wrapper API](//docs/testing/test_wrapper_api.md).
template("script_test") {
generate_wrapper(target_name) {
testonly = true
wrapper_script = "${root_build_dir}/bin/run_${target_name}"
executable = "//testing/test_env.py"
executable_args =
[ "@WrappedPath(" + rebase_path(invoker.script, root_build_dir) + ")" ]
if (defined(invoker.args)) {
executable_args += invoker.args
}
data = [
"//.vpython",
"//testing/test_env.py",
# These aren't needed by *every* test, but they're likely needed often
# enough to just make it easier to declare them here.
"//testing/xvfb.py",
"//testing/scripts/common.py",
invoker.script,
]
if (defined(invoker.data)) {
data += invoker.data
}
data_deps = []
if (defined(invoker.data_deps)) {
data_deps += invoker.data_deps
}
forward_variables_from(invoker,
[ "*" ],
[
"data",
"data_deps",
"script",
"script_args",
"testonly",
])
write_runtime_deps = "${root_build_dir}/${target_name}.runtime_deps"
}
}
# Test defaults.
set_defaults("test") {
if (is_android) {
......
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