summaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-03-15 09:39:19 -0700
committerOle Trøan <otroan@employees.org>2019-06-07 09:48:05 +0000
commit499ea648e2884ca81fa139805f6dbff3643fab8d (patch)
tree518d87e36eddc633afec215f2e45628ad47befe7 /test/framework.py
parent2af6e92b78944879fbb41fd4538be15b97402f88 (diff)
tests: framework gracefully handle 'VppTransportShmemIOError'
Catches: ---- Traceback (most recent call last): File "/vpp/test/framework.py", line 593, in tearDown self.logger.info(self.vapi.ppcli("api trace save %s" % api_trace)) File "/vpp/test/vpp_papi_provider.py", line 413, in ppcli return cli + "\n" + str(self.cli(cli)) File "/vpp/test/vpp_papi_provider.py", line 402, in cli r = self.papi.cli_inband(cmd=cli) File "/vpp/src/vpp-api/python/vpp_papi/vpp_papi.py", line 100, in __call__ return self._func(**kwargs) File "/vpp/src/vpp-api/python/vpp_papi/vpp_papi.py", line 414, in f return self._call_vpp(i, msg, multipart, **kwargs) File "/vpp/src/vpp-api/python/vpp_papi/vpp_papi.py", line 634, in _call_vpp msg = self.transport.read() File "/vpp/src/vpp-api/python/vpp_papi/vpp_transport_shmem.py", line 120, in read raise VppTransportShmemIOError(rv, 'vac_read failed') VppTransportShmemIOError: [Errno -1] vac_read failed ---- Change-Id: I767e48c4d03081eb5df6a8aa67da7e192d25e4cc Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/framework.py b/test/framework.py
index efb1e6b04c4..fd91d4c9d5e 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -28,6 +28,7 @@ from vpp_lo_interface import VppLoInterface
from vpp_bvi_interface import VppBviInterface
from vpp_papi_provider import VppPapiProvider
from vpp_papi.vpp_stats import VPPStats
+from vpp_papi.vpp_transport_shmem import VppTransportShmemIOError
from log import RED, GREEN, YELLOW, double_line_delim, single_line_delim, \
get_logger, colorize
from vpp_object import VppObjectRegistry
@@ -616,18 +617,18 @@ class VppTestCase(unittest.TestCase):
self.logger.debug("--- tearDown() for %s.%s(%s) called ---" %
(self.__class__.__name__, self._testMethodName,
self._testMethodDoc))
- if not self.vpp_dead:
- self.logger.info(
- "--- Logging show commands common to all testcases. ---")
- self.logger.debug(self.vapi.cli("show trace max 1000"))
- self.logger.info(self.vapi.ppcli("show interface"))
- self.logger.info(self.vapi.ppcli("show hardware"))
- 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.logger.info("Logging testcase specific show commands.")
- self.show_commands_at_teardown()
- self.registry.remove_vpp_config(self.logger)
+
+ try:
+ if not self.vpp_dead:
+ self.logger.debug(self.vapi.cli("show trace max 1000"))
+ self.logger.info(self.vapi.ppcli("show interface"))
+ self.logger.info(self.vapi.ppcli("show hardware"))
+ 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.logger.info("Logging testcase specific show commands.")
+ self.show_commands_at_teardown()
+ self.registry.remove_vpp_config(self.logger)
# Save/Dump VPP api trace log
api_trace = "vpp_api_trace.%s.log" % self._testMethodName
tmp_api_trace = "/tmp/%s" % api_trace
@@ -638,6 +639,10 @@ class VppTestCase(unittest.TestCase):
os.rename(tmp_api_trace, vpp_api_trace_log)
self.logger.info(self.vapi.ppcli("api trace custom-dump %s" %
vpp_api_trace_log))
+ except VppTransportShmemIOError:
+ self.logger.debug("VppTransportShmemIOError: Vpp dead. "
+ "Cannot log show commands.")
+ self.vpp_dead = True
else:
self.registry.unregister_all(self.logger)