#!/usr/bin/python """ This script asks cdash to give it a summary of all of the failing tests on the Nightly (master) and Nightly (next) section. It presents the tests ranked by the number of failing machines. From this view you can more easily see what is in the greatest need of fixing. The script also scrapes the dashboard with a list of expected submissions and generates a list of missing ones. """ import argparse import datetime import sys import time import urllib #----------------------------------------------------------------------------- def PrintReport(dashDate, branch): if csvOutput: print "" print "-"*10, "Dashboard status for", branch, "-"*10 elif wikiOutput: print "===Dashboard status for " + branch + "===" elif htmlOutput: print '
Dashboard status for', branch, '
'
branch = branch.replace(" ", "%20")
url =\
'http://open.cdash.org/api/?method=build&task=sitetestfailures&project=ParaView&group='\
+ branch
page = urllib.urlopen(url)
data = page.readlines()
if len(data[0]) == 2: #"[]"
print "Cdash returned nothing useful as of this report."
return
# raise SystemExit
submissions = eval(data[0])
tfails = dict()
if csvOutput or htmlOutput:
print "-"*20, "ANALYZING", "-"*20
elif wikiOutput:
print "====Builds for " + dashDate + "===="
print r'{| class="wikitable sortable" border="1" cellpadding="5" cellspacing="0"'
print r'|-'
print r'| Build Name'
print r'| Failing'
if htmlOutput:
print '
'
for skey in submissions.keys():
submission = submissions[skey]
bname = submission['buildname']
bfails = submission['tests']
if len(bfails) > 100:
continue
if csvOutput:
print bname
print len(bfails)
elif wikiOutput:
print r'|-'
print r'| ',
print r'[http://open.cdash.org/index.php?project=ParaView' + '&date=' + dashDate + r'&filtercount=1' + r'&field1=buildname/string&compare1=61&value1=' + bname + " " + bname + "]"
print r'|'
print len(bfails)
elif htmlOutput:
print '' + bname +\
''
print len(bfails), '
'
for tnum in range(0, len(bfails)):
test = bfails[tnum]
tname = test['name']
if not tname in tfails:
tfails[tname] = list()
tfails[tname].append(bname)
if wikiOutput:
print r'|}'
elif htmlOutput:
print '
'
if csvOutput:
print "-"*20, "REPORT", "-"*20
print len(tfails)," FAILURES"
elif wikiOutput:
print "====Tests for " + dashDate + "===="
print r'{| class="wikitable sortable" border="1" cellpadding="5" cellspacing="0"'
print r'|-'
print r'| Test'
print r'| Failing'
print r'| Platforms'
if htmlOutput:
print "-"*20, "REPORT", "-"*20,"
"
print len(tfails)," FAILURES
"
failcounts = map(lambda x: (x,len(tfails[x])), tfails.keys())
sortedfails = sorted(failcounts, key=lambda fail: fail[1])
for test in sortedfails:
tname = test[0]
if csvOutput:
print tname, ",", len(tfails[tname]), ",", tfails[tname]
elif wikiOutput:
print r'|-'
print r'| '
print r'[http://open.cdash.org/testSummary.php?' + r'project=9' + r'&date=' + dashDate + r'&name=' + tname + ' ' + tname + ']'
print r'|',
print len(tfails[tname])
print r'|',
print tfails[tname]
elif htmlOutput:
print '' + tname + '', ',',\
len(tfails[tname]), ',', tfails[tname], '
'
if wikiOutput:
print r'|}'
elif htmlOutput:
print '
Issues with submitters
" # print "| " + submitter + " | " # print "" + build + " | " # print "" + branch.replace("%20", " ") + " |
Dashboard for ' + dashDay + ',', dashMon, dashDt, dashYear, '
' PrintReport(dashDate, "Nightly (master)") PrintReport(dashDate, "Nightly (next)") PrintSubmitterIssues(dashDate.replace("-","")) if htmlOutput: print '' print '' #----------------------------------------------------------------------------- if __name__ == "__main__": parser = argparse.ArgumentParser(description="Analyze last night\'s"\ " dashboard results") parser.add_argument("--wiki", action="store_true", default=False, help="Wiki output") parser.add_argument("--html", action="store_true", default=False, help="HTML output") args = parser.parse_args() csvOutput = wikiOutput = htmlOutput = False if args.wiki: wikiOutput = True elif args.html: htmlOutput = True else: csvOutput = True analyze() # vim: shiftwidth=2 softtabstop=2 expandtab