Bug 1253219 - Add reftest screenshots to html report for easier debugging. r=jmaher
authorShing Lyu <shing.lyu@gmail.com>
Mon, 14 Mar 2016 05:16:00 +0100
changeset 288745 75422250c55f8eca6977cb69e4069081ccbba40b
parent 288744 cea8bcf0fc028e6e68f6e49b69beefc6ab84dff2
child 288746 c275dd17ab5b2f58a365770fd05177eea3ef6d23
push id30089
push userkwierso@gmail.com
push dateWed, 16 Mar 2016 00:26:08 +0000
treeherdermozilla-central@7773387a9a2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1253219
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1253219 - Add reftest screenshots to html report for easier debugging. r=jmaher
testing/mozbase/mozlog/mozlog/formatters/html/html.py
--- a/testing/mozbase/mozlog/mozlog/formatters/html/html.py
+++ b/testing/mozbase/mozlog/mozlog/formatters/html/html.py
@@ -105,24 +105,34 @@ class HTMLFormatter(base.BaseFormatter):
         if status != expected:
             status_name = "UNEXPECTED_" + status
         elif status not in ("PASS", "SKIP"):
             status_name = "EXPECTED_" + status
 
         self.test_count[status_name] += 1
 
         if status in ['SKIP', 'FAIL', 'ERROR']:
-            if debug.get('screenshot'):
-                screenshot = 'data:image/png;base64,%s' % debug['screenshot']
-                additional_html.append(html.div(
-                    html.a(html.img(src=screenshot), href="#"),
-                    class_='screenshot'))
+            for image_name in ['screenshot', 'image1', 'image2']:
+                if debug.get(image_name):
+                    screenshot = '%s' % debug[image_name]
+                    # screenshot from gaia unit test doesn't has the datatype
+                    # string
+                    if not screenshot.startswith('data:image/png;base64,'):
+                        screenshot = 'data:image/png;base64,' + screenshot
+
+                    additional_html.append(html.div(
+                        html.a(html.img(src=screenshot), href="#"),
+                        class_='screenshot'))
+
             for name, content in debug.items():
-                if 'screenshot' in name:
-                    href = '#'
+                if name in ['screenshot', 'image1', 'image2']:
+                    if not content.startswith('data:image/png;base64,'):
+                        href = 'data:image/png;base64,%s' % content
+                    else:
+                        href = content
                 else:
                     # use base64 to avoid that some browser (such as Firefox, Opera)
                     # treats '#' as the start of another link if the data URL contains.
                     # use 'charset=utf-8' to show special characters like Chinese.
                     href = 'data:text/plain;charset=utf-8;base64,%s' % base64.b64encode(str(content).encode('utf-8'))
                 links_html.append(html.a(
                     name.title(),
                     class_=name,