diff --git a/tools/parse_test_results.py b/tools/parse_test_results.py index 768c27c70..f60c55ec8 100755 --- a/tools/parse_test_results.py +++ b/tools/parse_test_results.py @@ -39,17 +39,17 @@ import json # TODO: different parsers could be run on output from different actions # if we would use the xml output in stead of stdout/stderr -def style_output(o): - ret = '' +def style_output(logfile, outfile): subtle = False - for l in o.split('\n'): + for l in logfile.split('\n'): + l = l.encode('utf-8') l = l.replace('<', '<') l = l.replace('>', '>') if 'TEST_CHECK' in l or 'TEST_EQUAL_ERROR' in l or l.startswith('EXIT STATUS: ') or \ ' second time limit exceeded' in l or l.startswith('signal: SIG'): - ret += '%s\n' % l + print >>outfile, '%s' % l elif '**passed**' in l: - ret += '%s\n' % l + print >>outfile, '%s' % l elif ': error: ' in l or ': fatal error: ' in l or ' : fatal error ' in l or \ 'failed to write output file' in l or ') : error C' in l or \ ' : error LNK' in l or ': undefined reference to ' in l or \ @@ -58,18 +58,17 @@ def style_output(o): 'Invalid write of size' in l or \ 'Use of uninitialised value of size' in l or \ 'Uninitialised byte(s) found during' in l: - ret += '%s\n' % l + print >>outfile, '%s' % l elif ': warning: ' in l or ') : warning C' in l or \ 'Uninitialised value was created by a' in l or \ 'bytes after a block of size' in l: - ret += '%s\n' % l.strip() + print >>outfile, '%s' % l.strip() elif l == '====== END OUTPUT ======' and not subtle: - ret += '%s\n' % l + print >>outfile, '%s' % l subtle = True else: - ret += '%s\n' % l - if subtle: ret += '' - return ret + print >>outfile, '%s' % l + if subtle: print >>outfile, '' def modification_time(file): mtime = 0 @@ -100,10 +99,10 @@ def save_log_file(log_name, project_name, branch_name, test_name, timestamp, dat pre { color: #999; white-space: pre-wrap; word-wrap: break-word; }

%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, '

%s

' % test_name.encode('utf-8')
+	style_output(data, html)
 
-	print >>html, ''
+	print >>html, '
' html.close() sys.stdout.write('.') sys.stdout.flush()