aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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
4 files changed, 38 insertions, 22 deletions
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)