summaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2019-10-13 18:56:03 +0000
committerOle Trøan <otroan@employees.org>2019-10-28 09:16:34 +0000
commit63cb8827e586f02f53512d23a8e7596fe9c19aa8 (patch)
treef79715f7a48fafd02f768f9093ec9abbdc2a32be /test/framework.py
parentd29422cbeeefb58d0213b295b35d04a673b380e7 (diff)
tests: make RA tests run on VPP time
the IPv6 RA tests take timing into the account, but the time inside VPP may go slightly differently compared to the time inside the driving python thread, if the machine running the tests is heavily loaded. Make a sleep function which sleeps "on VPP time" and use it. Change-Id: I3b34b0164f6e0ec7a619b92ee308089a4a8935e3 Type: test Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/framework.py b/test/framework.py
index 62b99e582ca..aad5173a55a 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -754,6 +754,20 @@ class VppTestCase(unittest.TestCase):
cls._captures.append((time.time(), cap_name))
@classmethod
+ def get_vpp_time(cls):
+ return float(cls.vapi.cli('show clock').replace("Time now ", ""))
+
+ @classmethod
+ def sleep_on_vpp_time(cls, sec):
+ """ Sleep according to time in VPP world """
+ # On a busy system with many processes
+ # we might end up with VPP time being slower than real world
+ # So take that into account when waiting for VPP to do something
+ start_time = cls.get_vpp_time()
+ while cls.get_vpp_time() - start_time < sec:
+ cls.sleep(0.1)
+
+ @classmethod
def pg_start(cls):
""" Enable the PG, wait till it is done, then clean up """
cls.vapi.cli("trace add pg-input 1000")