summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-12-19 16:09:43 -0500
committerNeale Ranns <nranns@cisco.com>2019-12-20 04:09:09 +0000
commitc701e5718201fbfb205998343da70c816c57795f (patch)
treeac63febf19925f5bc38b673dfc1f513d3076be23
parentff6cdcca2dc741bb3b0d3757e83ada523c7a4a45 (diff)
tests: don't prompt to launch gdb for sanity test case
Type: test Change-Id: I4c54121b76b341381a819cee928c3c2455a83503 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r--Makefile2
-rw-r--r--test/Makefile2
-rw-r--r--test/framework.py28
-rw-r--r--test/run_tests.py5
-rw-r--r--test/sanity_run_vpp.py25
5 files changed, 40 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 8084d822669..e580a31812f 100644
--- a/Makefile
+++ b/Makefile
@@ -398,6 +398,7 @@ rebuild-release: wipe-release build-release
libexpand = $(subst $(subst ,, ),:,$(foreach lib,$(1),$(BR)/install-$(2)-native/vpp/$(lib)/$(3)))
export TEST_DIR ?= $(WS_ROOT)/test
+export RND_SEED ?= $(shell python3 -c 'import time; print(time.time())')
define test
$(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=$(1) TAG=$(2) vpp-install,)
@@ -412,6 +413,7 @@ define test
EXTENDED_TESTS=$(EXTENDED_TESTS) \
PYTHON=$(PYTHON) \
OS_ID=$(OS_ID) \
+ RND_SEED=$(RND_SEED) \
CACHE_OUTPUT=$(CACHE_OUTPUT) \
$(3)
endef
diff --git a/test/Makefile b/test/Makefile
index ef0b27c9572..cbdcff1a2d5 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -241,8 +241,10 @@ shell: test-dep
@echo "source $(VENV_PATH)/bin/activate;\
cd $(BUILD_TEST_SRC);\
export PYTHONPATH=$(BUILD_TEST_SRC);\
+ export RND_SEED=$(RND_SEED);\
echo '***';\
echo PYTHONPATH=$(BUILD_TEST_SRC);\
+ echo RND_SEED=$(RND_SEED);\
echo VPP_BUILD_DIR=$(VPP_BUILD_DIR);\
echo VPP_BIN=$(VPP_BIN);\
echo VPP_PLUGIN_PATH=$(VPP_PLUGIN_PATH);\
diff --git a/test/framework.py b/test/framework.py
index 39fd37f4c73..7ff7978a055 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -574,19 +574,27 @@ class VppTestCase(unittest.TestCase):
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
def quit(cls):
"""
Disconnect vpp-api, kill vpp and cleanup shared memory files
"""
- if (cls.debug_gdbserver or cls.debug_gdb) and hasattr(cls, 'vpp'):
- 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...")
+ cls._debug_quit()
# first signal that we want to stop the pump thread, then wake it up
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.pump_thread.join()
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()
if hasattr(cls, 'vpp'):
diff --git a/test/run_tests.py b/test/run_tests.py
index 09b68a217a5..8024696def4 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -732,11 +732,6 @@ def parse_digit_env(env_var, default):
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)
test_timeout = parse_digit_env("TIMEOUT", 600) # default = 10 minutes
diff --git a/test/sanity_run_vpp.py b/test/sanity_run_vpp.py
index 535d054fe51..5eb68853b1f 100644
--- a/test/sanity_run_vpp.py
+++ b/test/sanity_run_vpp.py
@@ -2,7 +2,7 @@
from __future__ import print_function
from multiprocessing import Pipe
-from sys import exit
+import sys
import os
from framework import VppDiedError, VppTestCase, KeepAliveReporter
@@ -11,9 +11,20 @@ class SanityTestCase(VppTestCase):
""" Sanity test case - verify whether VPP is able to start """
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__':
- os.environ["RND_SEED"] = "1"
rc = 0
tc = SanityTestCase
x, y = Pipe()
@@ -26,14 +37,14 @@ if __name__ == '__main__':
else:
try:
tc.tearDownClass()
- except:
- pass
+ except Exception:
+ rc = -1
x.close()
y.close()
if rc == 0:
- print('Sanity test case passed\n')
+ print('Sanity test case passed.\n')
else:
- print('Sanity test case failed\n')
+ print('Sanity test case failed.\n')
- exit(rc)
+ sys.exit(rc)