syntax"
This is a reland of commit 8defc6c6da
Uses `sys.path.append(...)` to import the `common` module in
testing/scripts/run_variations_smoke_tests.py (as is done elsewhere in
the original CL) and resolve errors thrown for attempting a relative
import with no known parent package.
Original change's description:
>and Pylint2.7, and fix resulting errors.
>
>Bug: 1262363
>Change-Id: I09628427dd4caf9d873f3b489b897054430f8567
>Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3557490
>Reviewed-by: Ben Pastene <bpastene@chromium.org>
>Commit-Queue: Joshua Hood <jdh@chromium.org>
>Cr-Commit-Position: refs/heads/main@{#996200}
Bug: 1262363
Change-Id: I60fe062f62962d0b3dc4e93d9e29626ed181f688
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3610783
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Joshua Hood <jdh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#999432}
1. Fix py23 compatibility
2. Redirect log messages to stderr. "print" uses buffers when
writes to stdout. Due to stdout buffering, messages from "print"
are written to log file in the last order and does not appear
in the place they are expected to be.
3. Delete unused imports
Change-Id: Ideb013ab96e24a192050de1a057f8abeb83ed27c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3595879
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: John Chen <johnchen@chromium.org>
Commit-Queue: Dmitry Shcherbinin <cher-di@yandex-team.ru>
Cr-Commit-Position: refs/heads/main@{#995691}
This is no longer needed, as the bots have the right ACLs
from the point of creation.
This also means that the code can be moved back into
build/win as it's only needed in one place.
BUG=1307013,1191111
Change-Id: Ib85c4fe4b460640048bbb353c54011816b581648
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3591875
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#993791}
set_lpac_acls is for correct LPAC (less privileged app container) sandbox of CAS cache hard linking files (crbug.com/1225029#c21). When running tests under the entire code directory, it could take ~90s to setup ACLs. For the tests that doesn't depends on sandbox, set_lpac_acls could be skipped.
Bug: 1266194
Change-Id: I8e5eb71230fb55083869d29d3edd7adb58caffef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3259239
Auto-Submit: Kuan Huang <kuanhuang@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/main@{#938560}
crbug/1235878 seems to indicate that the test binaries are not starting
correctly. This CL adds logging to test_env.py to print the return
code of the binary to help debug what might be failing.
Bug: 1235878
Change-Id: Ia1dd6c05d7b6563d8c124df9cc3a68de34bd623d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3245566
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Roger Tawa <rogerta@chromium.org>
Cr-Commit-Position: refs/heads/main@{#935393}
The luci infrastructure uses a cache for some swarming files and
hard links from the cache to the test directory.
This causes the script that sets LPAC ACLs to not successfully
set the right ACLs on these files.
This addition to the set_lpac_acls function means that, when
running as part of a test, these files are identified and
the correct ACL is written to them.
BUG=1225029
Change-Id: I35d89c83e906f6cc880908ec43d8a470c4bb8ae0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3075257
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#909114}
This change inserts //testing/scripts to the front of sys.path rather
than the end of it so that //testing/scripts/common.py is found by
"import common" rather than some other common.py that happens to be in
the path.
R=dpranke@google.com
Bug: 1215025
Change-Id: Ibbbfd4d032b1e5061fac40bdf0cb51297aa6d866
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2940526
Auto-Submit: Greg Thompson <grt@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#889541}
In order for binaries running under LPAC sandbox to operate they
need read access to their own files.
This change consists of two parts, the first part sets the ACL
when building a component that depends on sandbox (e.g. on a
developer workstation).
The second part sets the ACL when running tests as part of
running tests on a host where the build did not happen e.g.
as part of a swarming isolate or test infrastructure.
Note: on a full Chrome install, these ACLs are set by the
installer.
Add a test to sbox_integration_tests to verify this works.
BUG=1191111
Change-Id: I88d4e53cb11dbd52316cd1a605bce94518f62772
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2811185
Commit-Queue: Will Harris <wfh@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: James Forshaw <forshaw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#874038}
https://crrev.com/c/2229335 added a dependency on `six` from
test_env.py in order to try and make it compatible with both
Python 2 and Python 3. However, it got the path to the
//third_party version of six wrong, and so it actually only worked
if six was available otherwise in the Python install (which it is,
most of the time, these days).
The script didn't actually benefit much from six, though, so
rather than fix the import path, this CL just makes the code
2- and 3-compatible without needing six, and removes the dependency
instead.
Bug: 942720
Change-Id: I44e44772cea8d92eff10a5c59879ce4d05de8fcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2545924
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828587}
When running blink web tests it is important to invoke the wrapper
script (run_isolated_script_test.py) with vpython or else psutil and six
will fail to import.
This change wraps the import of psutil and six in an exception handler
so that a useful error message can be printed. This should make it
easier for users to find the correct solution.
Change-Id: Ia2712e97790d8b54bb9cc640ace37a0fe01ce1c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495868
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820453}
This reverts commit 320f9516ab.
Reason for revert: deduping was reset, comment no longer needed
Original change's description:
> Add a whitespace change to test_env.py to reset swarming deduplication.
>
> Due to emergency server maintenance in crbug.com/1069091, we need all
> tests to not be deduplicated into tests that ran prior to the
> maintenance. Adding a trivial change to //testing/test_env.py will
> prevent any task deduplication since most every test includes this file
> in its inputs.
>
> TBR=johnchen
>
> No-Try: true
> No-Tree-Checks: true
> Bug: 1069091
> Change-Id: If99af96b6bce7b00cd982de0234b39dbb9a9ec89
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2142619
> Commit-Queue: Ben Pastene <bpastene@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#757517}
TBR=iannucci@chromium.org,bpastene@chromium.org,johnchen@chromium.org
Change-Id: If0b620f3461efeef34ec7a0d24fcd813f585d00b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1069091
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144360
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757943}
Due to emergency server maintenance in crbug.com/1069091, we need all
tests to not be deduplicated into tests that ran prior to the
maintenance. Adding a trivial change to //testing/test_env.py will
prevent any task deduplication since most every test includes this file
in its inputs.
TBR=johnchen
No-Try: true
No-Tree-Checks: true
Bug: 1069091
Change-Id: If99af96b6bce7b00cd982de0234b39dbb9a9ec89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2142619
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757517}
test_env.py isn't compatible with python3 due to dict.iteritem() calls,
and perhaps more. Consequently, when running the script via the shebang
on an environment that defaults to python3, the script will fail.
This fixes that by explicitly setting invocations of `./test_env.py` to
use the system's python2 (if it has one).
Bug: 942720
Change-Id: I6dc18b5fedace510c61628e88701e89410715ecb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2068896
Reviewed-by: John Budorick <jbudorick@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743983}
Makes test_env.py compatible with both Python 2 and 3. Also adds a very
simple test to ensure that it remains compatible until some other test
switches to Python 3.
As a side effect of adding the test, also makes
testing/scripts/common.py compatible with Python 3 since it's
necessary for running isolated scripts.
Bug: 898348
Change-Id: Ib58cf4c4f85df60a432764d7f744bc3fee09ae3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796525
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695825}
Instead, ask readers to use the isolated output directory to find the
exact logs that they are looking for. This will clean up the swarming
task output to simply become a summary explaining which benchmark runs
were kicked off.
Bug: 947103
Change-Id: I199530972acd5f1402396ddda10ac82cf61fc229
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1629432
Reviewed-by: John Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664957}
When we run a gtest-based test under swarming, if we only want to
run one shard of a test (as opposed to all of the tests), we set
GTEST_SHARD_INDEX and GTEST_TOTAL_SHARDS as environment variables.
Prior to this CL, we wouldn't actually log the values of those,
meaning that if you were only looking at the output of the test,
you wouldn't know that they were set at all, let alone what they
were set to. And that made it hard to reproduce the test run.
This CL changes test_env.py to print out the two variables if they
are set, to address that.
Change-Id: Ic1009152b8f0cb7867379a2badfcf471718a60d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1549898
Reviewed-by: Albert J. Wong <ajwong@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#647093}
https://chromium.googlesource.com/infra/luci/luci-py/+/master/appengine/swarming/doc/Bot.md#graceful-termination_aka-the-sigterm-and-sigkill-dance
test_env.py already has support for this, but it looks like a lot
of the scripts aren't using it. One reason for that could be that
there wasn't a run_command function there yet. I added a simple
run_command function, and made a bunch of scripts use it.
This should fix up all the test suites that use common.py's
functions to run subprocesses including:
- run_telemetry_as_googletest.py
- run_chromedriver_test.py
- telemetry_gpu_unittests.py
- telemetry_perf_unittests.py
- telemetry_unittests.py
And many more!
Also delete common's run_integration_test function since no
one is using it.
Bug: 921662, 910584
Change-Id: If670e1b5725e3a7dcfda471b7141d47c73c5ef82
Reviewed-on: https://chromium-review.googlesource.com/c/1461512
Reviewed-by: John Budorick <jbudorick@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
Auto-Submit: Caleb Rouleau <crouleau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634740}
views_perftests run like cc_perftests. However, they need xvfb.
cc_perftests uses run_gtest_perf_test.py. However, its xvfb support has
been broken since r434762 which removed should_start_xvfb and other things.
run_telemetry_benchmark_as_googletest.py was fixed to cater for this
change in r491092. However, the same fix does not work for
run_gtest_perf_test.py because the helper in xvfb.py does not allow
stdout to redirect to a file, which is needed for the perf chart json
output.
Update xvfb.py to support this. However, having xvfb.py depend on
scripts/common.py creates a mess, so resolve by moving the
run_command_with_output() wrapper from testing/scripts/common.py to
testing/test_env.py. Nothing else is using it.
Start wrapping these test scripts in a proper gn target in testing/BUILD.gn
to avoid the same list appearing in dozens of places. However, this exposes
testing/BUILD.gn to the `gn check` graph, which requires fixing a silent
dependency that lots of test targets have on //testing/gmock_mutant.
Bug: 785522
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I413b642d53a8a6c8f8cc5326ff47e899b36abd37
Reviewed-on: https://chromium-review.googlesource.com/848466
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531789}
When tests were run locally on buildbot builders, we'd set
CHROME_HEADLESS to tell tests that they weren't being run
interactively (so we wouldn't do things like show modal dialogs
that might be flaky or problematic).
Apparently we never thought to propagate this over to swarming :(.
This change sets the env var in test_env.py, which should take
effect for all desktop gtest-based tests. It's unclear if the
env var also is needed for iOS and Android, and whether we'll
need to set this elsewhere as well, but this should solve at
least some problems for now.
R=jbudorick@chromium.org, maruel@chromium.org
BUG=790985
Change-Id: I3914568c2a9e56ae5f6e450708491fecf6f57f48
Reviewed-on: https://chromium-review.googlesource.com/804398
Reviewed-by: John Budorick <jbudorick@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521127}