diff options
author | Lucas Bates <lucasb@mojatatu.com> | 2018-12-06 17:42:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-07 19:39:03 -0500 |
commit | 915c158deaf97be49e71250f43e1539542217962 (patch) | |
tree | ae8445c156a1fabe1a2d06823cb4394d100aefd3 /tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py | |
parent | dfe465d33e7fce145746d836ddb31f0e27f28e28 (diff) |
tc-testing: Implement the TdcResults module in tdc
In tdc and the valgrind plugin, begin using the TdcResults module
to track executed test cases.
Signed-off-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py')
-rw-r--r-- | tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py index 477a7bd7d7fb..e00c798de0bb 100644 --- a/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py +++ b/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py | |||
@@ -11,6 +11,7 @@ from string import Template | |||
11 | import subprocess | 11 | import subprocess |
12 | import time | 12 | import time |
13 | from TdcPlugin import TdcPlugin | 13 | from TdcPlugin import TdcPlugin |
14 | from TdcResults import * | ||
14 | 15 | ||
15 | from tdc_config import * | 16 | from tdc_config import * |
16 | 17 | ||
@@ -21,6 +22,7 @@ class SubPlugin(TdcPlugin): | |||
21 | def __init__(self): | 22 | def __init__(self): |
22 | self.sub_class = 'valgrind/SubPlugin' | 23 | self.sub_class = 'valgrind/SubPlugin' |
23 | self.tap = '' | 24 | self.tap = '' |
25 | self._tsr = TestSuiteReport() | ||
24 | super().__init__() | 26 | super().__init__() |
25 | 27 | ||
26 | def pre_suite(self, testcount, testidlist): | 28 | def pre_suite(self, testcount, testidlist): |
@@ -34,10 +36,14 @@ class SubPlugin(TdcPlugin): | |||
34 | def post_suite(self, index): | 36 | def post_suite(self, index): |
35 | '''run commands after test_runner goes into a test loop''' | 37 | '''run commands after test_runner goes into a test loop''' |
36 | super().post_suite(index) | 38 | super().post_suite(index) |
37 | self._add_to_tap('\n|---\n') | ||
38 | if self.args.verbose > 1: | 39 | if self.args.verbose > 1: |
39 | print('{}.post_suite'.format(self.sub_class)) | 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 | if self.args.verbose < 4: | 47 | if self.args.verbose < 4: |
42 | subprocess.check_output('rm -f vgnd-*.log', shell=True) | 48 | subprocess.check_output('rm -f vgnd-*.log', shell=True) |
43 | 49 | ||
@@ -128,8 +134,17 @@ class SubPlugin(TdcPlugin): | |||
128 | nle_num = int(nle_mo.group(1)) | 134 | nle_num = int(nle_mo.group(1)) |
129 | 135 | ||
130 | mem_results = '' | 136 | mem_results = '' |
137 | res = TestResult('{}-mem'.format(self.args.testid), | ||
138 | '{} memory leak check'.format(self.args.test_name)) | ||
131 | if (def_num > 0) or (ind_num > 0) or (pos_num > 0) or (nle_num > 0): | 139 | if (def_num > 0) or (ind_num > 0) or (pos_num > 0) or (nle_num > 0): |
132 | mem_results += 'not ' | 140 | mem_results += 'not ' |
141 | res.set_result(ResultState.fail) | ||
142 | res.set_failmsg('Memory leak detected') | ||
143 | res.append_failmsg(content) | ||
144 | else: | ||
145 | res.set_result(ResultState.success) | ||
146 | |||
147 | self._add_results(res) | ||
133 | 148 | ||
134 | mem_results += 'ok {} - {}-mem # {}\n'.format( | 149 | mem_results += 'ok {} - {}-mem # {}\n'.format( |
135 | self.args.test_ordinal, self.args.testid, 'memory leak check') | 150 | self.args.test_ordinal, self.args.testid, 'memory leak check') |
@@ -138,5 +153,8 @@ class SubPlugin(TdcPlugin): | |||
138 | print('{}'.format(content)) | 153 | print('{}'.format(content)) |
139 | self._add_to_tap(content) | 154 | self._add_to_tap(content) |
140 | 155 | ||
156 | def _add_results(self, res): | ||
157 | self._tsr.add_resultdata(res) | ||
158 | |||
141 | def _add_to_tap(self, more_tap_output): | 159 | def _add_to_tap(self, more_tap_output): |
142 | self.tap += more_tap_output | 160 | self.tap += more_tap_output |