11 from __future__
import print_function
14 from ReporterMTTStage
import *
31 ReporterMTTStage.__init__(self)
33 self.
options[
'filename'] = (
None,
"Name of the file into which the report is to be written")
34 self.
options[
'summary_footer'] = (
None,
"Footer to be placed at bottom of summary")
35 self.
options[
'detail_header'] = (
None,
"Header to be put at top of detail report")
36 self.
options[
'detail_footer'] = (
None,
"Footer to be placed at bottome of detail report")
37 self.
options[
'textwrap'] = (
"80",
"Max line length before wrapping")
42 IPlugin.activate(self)
47 IPlugin.deactivate(self)
54 lines = testDef.printOptions(self.
options)
61 print(
"\t"*tabs,
"ERROR ({name})".format(name=name), file=self.
fh)
63 print(
"\t"*(tabs),
" ",l, file=self.
fh)
66 testDef.logger.verbose_print(
"TextFile Reporter")
69 testDef.parseOptions(log, self.
options, keyvals, cmds)
70 if cmds[
'filename']
is not None:
71 self.
fh = open(cmds[
'filename']
if os.path.isabs(cmds[
'filename']) \
72 else os.path.join(cmds[
'scratch'],cmds[
'filename']),
'w')
73 if testDef.options[
'description']
is not None:
74 print(testDef.options[
'description'], file=self.
fh)
77 fullLog = testDef.logger.getLog(
None)
80 print(
"Section:",lg[
'section'],
"Status:",lg[
'status'], file=self.
fh)
82 if lg[
'parameters']
is not None:
83 print(
"\tInput parameters:", file=self.
fh)
84 for p
in lg[
'parameters']:
85 print(
"\t\t",p[0],
"=",p[1], file=self.
fh)
89 if lg[
'options']
is not None:
90 print(
"\tFinal options:", file=self.
fh)
92 keys = list(opts.keys())
94 print(
"\t\t",p,
"=",opts[p], file=self.
fh)
105 if lg[
'compiler']
is not None:
106 print(
"Compiler:", file=self.
fh)
107 comp = lg[
'compiler']
108 print(
"\t",comp[
'family'], file=self.
fh)
109 print(
"\t",comp[
'version'], file=self.
fh)
113 if lg[
'profile']
is not None:
115 keys = list(prf.keys())
124 print(
"\tProfile:", file=self.
fh)
127 line = key + (max1-len(key))*sp +
'\n'.join(prf[key])
128 print(
"\t\t",line, file=self.
fh)
132 if lg[
'numTests']
is not None:
133 print(
"\tTests:",lg[
'numTests'],
"Pass:",lg[
'numPass'],
"Skip:",lg[
'numSkip'],
"Fail:",lg[
'numFail'], file=self.
fh)
137 if lg[
'testresults']
is not None:
138 for test
in lg[
'testresults']:
139 tname = os.path.basename(test[
'test'])
140 print(
"\t\t",tname,
" Status:",test[
'status'], file=self.
fh)
141 if 0 != test[
'status']:
143 self._print_error_block(
"stderr", test[
'stderr'], tabs=3)
145 self._print_error_block(
"stdout", test[
'stdout'], tabs=3)
149 if cmds[
'filename']
is not None: