Commit b6798215 authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

Revert "Add a first pass of the desktop test wrapper scripts."

This reverts commit 956c4dcc.

Reason for revert: Suspect of causing consistent failure on Deterministic Linux bot

First failed run:
https://ci.chromium.org/p/chromium/builders/ci/Deterministic%20Linux%20%28dbg%29/17574

Original change's description:
> Add a first pass of the desktop test wrapper scripts.
> 
> As described in the linked bug and documented in
> https://docs.google.com/document/d/19qpDeR2z-8j-WQJC-5waSd134kz94UXgYU_e_N-VplU/edit?usp=sharing
> we want to change how tests are launched under swarming so that
> they all have a consistent API and usage.
> 
> We need to do at least some of this work now in order to unblock
> work going on in Swarming to change how a task's command line and
> list of files are specified, but doing all of the work in the linked
> doc and bug will significantly restructure how we configure and launch
> tests, and should bring a lot more consistency to our continuous
> integration infrastructure.
> 
> This CL is a first step: a proof of concept that converts
> url_unittests on desktop to the new API in a backwards-compatible
> way (i.e., this will work with the existing chromium recipes).
> 
> R=​tikuta@chromium.org, martiniss@chromium.org, bpastene@chromium.org, estaab@chromium.org, kbr@chromium.org
> 
> Bug: 816629
> Change-Id: I4aaaed9853e451536f21a752d896cf7bef5fff18
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2249173
> Commit-Queue: Dirk Pranke <dpranke@google.com>
> Reviewed-by: Nodir Turakulov <nodir@chromium.org>
> Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
> Reviewed-by: Stephen Martinis <martiniss@chromium.org>
> Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
> Reviewed-by: Erik Staab <estaab@chromium.org>
> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#784653}

TBR=thakis@chromium.org,ynovikov@chromium.org,dpranke@google.com,kbr@chromium.org,nodir@chromium.org,estaab@chromium.org,martiniss@chromium.org,tikuta@chromium.org,bsheedy@chromium.org,bpastene@chromium.org

