.. | .. |
---|
11 | 11 | import subprocess |
---|
12 | 12 | import time |
---|
13 | 13 | from TdcPlugin import TdcPlugin |
---|
| 14 | +from TdcResults import * |
---|
14 | 15 | |
---|
15 | 16 | from tdc_config import * |
---|
16 | 17 | |
---|
.. | .. |
---|
21 | 22 | def __init__(self): |
---|
22 | 23 | self.sub_class = 'valgrind/SubPlugin' |
---|
23 | 24 | self.tap = '' |
---|
| 25 | + self._tsr = TestSuiteReport() |
---|
24 | 26 | super().__init__() |
---|
25 | 27 | |
---|
26 | 28 | def pre_suite(self, testcount, testidlist): |
---|
.. | .. |
---|
34 | 36 | def post_suite(self, index): |
---|
35 | 37 | '''run commands after test_runner goes into a test loop''' |
---|
36 | 38 | super().post_suite(index) |
---|
37 | | - self._add_to_tap('\n|---\n') |
---|
38 | 39 | if self.args.verbose > 1: |
---|
39 | 40 | print('{}.post_suite'.format(self.sub_class)) |
---|
40 | | - print('{}'.format(self.tap)) |
---|
| 41 | + #print('{}'.format(self.tap)) |
---|
| 42 | + for xx in range(index - 1, self.testcount): |
---|
| 43 | + res = TestResult('{}-mem'.format(self.testidlist[xx]), 'Test skipped') |
---|
| 44 | + res.set_result(ResultState.skip) |
---|
| 45 | + res.set_errormsg('Skipped because of prior setup/teardown failure') |
---|
| 46 | + self._add_results(res) |
---|
41 | 47 | if self.args.verbose < 4: |
---|
42 | 48 | subprocess.check_output('rm -f vgnd-*.log', shell=True) |
---|
43 | 49 | |
---|
.. | .. |
---|
96 | 102 | if not self.args.valgrind: |
---|
97 | 103 | return |
---|
98 | 104 | |
---|
| 105 | + res = TestResult('{}-mem'.format(self.args.testid), |
---|
| 106 | + '{} memory leak check'.format(self.args.test_name)) |
---|
| 107 | + if self.args.test_skip: |
---|
| 108 | + res.set_result(ResultState.skip) |
---|
| 109 | + res.set_errormsg('Test case designated as skipped.') |
---|
| 110 | + self._add_results(res) |
---|
| 111 | + return |
---|
| 112 | + |
---|
99 | 113 | self.definitely_lost_re = re.compile( |
---|
100 | 114 | r'definitely lost:\s+([,0-9]+)\s+bytes in\s+([,0-9]+)\sblocks', re.MULTILINE | re.DOTALL) |
---|
101 | 115 | self.indirectly_lost_re = re.compile( |
---|
.. | .. |
---|
130 | 144 | mem_results = '' |
---|
131 | 145 | if (def_num > 0) or (ind_num > 0) or (pos_num > 0) or (nle_num > 0): |
---|
132 | 146 | mem_results += 'not ' |
---|
| 147 | + res.set_result(ResultState.fail) |
---|
| 148 | + res.set_failmsg('Memory leak detected') |
---|
| 149 | + res.append_failmsg(content) |
---|
| 150 | + else: |
---|
| 151 | + res.set_result(ResultState.success) |
---|
133 | 152 | |
---|
134 | | - mem_results += 'ok {} - {}-mem # {}\n'.format( |
---|
135 | | - self.args.test_ordinal, self.args.testid, 'memory leak check') |
---|
136 | | - self._add_to_tap(mem_results) |
---|
137 | | - if mem_results.startswith('not '): |
---|
138 | | - print('{}'.format(content)) |
---|
139 | | - self._add_to_tap(content) |
---|
| 153 | + self._add_results(res) |
---|
| 154 | + |
---|
| 155 | + |
---|
| 156 | + def _add_results(self, res): |
---|
| 157 | + self._tsr.add_resultdata(res) |
---|
140 | 158 | |
---|
141 | 159 | def _add_to_tap(self, more_tap_output): |
---|
142 | 160 | self.tap += more_tap_output |
---|