Testing: Fix no html report error (MB#8391)

Do not write 'parameter' property, as the value sometimes fails the XML parser.
Generate a default HTML report if the report failed to generate.
This commit is contained in:
Chen Congwu 2009-12-03 18:22:08 +08:00 committed by Patrick Ohly
parent aec2f1fadc
commit 837c0429c8
2 changed files with 8 additions and 5 deletions

View File

@ -220,7 +220,7 @@ def step2(resultdir, result, servers, indents, srcdir, shellprefix, backenddir):
#valgrind check resutls
if(params[server].find('return code ') !=-1):
result.write('result="'+params[server].partition('return code ')[2].partition(')')[0]+'" ')
result.write('parameter="'+params[server]+'">\n')
result.write('>\n')
logs = glob.glob(resultdir+'/'+rserver+'/*.log')
logdic ={}
logprefix ={}

View File

@ -267,13 +267,16 @@ class Context:
# report result by email
if self.recipients:
server = smtplib.SMTP(self.mailhost)
resulthtml = open (self.resultdir + "/nightly.html")
line=resulthtml.readline()
msg=''
while(line!=''):
try:
resulthtml = open (self.resultdir + "/nightly.html")
line=resulthtml.readline()
while(line!=''):
msg=msg+line
line=resulthtml.readline()
resulthtml.close()
resulthtml.close()
except IOError:
msg = '''<html><body><h1>Error: No HTML report generated!</h1></body></html>\n'''
body = StringIO.StringIO()
writer = MimeWriter.MimeWriter (body)
writer.addheader("From", self.sender)