Change-Id: Ic2277fd08f14119b500917f532f37a2fa46fa3b5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 816629
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2275456Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784739}
parent 7a3863e5
# The Chromium Test Executable API
TODO(crbug.com/816629): Move the contents of the
[Google Doc](https://bit.ly/chromium-test-runner-api) here.
# Test Wrapper API
In order to simplify the calling conventions for tests that we run on our
continuous integration system, we require them to follow a simple API
convention. For a given GN label //X:Y and build directory //Z in a checkout
(e.g., //url:url_unittests and //out/Release), we expect there to be:
* A file `$Z/$Y.runtime_deps` containing a list of files needed to run
the test (in the format produced by `gn desc //Z //X:Y runtime_deps`,
which is a newline-separated list of paths relative to Z)
* An executable file `$Z/bin/run_$Y` which does everything needed to set
up and run the test with all of the appropriate flags. This will usually
be a vpython script.
* (on Windows) A file `$Z/bin/run_$Y.bat` file that will turn around
and invoke the corresponding run_$ vpython script.
If you create a directory snapshot with the files listed in the .runtime_deps
file, cd to $Z, and run bin/run_$Y, then the test should run to completion
successfully.
The script file MUST honor the `GTEST_SHARD_INDEX` and `GTEST_TOTAL_SHARDS`
environment variables as documented in
[the Test Executable API](test_executable_api.md) and SHOULD conform to
the Test Executable API in other respects (i.e., honor the
`--isolated-script-test-filter` arg and other command line flags specified
in that API).
TODO(crbug.com/816629): Convert everything to the Test Executable API, and
change the above SHOULD to a MUST.
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
# much always the same as the Ninja target name, since GYP target names are not # much always the same as the Ninja target name, since GYP target names are not
# hierarchical). # hierarchical).
# #
# TODO(crbug.com/816629): Remove the need for this file altogether :). Also,
# see below.
#
# The "label" field specifies the matching GN label for the given ninja # The "label" field specifies the matching GN label for the given ninja
# target. # target.
# #
...@@ -51,17 +48,6 @@ ...@@ -51,17 +48,6 @@
# "unknown" # "unknown"
# : (the default), which indicates that we don't know what the command line # : (the default), which indicates that we don't know what the command line
# needs to be (this is a fatal error). # needs to be (this is a fatal error).
# TODO(crbug.com/816629): You may also set the type field to "wrapped_" +
# one of the above values; doing so indicates that the target conforms to
# the test wrapper API: for a given label //X:Y and build directory Z,
# there will be either a "Z/bin/run_Y" bash script (on Unix systems) or a
# "Z/bin/run_Y.bat" batch script (on Windows) that can be invoked directly
# to run the target in a swarming task, and "Z/Y.runtime_deps" file that
# contains the list of files and directories needed to run the task, in
# the format that GN uses with write_runtime_deps: a newline-separated list
# of files and directories relative to Z. Ultimately every target will
# be converted to this format, and this entire file will be deleted.
# #
# The optional "executable" field can be used to override the name # The optional "executable" field can be used to override the name
# of the binary to run. If the field is not specified, the binary # of the binary to run. If the field is not specified, the binary
...@@ -1723,7 +1709,7 @@ ...@@ -1723,7 +1709,7 @@
}, },
"url_unittests": { "url_unittests": {
"label": "//url:url_unittests", "label": "//url:url_unittests",
"type": "wrapped_console_test_launcher", "type": "console_test_launcher",
}, },
"usage_time_limit_unittests": { "usage_time_limit_unittests": {
"label": "//chrome/test:usage_time_limit_unittests", "label": "//chrome/test:usage_time_limit_unittests",
......
...@@ -29,11 +29,6 @@ if (is_ios) { ...@@ -29,11 +29,6 @@ if (is_ios) {
import("//build/config/ios/rules.gni") import("//build/config/ios/rules.gni")
} }
if ((is_linux && !is_chromeos) || is_mac || is_win) {
import("//build/config/sanitizers/sanitizers.gni")
import("//build/util/generate_wrapper.gni")
}
# Define a test as an executable (or apk on Android) with the "testonly" flag # Define a test as an executable (or apk on Android) with the "testonly" flag
# set. # set.
# Variable: # Variable:
...@@ -357,71 +352,7 @@ template("test") { ...@@ -357,71 +352,7 @@ template("test") {
data += [ _runtime_deps_file ] data += [ _runtime_deps_file ]
deps += [ ":$_gen_runner_target" ] deps += [ ":$_gen_runner_target" ]
} }
} else if (is_chromeos && cros_board == "") {
executable(target_name) {
forward_variables_from(invoker, "*")
if (!defined(deps)) {
deps = []
}
if (is_win) {
# Initializing CFG data during process creation is a significant
# bottleneck for large test binaries, and CFG is not needed for tests,
# so disable it. See https://crbug.com/950923 for details.
configs -= [ "//build/config/win:cfi_linker" ]
}
testonly = true
deps += [
# Give tests the default manifest on Windows (a no-op elsewhere).
"//build/win:default_exe_manifest",
]
}
} else { } else {
if ((is_linux && !is_chromeos) || is_mac || is_win) {
_runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps"
_executable = target_name
_gen_runner_target = "${target_name}__runner"
if (is_linux && defined(invoker.use_xvfb)) {
_use_xvfb = invoker.use_xvfb
} else {
_use_xvfb = false
}
generate_wrapper(_gen_runner_target) {
testonly = true
wrapper_script = "$root_build_dir/bin/run_" + _executable
if (_use_xvfb) {
executable = "//testing/xvfb.py"
} else {
executable = "//testing/test_env.py"
}
executable_args = [
"@WrappedPath(./${_executable})",
"--test-launcher-bot-mode",
]
if (is_asan) {
executable_args += [ "--asan=true" ]
}
if (is_msan) {
executable_args += [ "--msan=true" ]
}
if (is_tsan) {
executable_args += [ "--tsan=true" ]
}
if (use_cfi_diag) {
executable_args += [ "--cfi-diag=true" ]
}
data = [
"//testing/test_env.py",
"//.vpython",
]
}
}
executable(target_name) { executable(target_name) {
forward_variables_from(invoker, "*") forward_variables_from(invoker, "*")
if (!defined(deps)) { if (!defined(deps)) {
...@@ -439,11 +370,6 @@ template("test") { ...@@ -439,11 +370,6 @@ template("test") {
# Give tests the default manifest on Windows (a no-op elsewhere). # Give tests the default manifest on Windows (a no-op elsewhere).
"//build/win:default_exe_manifest", "//build/win:default_exe_manifest",
] ]
if (is_linux || is_mac || is_win) {
write_runtime_deps = _runtime_deps_file
deps += [ ":$_gen_runner_target" ]
}
} }
} }
} }
......
...@@ -1148,28 +1148,21 @@ class MetaBuildWrapper(object): ...@@ -1148,28 +1148,21 @@ class MetaBuildWrapper(object):
label = labels[0] label = labels[0]
build_dir = self.args.path build_dir = self.args.path
command, extra_files = self.GetIsolateCommand(target, vals) command, extra_files = self.GetIsolateCommand(target, vals)
# TODO(crbug.com/816629): Convert everything to wrapped_isolated_scripts # Any warning for an unused arg will get interleaved into the cmd's stdout.
# and remove the else-branch of this. # When that happens, the isolate step below will fail with an obscure error
if isolate_map[target]['type'] == 'wrapped_console_launcher': # when it tries processing the lines of the warning. Fail quickly in that
runtime_deps = self.ReadFile( # case to avoid confusion.
self.PathJoin(build_dir, target + '.runtime_deps')).splitlines() cmd = self.GNCmd('desc', build_dir, label, 'runtime_deps',
else: '--fail-on-unused-args')
# Any warning for an unused arg will get interleaved into the cmd's ret, out, _ = self.Call(cmd)
# stdout. When that happens, the isolate step below will fail with an if ret:
# obscure error when it tries processing the lines of the warning. Fail if out:
# quickly in that case to avoid confusion self.Print(out)
cmd = self.GNCmd('desc', build_dir, label, 'runtime_deps', return ret
'--fail-on-unused-args')
ret, out, _ = self.Call(cmd)
if ret:
if out:
self.Print(out)
return ret
runtime_deps = out.splitlines() runtime_deps = out.splitlines()
ret = self.WriteIsolateFiles(build_dir, command, target, runtime_deps, vals, ret = self.WriteIsolateFiles(build_dir, command, target, runtime_deps, vals,
extra_files) extra_files)
...@@ -1392,32 +1385,13 @@ class MetaBuildWrapper(object): ...@@ -1392,32 +1385,13 @@ class MetaBuildWrapper(object):
is_android = 'target_os="android"' in vals['gn_args'] is_android = 'target_os="android"' in vals['gn_args']
is_fuchsia = 'target_os="fuchsia"' in vals['gn_args'] is_fuchsia = 'target_os="fuchsia"' in vals['gn_args']
is_cros = ('target_os="chromeos"' in vals['gn_args'] is_cros = 'target_os="chromeos"' in vals['gn_args']
or 'is_chromeos_device=true' in vals['gn_args'] is_ios = 'target_os="ios"' in vals['gn_args']
or vals.get('cros_passthrough', False))
is_cros_device = ('is_chromeos_device=true' in vals['gn_args'] is_cros_device = ('is_chromeos_device=true' in vals['gn_args']
or vals.get('cros_passthrough', False)) or vals.get('cros_passthrough', False))
is_ios = 'target_os="ios"' in vals['gn_args'] is_mac = self.platform == 'darwin'
is_linux = ('target_os="linux"' in vals['gn_args']
or (self.platform in ('linux', 'linux2') and not is_android
and not is_fuchsia and not is_cros))
is_mac = self.platform == 'darwin' and not is_ios
is_win = self.platform == 'win32' or 'target_os="win"' in vals['gn_args'] is_win = self.platform == 'win32' or 'target_os="win"' in vals['gn_args']
test_type = isolate_map[target]['type']
if test_type.startswith('wrapped_'):
if is_mac or is_linux:
cmdline = ['bin/run_{}'.format(target)]
return cmdline, []
elif is_win:
cmdline = ['bin/run_{}.bat'.format(target)]
return cmdline, []
else:
test_type = test_type[len('wrapped_'):]
# TODO(crbug.com/816629): Convert everything to wrapped_isolated_scripts
# and delete the rest of this function.
# This should be true if tests with type='windowed_test_launcher' are # This should be true if tests with type='windowed_test_launcher' are
# expected to run using xvfb. For example, Linux Desktop, X11 CrOS and # expected to run using xvfb. For example, Linux Desktop, X11 CrOS and
# Ozone CrOS builds on Linux (xvfb is not used on CrOS HW or VMs). Note # Ozone CrOS builds on Linux (xvfb is not used on CrOS HW or VMs). Note
...@@ -1436,6 +1410,7 @@ class MetaBuildWrapper(object): ...@@ -1436,6 +1410,7 @@ class MetaBuildWrapper(object):
clang_coverage = 'use_clang_coverage=true' in vals['gn_args'] clang_coverage = 'use_clang_coverage=true' in vals['gn_args']
java_coverage = 'use_jacoco_coverage=true' in vals['gn_args'] java_coverage = 'use_jacoco_coverage=true' in vals['gn_args']
test_type = isolate_map[target]['type']
use_python3 = isolate_map[target].get('use_python3', False) use_python3 = isolate_map[target].get('use_python3', False)
executable = isolate_map[target].get('executable', target) executable = isolate_map[target].get('executable', target)
......
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