Commit e51641dd authored by Yun Liu's avatar Yun Liu Committed by Commit Bot

[code coverage] Don't throw exception when handling coverage data failed

Sometimes coverage data might not be generated on device due to wrong configs or tests and command will fail to pull data or remove data.
Don't throw exception so that runner can still print result.

Bug: 843307
Change-Id: Ie08cf676ca1ca2fb0d3ed4a087d31042c0f0a0ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636568Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Yun Liu <yliuyliu@google.com>
Cr-Commit-Position: refs/heads/master@{#664870}
parent 7f1006d4
...@@ -13,6 +13,7 @@ import re ...@@ -13,6 +13,7 @@ import re
import sys import sys
import time import time
from devil import base_error
from devil.android import crash_handler from devil.android import crash_handler
from devil.android import device_errors from devil.android import device_errors
from devil.android import device_temp_file from devil.android import device_temp_file
...@@ -577,11 +578,15 @@ class LocalDeviceInstrumentationTestRun( ...@@ -577,11 +578,15 @@ class LocalDeviceInstrumentationTestRun(
def handle_coverage_data(): def handle_coverage_data():
if self._test_instance.coverage_directory: if self._test_instance.coverage_directory:
try:
device.PullFile(coverage_directory, device.PullFile(coverage_directory,
self._test_instance.coverage_directory) self._test_instance.coverage_directory)
device.RunShellCommand( device.RunShellCommand(
'rm -f %s' % posixpath.join(coverage_directory, '*'), 'rm -f %s' % posixpath.join(coverage_directory, '*'),
check_return=True, shell=True) check_return=True,
shell=True)
except base_error.BaseError as e:
logging.warning('Failed to handle coverage data after tests: %s', e)
def handle_render_test_data(): def handle_render_test_data():
if _IsRenderTest(test): if _IsRenderTest(test):
......
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