Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1264)

Unified Diff: build/android/pylib/perf/test_runner.py

Issue 1140783002: Surface test times of android tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Leave out total_time. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9d1f4371705ea9f1fdb8341a0328bf085463a44a..3bee6021db81335c8b6d32a080d8c595cc3d7c65 100644
--- a/build/android/pylib/perf/test_runner.py
+++ b/build/android/pylib/perf/test_runner.py
@@ -66,11 +66,29 @@ from pylib.base import base_test_runner
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):
with file(json_input, 'r') as 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:
o.write(json.dumps(step_values))
return 0
@@ -86,13 +104,9 @@ def PrintTestOutput(test_name, json_file_name=None):
Returns:
exit code generated by the test step.
"""
- 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)
+ persisted_result = GetPersistedResult(test_name)
+ if not persisted_result:
return 1
-
- with file(file_name, 'r') as f:
- persisted_result = pickle.loads(f.read())
logging.info('*' * 80)
logging.info('Output from:')
logging.info(persisted_result['cmd'])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698