New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 816629 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature

Blocked on: View detail
issue 897803
issue 898036



Sign in to add a comment

Implement generic wrapper scripts

Project Member Reported by jbudorick@chromium.org, Feb 26 2018

Issue description

A few years ago, we implemented wrapper scripts for the android test runner. They take all of the arguments that are constant at build time, handle some path adjustments, and write everything to a python script in the output directory. Users then simply invoke that script rather than worry about fiddling with arguments that are always the same.

There are two components to this:
 - a gn template: https://codesearch.chromium.org/chromium/src/build/config/android/internal_rules.gni?rcl=a0ae55129a320e3f08310e8a2322d8bc93846ded&l=428
 - a script invoked by the gn template: https://codesearch.chromium.org/chromium/src/build/android/gyp/create_test_runner_script.py

This model has proven sufficiently useful that it has spawned quite a few copycats: https://codesearch.chromium.org/search/?q=file:create_.*_script%5C.py&sq=package:chromium&type=cs

Implementing a separate template and script for everything we want to wrap doesn't scale well, though. We'd like to have a generic mechanism for binding build-time constant arguments into a wrapper script. This should minimally support things that conform to bit.ly/chromium-test-runner-api, though supporting other binaries as well would be ideal.

A solution here should replace the command-line portions of mb.py (see item #3 in https://bugs.chromium.org/p/chromium/issues/detail?id=665183). It should also allow us to simplify specification of the common "target with specific flags" pattern (e.g. site_per_process_browser_tests, which we could conceivably declare as a lightweight gn target).
 
> This should minimally support things that conform to 
> bit.ly/chromium-test-runner-api, though supporting other binaries as well
> would be ideal.

I'm not sure that anything actually supports this today (I have to go back and re-read the doc). I think probably what I would propose is that we tweak that doc to find the right subset of flags that does (or almost does) work today, and then make all of the binaries support that API.

Supporting multiple APIs pretty much defeats the point of much of this.
Project Member

Comment 2 by bugdroid1@chromium.org, Jun 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb

commit 6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb
Author: Dirk Pranke <dpranke@chromium.org>
Date: Wed Jun 13 00:23:20 2018

Use wrapper scripts on desktop to run tests.

In order to simplify how we configure tests, it would be good if
every test target was invoked the same way on every platform.

Today, on Android, CrOS, and Fuchsia, we generate wrapper scripts
for every test target and put them in $root_build_dir/bin; these
scripts are responsible for setting up the environment (devices,
VMs, etc.) and invoking the test directly.

This CL continues this pattern and generates wrappers that will
work on Linux, Mac, and Win following the same pattern (on Windows,
the wrappers will be bin/run_base_unittests.bat instead of
bin/run_base_unittests).

As a proof of concept, this CL switches url_unittests to run via
the wrapper. Assuming this change lands and sticks, in follow-up
changes we'll convert the others as well.

This design should also help us eventually get rid of
gn_isolate_map.pyl; in order to do that, we will also need to
not translate between ninja target names and GN labels, but
that will require changes to GN.

Bug: 816629
Change-Id: I66f8ca78472564ee46cc8d3d012591a275566d1f
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/736162
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566644}
[modify] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/testing/buildbot/gn_isolate_map.pyl
[add] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/testing/gen_desktop_runner_script.py
[modify] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/testing/test.gni
[modify] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/tools/mb/mb.py

Project Member

Comment 3 by bugdroid1@chromium.org, Jun 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb

commit 6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb
Author: Dirk Pranke <dpranke@chromium.org>
Date: Wed Jun 13 00:23:20 2018

Use wrapper scripts on desktop to run tests.

In order to simplify how we configure tests, it would be good if
every test target was invoked the same way on every platform.

Today, on Android, CrOS, and Fuchsia, we generate wrapper scripts
for every test target and put them in $root_build_dir/bin; these
scripts are responsible for setting up the environment (devices,
VMs, etc.) and invoking the test directly.

This CL continues this pattern and generates wrappers that will
work on Linux, Mac, and Win following the same pattern (on Windows,
the wrappers will be bin/run_base_unittests.bat instead of
bin/run_base_unittests).

As a proof of concept, this CL switches url_unittests to run via
the wrapper. Assuming this change lands and sticks, in follow-up
changes we'll convert the others as well.

This design should also help us eventually get rid of
gn_isolate_map.pyl; in order to do that, we will also need to
not translate between ninja target names and GN labels, but
that will require changes to GN.

Bug: 816629
Change-Id: I66f8ca78472564ee46cc8d3d012591a275566d1f
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/736162
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566644}
[modify] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/testing/buildbot/gn_isolate_map.pyl
[add] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/testing/gen_desktop_runner_script.py
[modify] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/testing/test.gni
[modify] https://crrev.com/6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb/tools/mb/mb.py

Project Member

Comment 4 by bugdroid1@chromium.org, Jun 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2f5f734017ff28abdd5d2389de3cfeef42b6ffa9

commit 2f5f734017ff28abdd5d2389de3cfeef42b6ffa9
Author: Abhishek Arya <inferno@chromium.org>
Date: Wed Jun 13 16:59:44 2018

Revert "Use wrapper scripts on desktop to run tests."

This reverts commit 6c448b73b6f2ee03435eb8d2d9e6d1125b22a2cb.

Reason for revert: Breaks ClusterFuzz libFuzzer bots

We shouldn't add bin/ directory with run_<fuzzer_name>_fuzzer.

Original change's description:
> Use wrapper scripts on desktop to run tests.
> 
> In order to simplify how we configure tests, it would be good if
> every test target was invoked the same way on every platform.
> 
> Today, on Android, CrOS, and Fuchsia, we generate wrapper scripts
> for every test target and put them in $root_build_dir/bin; these
> scripts are responsible for setting up the environment (devices,
> VMs, etc.) and invoking the test directly.
> 
> This CL continues this pattern and generates wrappers that will
> work on Linux, Mac, and Win following the same pattern (on Windows,
> the wrappers will be bin/run_base_unittests.bat instead of
> bin/run_base_unittests).
> 
> As a proof of concept, this CL switches url_unittests to run via
> the wrapper. Assuming this change lands and sticks, in follow-up
> changes we'll convert the others as well.
> 
> This design should also help us eventually get rid of
> gn_isolate_map.pyl; in order to do that, we will also need to
> not translate between ninja target names and GN labels, but
> that will require changes to GN.
> 
> Bug: 816629
> Change-Id: I66f8ca78472564ee46cc8d3d012591a275566d1f
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/736162
> Commit-Queue: Dirk Pranke <dpranke@chromium.org>
> Reviewed-by: Ben Pastene <bpastene@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#566644}

TBR=dpranke@chromium.org,bpastene@chromium.org,jbudorick@chromium.org,shenghuazhang@chromium.org

Change-Id: I48d2be908c2f2ec529195e27b44c1032bd2d62a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 816629
Reviewed-on: https://chromium-review.googlesource.com/1099295
Reviewed-by: Abhishek Arya <inferno@chromium.org>
Commit-Queue: Abhishek Arya <inferno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566879}
[modify] https://crrev.com/2f5f734017ff28abdd5d2389de3cfeef42b6ffa9/testing/buildbot/gn_isolate_map.pyl
[delete] https://crrev.com/11a4d06d37bd1e94e6b69a21cd40271a7a5d36ac/testing/gen_desktop_runner_script.py
[modify] https://crrev.com/2f5f734017ff28abdd5d2389de3cfeef42b6ffa9/testing/test.gni
[modify] https://crrev.com/2f5f734017ff28abdd5d2389de3cfeef42b6ffa9/tools/mb/mb.py

Cc: infe...@chromium.org
Note that when this is re-checked, it is not enabled on any of clusterfuzz builders. these include

all lkgr bots
https://ci.chromium.org/p/chromium/g/chromium.lkgr/console

and all libfuzzer, afl bots
on https://ci.chromium.org/p/chromium/g/chromium.fyi/console

This confuses the logic in clusterfuzz when looking for fuzzer binaries.
Can we change the logic in clusterfuzz? Is it doing something like globbing on *fuzzer to find binaries? Maybe it should be ignoring things in the bin/ directory?
This has been discussed offline with Dirk. fuzzer_test will be excluded from this.
Owner: ----
Status: Available (was: Assigned)
Cc: nednguyen@chromium.org kbr@chromium.org
I may work on this for Telemetry tests & layout tests.
Blockedon: 897803
Blockedon: 898036
Cc: perezju@chromium.org
+Juan: this is a cool new direction that will allow removing all the apk/browser inferring logic in Telemetry. The idea is the runnable benchmark script will be generated during BUILD time & have all the needed runtime constant filled.

Sign in to add a comment