drop yaml dependency in parse_test_results.py and don't require it to be run from a repository
This commit is contained in:
parent
97737e951f
commit
9df271968e
|
@ -36,7 +36,6 @@ import os
|
|||
import sys
|
||||
import glob
|
||||
import json
|
||||
import yaml
|
||||
|
||||
# TODO: different parsers could be run on output from different actions
|
||||
# if we would use the xml output in stead of stdout/stderr
|
||||
|
@ -172,67 +171,43 @@ def parse_tests(rev_dir):
|
|||
# TODO: remove this dependency by encoding it in the output files
|
||||
# this script should work from outside of the repo, just having
|
||||
# access to the shared folder
|
||||
project_name = ''
|
||||
project_name = 'libtorrent'
|
||||
|
||||
try:
|
||||
cfg = open('.regression.yml', 'r')
|
||||
except:
|
||||
print '.regression.yml not found in current directory'
|
||||
sys.exit(1)
|
||||
cfg = yaml.load(cfg.read())
|
||||
|
||||
if 'project' in cfg:
|
||||
project_name = cfg['project']
|
||||
|
||||
branch_name = 'trunk'
|
||||
if 'branch' in cfg:
|
||||
branch_name = cfg['branch'].strip()
|
||||
|
||||
print 'branch: %s' % branch_name
|
||||
# maps branch name to latest rev
|
||||
revs = {}
|
||||
|
||||
os.chdir('regression_tests')
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
latest_rev = int(sys.argv[1])
|
||||
else:
|
||||
latest_rev = 0
|
||||
|
||||
for rev in os.listdir('.'):
|
||||
for rev in os.listdir('.'):
|
||||
try:
|
||||
if not rev.startswith('%s-' % branch_name): continue
|
||||
r = int(rev[len(branch_name)+1:])
|
||||
if r > latest_rev: latest_rev = r
|
||||
except: pass
|
||||
branch = rev.split('-')[0]
|
||||
if branch == 'logs': continue
|
||||
r = int(rev.split('-')[1])
|
||||
if not branch in revs:
|
||||
revs[branch] = r
|
||||
else:
|
||||
if r > revs[branch]:
|
||||
revs[branch] = r
|
||||
except:
|
||||
print 'ignoring %s' % rev
|
||||
|
||||
if latest_rev == 0:
|
||||
if revs == {}:
|
||||
print 'no test files found'
|
||||
sys.exit(1)
|
||||
|
||||
print 'latest version: %d' % latest_rev
|
||||
print 'latest versions'
|
||||
for b in revs:
|
||||
print '%s\t%d' % (b, revs[b])
|
||||
|
||||
html_file = 'index.html'
|
||||
for branch_name in revs:
|
||||
|
||||
'''
|
||||
html_file = '%s.html' % rev_dir
|
||||
index_mtime = modification_time(html_file)
|
||||
latest_rev = revs[branch_name]
|
||||
|
||||
need_refresh = False
|
||||
html_file = '%s.html' % branch_name
|
||||
|
||||
for f in glob.glob(os.path.join(rev_dir, '*.json')):
|
||||
mtime = modification_time(f)
|
||||
html = open(html_file, 'w+')
|
||||
|
||||
if mtime > index_mtime:
|
||||
need_refresh = True
|
||||
break
|
||||
|
||||
if not need_refresh:
|
||||
print 'all up to date'
|
||||
sys.exit(0)
|
||||
'''
|
||||
|
||||
html = open(html_file, 'w+')
|
||||
|
||||
print >>html, '''<html><head><title>regression tests, %s</title><style type="text/css">
|
||||
print >>html, '''<html><head><title>regression tests, %s</title><style type="text/css">
|
||||
.passed { display: block; width: 8px; height: 1em; background-color: #6f8 }
|
||||
.failed { display: block; width: 8px; height: 1em; background-color: #f68 }
|
||||
table { border: 0; border-collapse: collapse; }
|
||||
|
@ -243,9 +218,9 @@ print >>html, '''<html><head><title>regression tests, %s</title><style type="tex
|
|||
</style>
|
||||
</head><body><h1>%s - %s</h1>''' % (project_name, project_name, branch_name)
|
||||
|
||||
print >>html, '<table border="1">'
|
||||
print >>html, '<table border="1">'
|
||||
|
||||
for r in range(latest_rev, latest_rev - 20, -1):
|
||||
for r in range(latest_rev, latest_rev - 20, -1):
|
||||
sys.stdout.write('.')
|
||||
sys.stdout.flush()
|
||||
|
||||
|
@ -276,8 +251,8 @@ for r in range(latest_rev, latest_rev - 20, -1):
|
|||
print >>html, '</tr>'
|
||||
idx += 1
|
||||
|
||||
print >>html, '</table></body></html>'
|
||||
html.close()
|
||||
print >>html, '</table></body></html>'
|
||||
html.close()
|
||||
|
||||
print ''
|
||||
print ''
|
||||
|
||||
|
|
Loading…
Reference in New Issue