diff options
author | shashishekhar@chromium.org <shashishekhar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-17 17:22:36 +0000 |
---|---|---|
committer | shashishekhar@chromium.org <shashishekhar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-17 17:22:36 +0000 |
commit | 297daba07a20267c1b2e8e83e4d9c2065c979a79 (patch) | |
tree | d91ba52c28dbfee67f22cc3726b2b4ceea8a7c8b /build/android/pylib/python_test_sharder.py | |
parent | 263898a838fafcb0c77fb6c6a309a91000f48e32 (diff) | |
download | chromium_src-297daba07a20267c1b2e8e83e4d9c2065c979a79.zip chromium_src-297daba07a20267c1b2e8e83e4d9c2065c979a79.tar.gz chromium_src-297daba07a20267c1b2e8e83e4d9c2065c979a79.tar.bz2 |
Upstream changes to python tests.
Upstream recent changes to Python scripts which pass commandline
args to Java tests.
BUG=
Review URL: https://chromiumcodereview.appspot.com/10917283
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/pylib/python_test_sharder.py')
-rw-r--r-- | build/android/pylib/python_test_sharder.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/build/android/pylib/python_test_sharder.py b/build/android/pylib/python_test_sharder.py index 7bab235..e27096d 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 |