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>
This commit is contained in:

committed by
David S. Miller

parent
dfe465d33e
commit
915c158dea
@@ -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
|
||||
|
Reference in New Issue
Block a user