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

Unified Diff: build/android/pylib/utils/logdog_helper.py

Issue 2701473003: Add failure screenshots and render test images to results detail. (Closed)
Patch Set: Add failure screenshots and render test images to results detail. Created 3 years, 10 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
Index: build/android/pylib/utils/logdog_helper.py
diff --git a/build/android/pylib/utils/logdog_helper.py b/build/android/pylib/utils/logdog_helper.py
index 8dfab7e403952e580c327c1498bc77e5e79f2b9e..429f96bab54bd7e4fd69c21cce174f05e5df164e 100644
--- a/build/android/pylib/utils/logdog_helper.py
+++ b/build/android/pylib/utils/logdog_helper.py
@@ -7,14 +7,21 @@
import logging
import os
import sys
+import time
+
+from devil.utils import cmd_helper
from pylib import constants
+from pylib.constants import host_paths
from pylib.utils import decorators
sys.path.insert(0, os.path.abspath(os.path.join(
constants.DIR_SOURCE_ROOT, 'tools', 'swarming_client')))
from libs.logdog import bootstrap # pylint: disable=import-error
+sys.path.append(os.path.join(host_paths.DIR_SOURCE_ROOT, 'build'))
+import find_depot_tools # pylint: disable=import-error
+
@decorators.NoRaiseException(default_return_value='')
def text(name, data):
@@ -78,6 +85,44 @@ def get_viewer_url(name):
return get_logdog_client().get_viewer_url(name)
+@decorators.NoRaiseException(default_return_value='')
+def image(name, image_path):
+ """Uploads image to Google Storage.
jbudorick 2017/02/21 18:32:40 This should not be in logdog_helper if it's not up
mikecase (-- gone --) 2017/02/23 00:21:26 done. Moved to its own module.
+
+ Args:
+ name: Name of the image on Google Storage.
+ image_path: Path to image you want to upload.
+ """
+ # TODO(mikecase): Merge this with binary() function. Currently, logdog has no
+ # support for viewing images in its log viewer. As a work-around, upload to
+ # google storage directly.
+
+ RENDER_TEST_BASE_URL = 'https://storage.googleapis.com/chromium-render-tests/'
+ RENDER_TEST_BUCKET = 'gs://chromium-render-tests/'
+
+ cmd_helper.RunCmd(
+ [os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gsutil.py'), 'cp',
+ image_path,
+ os.path.join(RENDER_TEST_BUCKET, name)])
jbudorick 2017/02/21 18:32:40 super nit: why is this not on the same line as ima
mikecase (-- gone --) 2017/02/23 00:21:26 it is now!
+
+ return os.path.join(RENDER_TEST_BASE_URL, name)
+
+
+def unique_name(basename, timestamp=True, device=None):
+ """Helper function for creating a unique name for a logdog stream.
+
+ Args:
+ basename: Base of the unique name.
+ timestamp: Whether or not to add a timestamp to name.
+ device: Device to add device serial of to name.
+ """
+ return '%s%s%s' % (
+ basename,
+ '_%s' % time.strftime('%Y%m%dT%H%M%S', time.localtime())
+ if timestamp else '',
+ '_%s' % device.serial if device else '')
+
+
@decorators.Memoize
def get_logdog_client():
logging.debug('Getting logdog client.')

Powered by Google App Engine
This is Rietveld 408576698