from vpp_sub_interface import VppSubInterface
from vpp_lo_interface import VppLoInterface
from vpp_papi_provider import VppPapiProvider
+from vpp_papi.vpp_stats import VPPStats
from log import RED, GREEN, YELLOW, double_line_delim, single_line_delim, \
getLogger, colorize
from vpp_object import VppObjectRegistry
coredump_size, "}", "api-trace", "{", "on", "}",
"api-segment", "{", "prefix", cls.shm_prefix, "}",
"cpu", "{", "main-core", str(cpu_core_number), "}",
+ "stats", "{", "socket-name",
+ cls.tempdir + "/stats.sock", "}",
"plugins", "{", "plugin", "dpdk_plugin.so", "{",
"disable", "}", "plugin", "unittest_plugin.so",
"{", "enable", "}", "}", ]
hook = PollHook(cls)
cls.vapi.register_hook(hook)
cls.sleep(0.1, "after vpp startup, before initial poll")
+ cls.statistics = VPPStats(socketname=cls.tempdir+'/stats.sock')
try:
hook.poll_vpp()
except VppDiedError:
self.logger.debug(self.vapi.cli("show trace"))
self.logger.info(self.vapi.ppcli("show interface"))
self.logger.info(self.vapi.ppcli("show hardware"))
- self.logger.info(self.vapi.ppcli("show error"))
+ self.logger.info(self.statistics.set_errors_str())
self.logger.info(self.vapi.ppcli("show run"))
self.logger.info(self.vapi.ppcli("show log"))
self.registry.remove_vpp_config(self.logger)
self.verbosity = verbosity
self.result_string = None
self.printer = TestCasePrinter()
- self.passed = 0
+ self.passed = []
def addSuccess(self, test):
"""
% (test.__class__.__name__,
test._testMethodName,
test._testMethodDoc))
- self.passed += 1
+ self.passed.append(test.id())
unittest.TestResult.addSuccess(self, test)
self.result_string = colorize("OK", GREEN)
if logger:
logger.error(e)
+ def send_results_through_pipe(self):
+ if hasattr(self, 'test_framework_results_pipe'):
+ pipe = self.test_framework_results_pipe
+ if pipe:
+ pipe.send(self)
+
def addFailure(self, test, err):
"""
Record a test failed result
def stopTest(self, test):
"""
- Stop a test
+ Called when the given test has been run
:param test:
else:
self.stream.writeln("%-73s%s" % (self.getDescription(test),
self.result_string))
+ self.send_results_through_pipe()
def printErrors(self):
"""
return VppTestResult
def __init__(self, keep_alive_pipe=None, descriptions=True, verbosity=1,
- failfast=False, buffer=False, resultclass=None):
+ results_pipe=None, failfast=False, buffer=False,
+ resultclass=None):
# ignore stream setting here, use hard-coded stdout to be in sync
# with prints from VppTestCase methods ...
super(VppTestRunner, self).__init__(sys.stdout, descriptions,
reporter = KeepAliveReporter()
reporter.pipe = keep_alive_pipe
+ VppTestResult.test_framework_results_pipe = results_pipe
+
def run(self, test):
"""
Run the tests