Skip to content

Commit

Permalink
Have fuchsia bin/run wrappers call test_env.py directly
Browse files Browse the repository at this point in the history
Currently, when a bot runs a test (say, url_unittests) on Fuchsia,
it'll launch `python test_env.py bin/run_url_unittests` (roughly
speaking).

This CL flips that around so that the generated bin/run_ wrapper
script launches url_unittests (and the bot will invoke
bin/run_url_unittests directly).

This will make Fuchsia consistent with desktop, iOS, and LaCrOS;
ChromeOS and Android will be converted to match as well in
separate CLs.

Bug: 816629
Change-Id: Ic06adf43d9b80a1d454b5b691121dd76e22651e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360128
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#821932}
  • Loading branch information
dpranke authored and Commit Bot committed Oct 28, 2020
1 parent 8a703fd commit d5e9a1b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
28 changes: 23 additions & 5 deletions build/config/fuchsia/generate_runner_scripts.gni
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ declare_args() {
# "build/fuchsia". Defaults to "test_runner.py".
# install_only: If true, executing the script will only install the package
# on the device, but not run it.
# is_test_exe: If true, the generated script will run the command under
# test_env.py and add arguments expected to be passed to test exes.
template("fuchsia_package_runner") {
forward_variables_from(invoker, [ "runner_script" ])

Expand Down Expand Up @@ -70,11 +72,29 @@ template("fuchsia_package_runner") {
"testonly",
])

_is_test_exe = defined(invoker.is_test_exe) && invoker.is_test_exe

if (defined(runner_script)) {
executable = rebase_path(runner_script)
_runner_script = runner_script
} else {
_runner_script = "//build/fuchsia/test_runner.py"
}

if (_is_test_exe) {
executable = "//testing/test_env.py"
executable_args =
[ "@WrappedPath(" + rebase_path(_runner_script, root_out_dir) + ")" ]
data = [
_runner_script,
"//.vpython",
"//testing/test_env.py",
]
} else {
executable = rebase_path("//build/fuchsia/test_runner.py")
executable = rebase_path(_runner_script)
executable_args = []
data = []
}

wrapper_script = generated_run_pkg_script_path

data_deps = [
Expand All @@ -95,7 +115,7 @@ template("fuchsia_package_runner") {

# Declares the files that are needed for test execution on the
# swarming test client.
data = [
data += [
"//build/fuchsia/",
"//build/util/lib/",
"//third_party/fuchsia-sdk/sdk/.build-id/",
Expand Down Expand Up @@ -142,8 +162,6 @@ template("fuchsia_package_runner") {
data += [ "${fuchsia_additional_boot_image}/" ]
}

executable_args = []

package_paths = [ rebase_path(_package_path, root_build_dir) ]
if (defined(invoker.package_deps)) {
foreach(package_dep, invoker.package_deps) {
Expand Down
1 change: 1 addition & 0 deletions testing/test.gni
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ template("test") {

fuchsia_package_runner(target_name) {
testonly = true
is_test_exe = true
forward_variables_from(invoker,
[
"use_test_server",
Expand Down
1 change: 0 additions & 1 deletion tools/mb/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,6 @@ def GetSwarmingCommand(self, target, vals):
cmdline += ['--coverage-dir', '${ISOLATED_OUTDIR}']
elif is_fuchsia and test_type != 'script':
cmdline += [
'../../testing/test_env.py',
os.path.join('bin', 'run_%s' % target),
'--test-launcher-bot-mode',
'--system-log-file', '${ISOLATED_OUTDIR}/system_log'
Expand Down

0 comments on commit d5e9a1b

Please sign in to comment.