diff --git a/tools/parse_test_results.py b/tools/parse_test_results.py index e2713b849..3f44e33bf 100755 --- a/tools/parse_test_results.py +++ b/tools/parse_test_results.py @@ -70,6 +70,36 @@ def modification_time(file): except: pass return mtime +def save_log_file(log_name, project_name, branch_name, test_name, timestamp, data): + + if not os.path.exists(os.path.split(log_name)[0]): + os.mkdir(os.path.split(log_name)[0]) + + try: + # if the log file already exists, and it's newer than + # the source, no need to re-parse it + mtime = os.stat(log_name).st_mtime + if mtime >= timestamp: return + except: pass + + html = open(log_name, 'w+') + print >>html, '''%s - %s +

%s - %s

''' % (project_name, branch_name, project_name, branch_name) + print >>html, '

%s

%s
' % \ + (test_name.encode('utf-8'), style_output(data).encode('utf-8')) + + print >>html, '' + html.close() + sys.stdout.write('.') + sys.stdout.flush() + def parse_tests(rev_dir): # this contains mappings from platforms to @@ -105,6 +135,7 @@ def parse_tests(rev_dir): platform_toolset = os.path.split(f)[1].split('.json')[0].split('#') try: j = json.loads(open(f, 'rb').read()) + timestamp = os.stat(f).st_mtime except: print 'FAILED TO LOAD "%s"' %f continue @@ -131,11 +162,14 @@ def parse_tests(rev_dir): platforms[platform][toolset][features] = {} platforms[platform][toolset][features][test_name] = j[cfg] + platforms[platform][toolset][features][test_name]['timestamp'] = timestamp return (platforms, tests) # 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 = '' try: @@ -209,9 +243,6 @@ print >>html, '''regression tests, %s -

%s - %s

''' % (project_name, branch_name, project_name, branch_name) - print >>html, '

%s - %s

%s
' % \ - (d['name'].encode('utf8'), d['features'].encode('utf-8'), style_output(d['output']).encode('utf-8')) - details_id += 1 - - print >>html, '' - html.close() - sys.stdout.write('.') - sys.stdout.flush() - print ''