| 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 991fc003049152246d89d15f290b88c8c1b228c9..dc86d3629e92f3317ea1d939140743d6988099d5 100644
|
| --- a/build/android/pylib/perf/test_runner.py
|
| +++ b/build/android/pylib/perf/test_runner.py
|
| @@ -66,6 +66,8 @@ from pylib.base import base_test_runner
|
| from pylib.device import battery_utils
|
| from pylib.device import device_errors
|
|
|
| +NUM_DEVICE_AFFINITIES = 8
|
| +
|
|
|
| def GetPersistedResult(test_name):
|
| file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name)
|
| @@ -173,22 +175,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)
|
| 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
|
| @@ -215,12 +214,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']
|
| + if not (0 <= affinity and affinity < NUM_DEVICE_AFFINITIES):
|
| + raise Exception('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):
|
|
|