Skip to content

Commit

Permalink
chromeos: Switch to subprocess32 (instead of 42) in test runner.
Browse files Browse the repository at this point in the history
In the beginning python was created. This has made a lot of people
very angry and been widely regarded as a bad move.

Bug: 1050466
Change-Id: Ieac7ca2a42cb21e78d77d628c3fb645d32b7625f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2047351
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#740044}
  • Loading branch information
bpastene authored and Commit Bot committed Feb 10, 2020
1 parent ff1d044 commit 006cf3e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
16 changes: 16 additions & 0 deletions .vpython
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#
# Read more about `vpython` and how to modify this file here:
# https://chromium.googlesource.com/infra/infra/+/master/doc/users/vpython.md
#
# For the definition of this spec, see:
# https://chromium.googlesource.com/infra/luci/luci-go/+/master/vpython/api/vpython/spec.proto

python_version: "2.7"

Expand All @@ -30,6 +33,19 @@ wheel: <
name: "infra/python/wheels/jsonlines-py2_py3"
version: "version:1.2.0"
>
wheel: <
name: "infra/python/wheels/subprocess32/${vpython_platform}"
version: "version:3.5.0rc1"
# Only download for linux since we shouldn't be running CrOS tests on mac/win.
match_tag: <
abi: "cp27mu"
platform: "manylinux1_i686"
>
match_tag: <
abi: "cp27mu"
platform: "manylinux1_x86_64"
>
>

# Used by:
# build/chromeos/test_runner.py
Expand Down
13 changes: 5 additions & 8 deletions build/chromeos/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
from pylib.base import base_test_result # pylint: disable=import-error
from pylib.results import json_results # pylint: disable=import-error

# Use luci-py's subprocess42.py
sys.path.insert(
0, os.path.join(CHROMIUM_SRC_PATH, 'tools', 'swarming_client', 'utils'))
import subprocess42 # pylint: disable=import-error
import subprocess32 as subprocess # pylint: disable=import-error

DEFAULT_CROS_CACHE = os.path.abspath(
os.path.join(CHROMIUM_SRC_PATH, 'build', 'cros_cache'))
Expand Down Expand Up @@ -187,20 +184,20 @@ def _kill_child_procs(trapped_signal, _):
logging.info('########################################')
logging.info('Test attempt #%d', i)
logging.info('########################################')
test_proc = subprocess42.Popen(
test_proc = subprocess.Popen(
self._test_cmd,
stdout=sys.stdout,
stderr=sys.stderr,
env=self._test_env)
try:
test_proc.wait(timeout=self._timeout)
except subprocess42.TimeoutExpired:
except subprocess.TimeoutExpired:
logging.error('Test timed out. Sending SIGTERM.')
# SIGTERM the proc and wait 10s for it to close.
test_proc.terminate()
try:
test_proc.wait(timeout=10)
except subprocess42.TimeoutExpired:
except subprocess.TimeoutExpired:
# If it hasn't closed in 10s, SIGKILL it.
logging.error('Test did not exit in time. Sending SIGKILL.')
test_proc.kill()
Expand Down Expand Up @@ -710,7 +707,7 @@ def host_cmd(args, unknown_args):
logging.info('Running the following command:')
logging.info(' '.join(cros_run_test_cmd))

return subprocess42.call(
return subprocess.call(
cros_run_test_cmd, stdout=sys.stdout, stderr=sys.stderr, env=test_env)


Expand Down

0 comments on commit 006cf3e

Please sign in to comment.