drop yaml dependency in parse_test_results.py and don't require it to be run from a repository

This commit is contained in:
Arvid Norberg 2013-07-02 05:24:10 +00:00
parent 97737e951f
commit 9df271968e
1 changed files with 64 additions and 89 deletions

View File

@ -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,63 +171,39 @@ 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('.'):
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
for f in glob.glob(os.path.join(rev_dir, '*.json')):
mtime = modification_time(f)
if mtime > index_mtime:
need_refresh = True
break
if not need_refresh:
print 'all up to date'
sys.exit(0)
'''
html_file = '%s.html' % branch_name
html = open(html_file, 'w+')