tests: don't prompt to launch gdb for sanity test case

Type: test

Change-Id: I4c54121b76b341381a819cee928c3c2455a83503
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:
Paul Vinciguerra
2019-12-19 16:09:43 -05:00
committed by Neale Ranns
parent ff6cdcca2d
commit c701e57182
5 changed files with 40 additions and 22 deletions

View File

@ -398,6 +398,7 @@ rebuild-release: wipe-release build-release
libexpand = $(subst $(subst ,, ),:,$(foreach lib,$(1),$(BR)/install-$(2)-native/vpp/$(lib)/$(3))) libexpand = $(subst $(subst ,, ),:,$(foreach lib,$(1),$(BR)/install-$(2)-native/vpp/$(lib)/$(3)))
export TEST_DIR ?= $(WS_ROOT)/test export TEST_DIR ?= $(WS_ROOT)/test
export RND_SEED ?= $(shell python3 -c 'import time; print(time.time())')
define test define test
$(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=$(1) TAG=$(2) vpp-install,) $(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=$(1) TAG=$(2) vpp-install,)
@ -412,6 +413,7 @@ define test
EXTENDED_TESTS=$(EXTENDED_TESTS) \ EXTENDED_TESTS=$(EXTENDED_TESTS) \
PYTHON=$(PYTHON) \ PYTHON=$(PYTHON) \
OS_ID=$(OS_ID) \ OS_ID=$(OS_ID) \
RND_SEED=$(RND_SEED) \
CACHE_OUTPUT=$(CACHE_OUTPUT) \ CACHE_OUTPUT=$(CACHE_OUTPUT) \
$(3) $(3)
endef endef

View File

@ -241,8 +241,10 @@ shell: test-dep
@echo "source $(VENV_PATH)/bin/activate;\ @echo "source $(VENV_PATH)/bin/activate;\
cd $(BUILD_TEST_SRC);\ cd $(BUILD_TEST_SRC);\
export PYTHONPATH=$(BUILD_TEST_SRC);\ export PYTHONPATH=$(BUILD_TEST_SRC);\
export RND_SEED=$(RND_SEED);\
echo '***';\ echo '***';\
echo PYTHONPATH=$(BUILD_TEST_SRC);\ echo PYTHONPATH=$(BUILD_TEST_SRC);\
echo RND_SEED=$(RND_SEED);\
echo VPP_BUILD_DIR=$(VPP_BUILD_DIR);\ echo VPP_BUILD_DIR=$(VPP_BUILD_DIR);\
echo VPP_BIN=$(VPP_BIN);\ echo VPP_BIN=$(VPP_BIN);\
echo VPP_PLUGIN_PATH=$(VPP_PLUGIN_PATH);\ echo VPP_PLUGIN_PATH=$(VPP_PLUGIN_PATH);\

View File

@ -573,20 +573,28 @@ class VppTestCase(unittest.TestCase):
cls.quit() cls.quit()
raise raise
@classmethod
def _debug_quit(cls):
if (cls.debug_gdbserver or cls.debug_gdb):
try:
cls.vpp.poll()
if cls.vpp.returncode is None:
print()
print(double_line_delim)
print("VPP or GDB server is still running")
print(single_line_delim)
input("When done debugging, press ENTER to kill the "
"process and finish running the testcase...")
except AttributeError:
pass
@classmethod @classmethod
def quit(cls): def quit(cls):
""" """
Disconnect vpp-api, kill vpp and cleanup shared memory files Disconnect vpp-api, kill vpp and cleanup shared memory files
""" """
if (cls.debug_gdbserver or cls.debug_gdb) and hasattr(cls, 'vpp'): cls._debug_quit()
cls.vpp.poll()
if cls.vpp.returncode is None:
print()
print(double_line_delim)
print("VPP or GDB server is still running")
print(single_line_delim)
input("When done debugging, press ENTER to kill the "
"process and finish running the testcase...")
# first signal that we want to stop the pump thread, then wake it up # first signal that we want to stop the pump thread, then wake it up
if hasattr(cls, 'pump_thread_stop_flag'): if hasattr(cls, 'pump_thread_stop_flag'):
@ -597,7 +605,7 @@ class VppTestCase(unittest.TestCase):
cls.logger.debug("Waiting for pump thread to stop") cls.logger.debug("Waiting for pump thread to stop")
cls.pump_thread.join() cls.pump_thread.join()
if hasattr(cls, 'vpp_stderr_reader_thread'): if hasattr(cls, 'vpp_stderr_reader_thread'):
cls.logger.debug("Waiting for stdderr pump to stop") cls.logger.debug("Waiting for stderr pump to stop")
cls.vpp_stderr_reader_thread.join() cls.vpp_stderr_reader_thread.join()
if hasattr(cls, 'vpp'): if hasattr(cls, 'vpp'):

View File

@ -732,11 +732,6 @@ def parse_digit_env(env_var, default):
if __name__ == '__main__': if __name__ == '__main__':
if "RND_SEED" not in os.environ:
os.environ["RND_SEED"] = str(time.time())
print("Setting RND_SEED=%s" % os.environ["RND_SEED"])
else:
print("Using provided RND_SEED=%s" % os.environ["RND_SEED"])
verbose = parse_digit_env("V", 0) verbose = parse_digit_env("V", 0)
test_timeout = parse_digit_env("TIMEOUT", 600) # default = 10 minutes test_timeout = parse_digit_env("TIMEOUT", 600) # default = 10 minutes

View File

@ -2,7 +2,7 @@
from __future__ import print_function from __future__ import print_function
from multiprocessing import Pipe from multiprocessing import Pipe
from sys import exit import sys
import os import os
from framework import VppDiedError, VppTestCase, KeepAliveReporter from framework import VppDiedError, VppTestCase, KeepAliveReporter
@ -11,9 +11,20 @@ class SanityTestCase(VppTestCase):
""" Sanity test case - verify whether VPP is able to start """ """ Sanity test case - verify whether VPP is able to start """
pass pass
# don't ask to debug SanityTestCase
@classmethod
def wait_for_enter(cls, pid=0):
pass
@classmethod
def _debug_quit(cls):
try:
cls.vpp.poll()
except AttributeError:
pass
if __name__ == '__main__': if __name__ == '__main__':
os.environ["RND_SEED"] = "1"
rc = 0 rc = 0
tc = SanityTestCase tc = SanityTestCase
x, y = Pipe() x, y = Pipe()
@ -26,14 +37,14 @@ if __name__ == '__main__':
else: else:
try: try:
tc.tearDownClass() tc.tearDownClass()
except: except Exception:
pass rc = -1
x.close() x.close()
y.close() y.close()
if rc == 0: if rc == 0:
print('Sanity test case passed\n') print('Sanity test case passed.\n')
else: else:
print('Sanity test case failed\n') print('Sanity test case failed.\n')
exit(rc) sys.exit(rc)