Commit af9b5857 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Modified CTestXML2HTML to exit with an error if some tests failed

parent d49b8de9
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
import os import os
import sys
import json import json
import re import re
import shutil import shutil
...@@ -564,7 +565,7 @@ def main(): ...@@ -564,7 +565,7 @@ def main():
# Initialisation of the test organizer # Initialisation of the test organizer
organizer_all = TestOrganizer("index.html?test=all_results",os.path.join(output,"all_results")) organizer_all = TestOrganizer("index.html?test=all_results",os.path.join(output,"all_results"))
organizer_failed = TestOrganizer("index.html?test=results",os.path.join(output,"results")) organizer_failed = TestOrganizer("index.html?test=results",os.path.join(output,"results"))
failures_count = {'FAIL': 0, 'ERROR': 0}
# process each file # process each file
for fileName in inputs : for fileName in inputs :
...@@ -657,6 +658,8 @@ def main(): ...@@ -657,6 +658,8 @@ def main():
organizer_all.classify(Test) organizer_all.classify(Test)
if summary["outcome"] != "PASS": if summary["outcome"] != "PASS":
organizer_failed.classify(Test) organizer_failed.classify(Test)
if summary['outcome'] in failures_count:
failures_count[summary['outcome']] += 1
# Fill the summary fields # Fill the summary fields
for NamedMeasurement in Results.getiterator("NamedMeasurement") : for NamedMeasurement in Results.getiterator("NamedMeasurement") :
...@@ -743,7 +746,10 @@ def main(): ...@@ -743,7 +746,10 @@ def main():
organizer_all.write() organizer_all.write()
organizer_failed.write() organizer_failed.write()
if sum(failures_count.values()):
print 'Some tests failed:'
print '\n'.join(' %s: %s' % i for i in failures_count.items())
sys.exit(1)
#print " End of the program" #print " End of the program"
#progEndTime = datetime.now() #progEndTime = datetime.now()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment