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 3bee6021db81335c8b6d32a080d8c595cc3d7c65..0f464c3cdce2ede3ad14f104fcc8e9b10de20643 100644 |
--- a/build/android/pylib/perf/test_runner.py |
+++ b/build/android/pylib/perf/test_runner.py |
@@ -63,6 +63,7 @@ from pylib import constants |
from pylib import forwarder |
from pylib.base import base_test_result |
from pylib.base import base_test_runner |
+from pylib.device import battery_utils |
from pylib.device import device_errors |
@@ -191,6 +192,7 @@ class TestRunner(base_test_runner.BaseTestRunner): |
self._tests = tests |
self._flaky_tests = flaky_tests |
self._output_dir = None |
+ self._device_battery = battery_utils.BatteryUtils(self.device) |
@staticmethod |
def _IsBetter(result): |
@@ -231,8 +233,15 @@ class TestRunner(base_test_runner.BaseTestRunner): |
return '' |
json_output_path = os.path.join(self._output_dir, 'results-chart.json') |
- with open(json_output_path) as f: |
- return f.read() |
+ try: |
+ with open(json_output_path) as f: |
+ return f.read() |
+ except IOError: |
+ logging.exception('Exception when reading chartjson.') |
+ logging.error('This usually means that telemetry did not run, so it could' |
+ ' not generate the file. Please check the device running' |
+ ' the test.') |
+ return '' |
def _LaunchPerfTest(self, test_name): |
"""Runs a perf test. |
@@ -261,6 +270,9 @@ class TestRunner(base_test_runner.BaseTestRunner): |
self._output_dir = tempfile.mkdtemp() |
cmd = cmd + ' --output-dir=%s' % self._output_dir |
+ logging.info( |
+ 'temperature: %s (0.1 C)', |
+ str(self._device_battery.GetBatteryInfo().get('temperature'))) |
logging.info('%s : %s', test_name, cmd) |
start_time = datetime.datetime.now() |