If VPP process dies right at start, do a quick detection instead of being
stuck in the connect timeout (60s).
Change-Id: I41675181635fb81a6a7d93fbf652480a16bf78a0
Signed-off-by: Klement Sekera <ksekera@cisco.com>
cls.pg_streams = []
cls.packet_infos = {}
cls.verbose = 0
cls.pg_streams = []
cls.packet_infos = {}
cls.verbose = 0
print(double_line_delim)
print(colorize(getdoc(cls).splitlines()[0], YELLOW))
print(double_line_delim)
print(double_line_delim)
print(colorize(getdoc(cls).splitlines()[0], YELLOW))
print(double_line_delim)
# doesn't get called and we might end with a zombie vpp
try:
cls.run_vpp()
# doesn't get called and we might end with a zombie vpp
try:
cls.run_vpp()
+ cls.vpp_stdout_queue = Queue()
+ cls.vpp_stdout_reader_thread = Thread(
+ target=pump_output, args=(cls.vpp.stdout, cls.vpp_stdout_queue))
+ cls.vpp_stdout_reader_thread.start()
+ cls.vpp_stderr_queue = Queue()
+ cls.vpp_stderr_reader_thread = Thread(
+ target=pump_output, args=(cls.vpp.stderr, cls.vpp_stderr_queue))
+ cls.vpp_stderr_reader_thread.start()
cls.vapi = VppPapiProvider(cls.shm_prefix, cls.shm_prefix)
if cls.step:
cls.vapi = VppPapiProvider(cls.shm_prefix, cls.shm_prefix)
if cls.step:
- cls.vapi.register_hook(StepHook(cls))
- cls.vapi.register_hook(PollHook(cls))
+ hook = PollHook(cls)
+ cls.vapi.register_hook(hook)
try:
cls.vapi.connect()
except:
try:
cls.vapi.connect()
except:
"VPP-API connection failed, did you forget "
"to 'continue' VPP from within gdb?", RED))
raise
"VPP-API connection failed, did you forget "
"to 'continue' VPP from within gdb?", RED))
raise
- cls.vpp_stdout_queue = Queue()
- cls.vpp_stdout_reader_thread = Thread(
- target=pump_output, args=(cls.vpp.stdout, cls.vpp_stdout_queue))
- cls.vpp_stdout_reader_thread.start()
- cls.vpp_stderr_queue = Queue()
- cls.vpp_stderr_reader_thread = Thread(
- target=pump_output, args=(cls.vpp.stderr, cls.vpp_stderr_queue))
- cls.vpp_stderr_reader_thread.start()
- if hasattr(cls, 'vpp'):
- cls.vpp.terminate()
- del cls.vpp
+ try:
+ cls.quit()
+ except:
+ pass
""" Hook which checks if the vpp subprocess is alive """
def __init__(self, testcase):
""" Hook which checks if the vpp subprocess is alive """
def __init__(self, testcase):
self.testcase = testcase
self.logger = testcase.logger
self.testcase = testcase
self.logger = testcase.logger
Poll the vpp status and throw an exception if it's not running
:raises VppDiedError: exception if VPP is not running anymore
"""
Poll the vpp status and throw an exception if it's not running
:raises VppDiedError: exception if VPP is not running anymore
"""
+ if self.testcase.vpp_dead:
# already dead, nothing to do
return
# already dead, nothing to do
return