[Android] Add optional per-test cooling wait for perf tests.

BUG=489317

Review URL: https://codereview.chromium.org/1214483011

Cr-Original-Commit-Position: refs/heads/master@{#337078}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5cfff8796886f64291213d686011b1354c17e924
This commit is contained in:
jbudorick 2015-07-01 11:46:13 -07:00 коммит произвёл Commit bot
Родитель 44fba59a67
Коммит bb901d00ee
4 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -455,7 +455,7 @@ class BatteryUtils(object):
logging.info('Current battery temperature: %s', temp)
return int(temp) <= target_temp
logging.info('Waiting for the device to cool down to %s degrees.',
logging.info('Waiting for the device to cool down to %s (0.1 C)',
target_temp)
timeout_retry.WaitFor(cool_device, wait_period=wait_period)

Просмотреть файл

@ -17,4 +17,5 @@ PerfOptions = collections.namedtuple('PerfOptions', [
'single_step',
'collect_chartjson_data',
'output_chartjson_data',
'max_battery_temp',
])

Просмотреть файл

@ -273,6 +273,10 @@ class TestRunner(base_test_runner.BaseTestRunner):
logging.info(
'temperature: %s (0.1 C)',
str(self._device_battery.GetBatteryInfo().get('temperature')))
if self._options.max_battery_temp:
self._device_battery.LetBatteryCoolToTemperature(
self._options.max_battery_temp)
logging.info('%s : %s', test_name, cmd)
start_time = datetime.datetime.now()

Просмотреть файл

@ -606,6 +606,11 @@ def AddPerfTestOptions(parser):
group.add_argument(
'--dry-run', action='store_true',
help='Just print the steps without executing.')
# Uses 0.1 degrees C because that's what Android does.
group.add_argument(
'--max-battery-temp', type=int,
help='Only start tests when the battery is at or below the given '
'temperature (0.1 C)')
group.add_argument('single_step_command', nargs='*', action=SingleStepAction,
help='If --single-step is specified, the command to run.')
AddCommonOptions(parser)
@ -630,7 +635,7 @@ def ProcessPerfTestOptions(args):
args.steps, args.flaky_steps, args.output_json_list,
args.print_step, args.no_timeout, args.test_filter,
args.dry_run, args.single_step, args.collect_chartjson_data,
args.output_chartjson_data)
args.output_chartjson_data, args.max_battery_temp)
def AddPythonTestOptions(parser):