make test: handle exceptions from VppPapiProvider.__init__

Change-Id: I3c0372d5d09d554ad4ebe0adfa97c111571f628a
Signed-off-by: Klement Sekera <ksekera@cisco.com>
This commit is contained in:
Klement Sekera
2016-12-02 07:05:24 +01:00
committed by Damjan Marion
parent beb4bf7df8
commit 0529a743cc

View File

@ -186,12 +186,12 @@ class VppTestCase(unittest.TestCase):
try: try:
cls.run_vpp() cls.run_vpp()
cls.vpp_stdout_queue = Queue() cls.vpp_stdout_queue = Queue()
cls.vpp_stdout_reader_thread = Thread( cls.vpp_stdout_reader_thread = Thread(target=pump_output, args=(
target=pump_output, args=(cls.vpp.stdout, cls.vpp_stdout_queue)) cls.vpp.stdout, cls.vpp_stdout_queue))
cls.vpp_stdout_reader_thread.start() cls.vpp_stdout_reader_thread.start()
cls.vpp_stderr_queue = Queue() cls.vpp_stderr_queue = Queue()
cls.vpp_stderr_reader_thread = Thread( cls.vpp_stderr_reader_thread = Thread(target=pump_output, args=(
target=pump_output, args=(cls.vpp.stderr, cls.vpp_stderr_queue)) cls.vpp.stderr, cls.vpp_stderr_queue))
cls.vpp_stderr_reader_thread.start() cls.vpp_stderr_reader_thread.start()
cls.vapi = VppPapiProvider(cls.shm_prefix, cls.shm_prefix) cls.vapi = VppPapiProvider(cls.shm_prefix, cls.shm_prefix)
if cls.step: if cls.step:
@ -210,11 +210,12 @@ class VppTestCase(unittest.TestCase):
"to 'continue' VPP from within gdb?", RED)) "to 'continue' VPP from within gdb?", RED))
raise raise
except: except:
t, v, tb = sys.exc_info()
try: try:
cls.quit() cls.quit()
except: except:
pass pass
raise raise t, v, tb
@classmethod @classmethod
def quit(cls): def quit(cls):
@ -231,7 +232,8 @@ class VppTestCase(unittest.TestCase):
" and finish running the testcase...") " and finish running the testcase...")
if hasattr(cls, 'vpp'): if hasattr(cls, 'vpp'):
cls.vapi.disconnect() if hasattr(cls, 'vapi'):
cls.vapi.disconnect()
cls.vpp.poll() cls.vpp.poll()
if cls.vpp.returncode is None: if cls.vpp.returncode is None:
cls.vpp.terminate() cls.vpp.terminate()