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

Unified Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 2545653002: (Reland) Insert logcat as part of test result for android instrumentation tests. (Closed)
Patch Set: add more exceptions Created 4 years 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
Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
index a203ce069e5bc4760c2a84be3808e1aae3fb94f6..f522322d09e35acea2e2b7f73c8d830091cd848f 100644
--- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py
+++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -12,13 +12,13 @@ from devil.android import device_errors
from devil.android import flag_changer
from devil.utils import reraiser_thread
from pylib import valgrind_tools
+from pylib.android import logdog_logcat_monitor
from pylib.base import base_test_result
from pylib.instrumentation import instrumentation_test_instance
from pylib.local.device import local_device_environment
from pylib.local.device import local_device_test_run
import tombstones
-
_TAG = 'test_runner_py'
TIMEOUT_ANNOTATIONS = [
@@ -245,10 +245,19 @@ class LocalDeviceInstrumentationTestRun(
device.RunShellCommand(
['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name],
check_return=True)
+ logcat_url = None
time_ms = lambda: int(time.time() * 1e3)
start_ms = time_ms()
- output = device.StartInstrumentation(
- target, raw=True, extras=extras, timeout=timeout, retries=0)
+ if self._test_instance.should_save_logcat:
+ with logdog_logcat_monitor.LogdogLogcatMonitor(
+ device.adb,
+ 'logcat_%s' % test_name.replace('#', '.')) as logmon:
+ output = device.StartInstrumentation(
+ target, raw=True, extras=extras, timeout=timeout, retries=0)
+ logcat_url = logmon.GetLogcatURL()
+ else:
+ output = device.StartInstrumentation(
+ target, raw=True, extras=extras, timeout=timeout, retries=0)
finally:
device.RunShellCommand(
['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name],
@@ -266,6 +275,8 @@ class LocalDeviceInstrumentationTestRun(
self._test_instance.ParseAmInstrumentRawOutput(output))
results = self._test_instance.GenerateTestResults(
result_code, result_bundle, statuses, start_ms, duration_ms)
+ for result in results:
+ result.SetLogcatUrl(logcat_url)
# Update the result name if the test used flags.
if flags:
« no previous file with comments | « build/android/pylib/instrumentation/instrumentation_test_instance.py ('k') | build/android/pylib/results/json_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698