Tests: fix time.sleep(0) # yield. Reduce sleep related log messages.

Reduce the incidence of:
20:04:23,606 unexpected time.sleep() result - slept for 2.187967e-03s instead of ~6.837845e-04s!

Change-Id: Ic576fda7f75e571c9019111588a6a936ee2cf5c2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:
Paul Vinciguerra
2019-03-10 09:10:54 -07:00
committed by Ole Trøan
parent d3a9be2ca0
commit 0f6602cb24
4 changed files with 21 additions and 8 deletions

View File

@ -285,7 +285,7 @@ class VppPGInterface(VppInterface):
while time.time() < deadline:
if os.path.isfile(self.out_path):
break
time.sleep(0) # yield
self._test.sleep(0) # yield
if os.path.isfile(self.out_path):
self.test.logger.debug("Capture file appeared after %fs" %
(time.time() - (deadline - timeout)))
@ -353,7 +353,7 @@ class VppPGInterface(VppInterface):
self.test.logger.debug("Polling for packet")
while time.time() < deadline or poll:
if not self.verify_enough_packet_data_in_pcap():
time.sleep(0) # yield
self._test.sleep(0) # yield
poll = False
continue
p = self._pcap_reader.recv()
@ -367,7 +367,7 @@ class VppPGInterface(VppInterface):
"Packet received after %fs" %
(time.time() - (deadline - timeout)))
return p
time.sleep(0) # yield
self._test.sleep(0) # yield
poll = False
self.test.logger.debug("Timeout - no packets received")
raise CaptureTimeoutError("Packet didn't arrive within timeout")