diff options
Diffstat (limited to 'test/framework.py')
-rw-r--r-- | test/framework.py | 14 |
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") |