diff options
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  import subprocess  import time  from TdcPlugin import TdcPlugin +from TdcResults import *  from tdc_config import * @@ -21,6 +22,7 @@ class SubPlugin(TdcPlugin):      def __init__(self):          self.sub_class = 'valgrind/SubPlugin'          self.tap = '' +        self._tsr = TestSuiteReport()          super().__init__()      def pre_suite(self, testcount, testidlist): @@ -34,10 +36,14 @@ class SubPlugin(TdcPlugin):      def post_suite(self, index):          '''run commands after test_runner goes into a test loop'''          super().post_suite(index) -        self._add_to_tap('\n|---\n')          if self.args.verbose > 1:              print('{}.post_suite'.format(self.sub_class)) -        print('{}'.format(self.tap)) +        #print('{}'.format(self.tap)) +        for xx in range(index - 1, self.testcount): +            res = TestResult('{}-mem'.format(self.testidlist[xx]), 'Test skipped') +            res.set_result(ResultState.skip) +            res.set_errormsg('Skipped because of prior setup/teardown failure') +            self._add_results(res)          if self.args.verbose < 4:              subprocess.check_output('rm -f vgnd-*.log', shell=True) @@ -128,8 +134,17 @@ class SubPlugin(TdcPlugin):                  nle_num = int(nle_mo.group(1))          mem_results = '' +        res = TestResult('{}-mem'.format(self.args.testid), +              '{} memory leak check'.format(self.args.test_name))          if (def_num > 0) or (ind_num > 0) or (pos_num > 0) or (nle_num > 0):              mem_results += 'not ' +            res.set_result(ResultState.fail) +            res.set_failmsg('Memory leak detected') +            res.append_failmsg(content) +        else: +            res.set_result(ResultState.success) + +        self._add_results(res)          mem_results += 'ok {} - {}-mem # {}\n'.format(              self.args.test_ordinal, self.args.testid, 'memory leak check') @@ -138,5 +153,8 @@ class SubPlugin(TdcPlugin):              print('{}'.format(content))              self._add_to_tap(content) +    def _add_results(self, res): +        self._tsr.add_resultdata(res) +      def _add_to_tap(self, more_tap_output):          self.tap += more_tap_output  | 
