Commit 8a9efca9 authored by simonhatch's avatar simonhatch Committed by Commit bot

Surface test times of android tests.

Right now we have no easy visibility on time taken for individual tests, since everything runs under one massive "Sharded Perf Tests" step. We're trying to balance the tests across devices to improve cycle time, so we need a way to see how long each test is actually taking.

BUG=466101

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

Cr-Commit-Position: refs/heads/master@{#329722}
parent 9a6cbec6
...@@ -66,11 +66,29 @@ from pylib.base import base_test_runner ...@@ -66,11 +66,29 @@ from pylib.base import base_test_runner
from pylib.device import device_errors from pylib.device import device_errors
def GetPersistedResult(test_name):
file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name)
if not os.path.exists(file_name):
logging.error('File not found %s', file_name)
return None
with file(file_name, 'r') as f:
return pickle.loads(f.read())
def OutputJsonList(json_input, json_output): def OutputJsonList(json_input, json_output):
with file(json_input, 'r') as i: with file(json_input, 'r') as i:
all_steps = json.load(i) all_steps = json.load(i)
step_values = [{'test': k, 'device_affinity': v['device_affinity']}
for k, v in all_steps['steps'].iteritems()] step_values = []
for k, v in all_steps['steps'].iteritems():
data = {'test': k, 'device_affinity': v['device_affinity']}
persisted_result = GetPersistedResult(k)
if persisted_result:
data['total_time'] = persisted_result['total_time']
step_values.append(data)
with file(json_output, 'w') as o: with file(json_output, 'w') as o:
o.write(json.dumps(step_values)) o.write(json.dumps(step_values))
return 0 return 0
...@@ -86,13 +104,9 @@ def PrintTestOutput(test_name, json_file_name=None): ...@@ -86,13 +104,9 @@ def PrintTestOutput(test_name, json_file_name=None):
Returns: Returns:
exit code generated by the test step. exit code generated by the test step.
""" """
file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name) persisted_result = GetPersistedResult(test_name)
if not os.path.exists(file_name): if not persisted_result:
logging.error('File not found %s', file_name)
return 1 return 1
with file(file_name, 'r') as f:
persisted_result = pickle.loads(f.read())
logging.info('*' * 80) logging.info('*' * 80)
logging.info('Output from:') logging.info('Output from:')
logging.info(persisted_result['cmd']) logging.info(persisted_result['cmd'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment