summaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-11-05 11:18:25 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-11-18 13:17:57 +0000
commitfc000f0e1d61a9361e364a8f757e416fad7883b7 (patch)
treec579b945cd990f477d9c55c66c24893da6205e1a /test/framework.py
parent329c884aa27398523377736f51a2694ec2c4820d (diff)
tests: support setting random seed
Log the random seed used when running tests and provide means to re-use it in a later run. Type: feature Change-Id: I18d2a36ee802b901d4cca5577df41cec07f09cc0 Signed-off-by: Klement Sekera <ksekera@cisco.com> (cherry picked from commit 45a95dd782b91e9ae5665b5f95be4b6d7f99b879)
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/framework.py b/test/framework.py
index 4e43224c302..046a601e3e3 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -500,8 +500,9 @@ class VppTestCase(unittest.TestCase):
"""
super(VppTestCase, cls).setUpClass()
gc.collect() # run garbage collection first
- random.seed()
cls.logger = get_logger(cls.__name__)
+ seed = os.environ["RND_SEED"]
+ random.seed(seed)
if hasattr(cls, 'parallel_handler'):
cls.logger.addHandler(cls.parallel_handler)
cls.logger.propagate = False
@@ -522,6 +523,7 @@ class VppTestCase(unittest.TestCase):
os.chdir(cls.tempdir)
cls.logger.info("Temporary dir is %s, shm prefix is %s",
cls.tempdir, cls.shm_prefix)
+ cls.logger.debug("Random seed is %s" % seed)
cls.setUpConstants()
cls.reset_packet_infos()
cls._captures = []