Skip to content
Browse files

Merge pull request #33985 from m-kuhn/cdash_new_parse_dash_results

Update cdash parse_dash_results to new API
  • Loading branch information
m-kuhn committed Feb 1, 2020
2 parents 7d6f86c + 735d66c commit f98fc05fa1fb8f125d5f4bd292d043a5013a66b3
Showing with 23 additions and 12 deletions.
  1. +23 −12 scripts/
@@ -33,7 +33,7 @@
import urllib.parse
import urllib.error
import re
from bs4 import BeautifulSoup
import json
from PyQt5.QtGui import (
QImage, QColor, qRed, qBlue, qGreen, qAlpha, qRgb, QPixmap)
from PyQt5.QtWidgets import (QDialog,
@@ -147,19 +147,20 @@ def closeEvent(self, event):

def parse_url(self, url):
print('Fetching dash results from: {}'.format(url))
page = urllib.request.urlopen(url)
soup = BeautifulSoup(page, "lxml")
parts = urllib.parse.urlsplit(url)
apiurl = urllib.parse.urlunsplit((parts.scheme, parts.netloc, '/api/v1/testDetails.php', parts.query, parts.fragment))
print('Fetching dash results from api: {}'.format(apiurl))
page = urllib.request.urlopen(apiurl)
content = json.loads('utf-8'))

# build up list of rendered images
measurement_img = [img for img in soup.find_all('img') if
img.get('alt') and img.get('alt').startswith('Rendered Image')]
measurement_img = [img for img in content['test']['images'] if img['role'].startswith('Rendered Image')]

images = {}
for img in measurement_img:
m ='Rendered Image (.*?)(\s|$)', img.get('alt'))
m ='Rendered Image (.*?)(\s|$)', img['role'])
test_name =
rendered_image = img.get('src')
rendered_image = 'displayImage.php?imgid={}'.format(img['imgid'])
images[test_name] = '{}/{}'.format(dash_url, rendered_image)

if images:
@@ -365,11 +366,21 @@ def create_diff_image(self, control_image, rendered_image, mask_image):
def main():
app = QApplication(sys.argv)

parser = argparse.ArgumentParser()
args = parser.parse_args()
parser = argparse.ArgumentParser(
description='''A tool to automatically update test image masks based on results submitted to cdash.
w = ResultHandler()
It will take local control images from the QGIS source and rendered images from test results
on cdash to create a mask.
When using it, carefully check, that the rendered images from the test results are acceptable and
that the new masks will only mask regions on the image that indeed allow for variation.
If the resulting mask is too tolerant, consider adding a new control image next to the existing one.
parser.add_argument('dash_url', help='URL to a dash result with images. E.g.'))


0 comments on commit f98fc05

Please sign in to comment.
You can’t perform that action at this time.