Chromium Code Reviews| Index: build/android/pylib/perf/test_runner.py |
| diff --git a/build/android/pylib/perf/test_runner.py b/build/android/pylib/perf/test_runner.py |
| index b7fadd23e724807751dadbf00344378f3a18315b..cc693e1a2aaffef6cf6f6413962836cdde0d65c5 100644 |
| --- a/build/android/pylib/perf/test_runner.py |
| +++ b/build/android/pylib/perf/test_runner.py |
| @@ -65,6 +65,8 @@ from pylib.base import base_test_result |
| from pylib.base import base_test_runner |
| from pylib.device import device_errors |
| +NUM_DEVICE_AFFINITIES = 8 |
|
jbudorick
2015/05/23 01:06:49
What if the number of devices is higher than 8? I
luqui
2015/05/27 20:01:12
As far as I could tell there are no specs of devic
shatch
2015/05/28 13:59:17
This isn't a thing yet, but we did ask for some in
jbudorick
2015/05/28 14:03:16
Currently there aren't, and I don't think we have
|
| + |
| def OutputJsonList(json_input, json_output): |
| with file(json_input, 'r') as i: |
| @@ -157,22 +159,19 @@ class _HeartBeatLogger(object): |
| class TestRunner(base_test_runner.BaseTestRunner): |
| - def __init__(self, test_options, device, shard_index, max_shard, tests, |
| - flaky_tests): |
| + def __init__(self, test_options, device, affinities, tests, flaky_tests): |
| """A TestRunner instance runs a perf test on a single device. |
| Args: |
| test_options: A PerfOptions object. |
| device: Device to run the tests. |
| - shard_index: the index of this device. |
| - max_shards: the maximum shard index. |
| + affinities: the list of affinities to run on this shard. |
| tests: a dict mapping test_name to command. |
| flaky_tests: a list of flaky test_name. |
| """ |
| super(TestRunner, self).__init__(device, None, 'Release') |
| self._options = test_options |
| - self._shard_index = shard_index |
| - self._max_shard = max_shard |
| + self._affinities = affinities |
| self._tests = tests |
| self._flaky_tests = flaky_tests |
| self._output_dir = None |
| @@ -198,12 +197,14 @@ class TestRunner(base_test_runner.BaseTestRunner): |
| def _CheckDeviceAffinity(self, test_name): |
| """Returns True if test_name has affinity for this shard.""" |
| - affinity = (self._tests['steps'][test_name]['device_affinity'] % |
| - self._max_shard) |
| - if self._shard_index == affinity: |
| + affinity = self._tests['steps'][test_name]['device_affinity'] |
| + assert 0 <= affinity and affinity < NUM_DEVICE_AFFINITIES, ( |
|
jbudorick
2015/05/23 01:06:49
This should be an exception. We generally avoid as
luqui
2015/05/27 20:01:12
Done.
|
| + 'Got out-of-range device affinity %s' % affinity) |
| + if affinity in self._affinities: |
| return True |
| - logging.info('Skipping %s on %s (affinity is %s, device is %s)', |
| - test_name, self.device_serial, affinity, self._shard_index) |
| + logging.info( |
| + 'Skipping %s on %s (affinity is %s, allowed affinities are %s)', |
| + test_name, self.device_serial, affinity, self._affinities) |
| return False |
| def _CleanupOutputDirectory(self): |