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:
parent
aec2f1fadc
commit
837c0429c8
|
@ -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 ={}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue