Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5089)

Unified Diff: build/android/pylib/python_test_sharder.py

Issue 10917283: Upstream changes to python tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/python_test_caller.py ('k') | build/android/pylib/run_python_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/python_test_sharder.py
diff --git a/build/android/pylib/python_test_sharder.py b/build/android/pylib/python_test_sharder.py
index 7bab235a8ba48ea595c11dc0371b17b084230c06..e27096d788de922a52b6d15d5b9701670b19a9ec 100644
--- a/build/android/pylib/python_test_sharder.py
+++ b/build/android/pylib/python_test_sharder.py
@@ -4,6 +4,7 @@
"""Takes care of sharding the python-drive tests in multiple devices."""
+import copy
import logging
import multiprocessing
@@ -50,15 +51,13 @@ class PythonTestRunner(object):
DEFAULT_PORT + shard_index) if the test so wishes.
"""
- def __init__(self, device_id, shard_index):
+ def __init__(self, options):
"""Constructor.
Args:
- device_id: ID of the device which this test will talk to.
- shard_index: shard index, used to create such as unique port numbers.
+ options: Options to use for setting up tests.
"""
- self.device_id = device_id
- self.shard_index = shard_index
+ self.options = options
def RunTests(self):
"""Runs tests from the shared pool of tests, aggregating results.
@@ -70,7 +69,7 @@ class PythonTestRunner(object):
results = []
for t in tests:
- res = CallPythonTest(t, self.device_id, self.shard_index)
+ res = CallPythonTest(t, self.options)
results.append(res)
return TestResults.FromTestResults(results)
@@ -86,17 +85,18 @@ class PythonTestSharder(object):
Args:
attached_devices: a list of device IDs attached to the host.
- shard_retries: number of retries for any given test.
available_tests: a list of tests to run which subclass PythonTestBase.
+ options: Options to use for setting up tests.
Returns:
An aggregated list of test results.
"""
tests_container = None
- def __init__(self, attached_devices, shard_retries, available_tests):
+ def __init__(self, attached_devices, available_tests, options):
+ self.options = options
self.attached_devices = attached_devices
- self.retries = shard_retries
+ self.retries = options.shard_retries
self.tests = available_tests
def _SetupSharding(self, tests):
@@ -178,7 +178,10 @@ class PythonTestSharder(object):
logging.warning('*' * 80)
# Bind the PythonTestRunner to a device & shard index. Give it the
# runnable which it will use to actually execute the tests.
- test_runner = PythonTestRunner(device, index)
+ test_options = copy.deepcopy(self.options)
+ test_options.ensure_value('device_id', device)
+ test_options.ensure_value('shard_index', index)
+ test_runner = PythonTestRunner(test_options)
test_runners.append(test_runner)
return test_runners
« no previous file with comments | « build/android/pylib/python_test_caller.py ('k') | build/android/pylib/run_python_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698