summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-12-17 09:53:17 -0500
committerNick Mathewson <nickm@torproject.org>2018-12-17 09:53:17 -0500
commit315c21d2e200fc45e4886fb7ab32e01a3a8354e9 (patch)
treeac7d32af6330b5913c9662ebaff57d75e3f2c201 /src/test
parent94a79981580d6260597f799bc1a163c8e6f07acd (diff)
downloadtor-315c21d2e200fc45e4886fb7ab32e01a3a8354e9.tar.gz
tor-315c21d2e200fc45e4886fb7ab32e01a3a8354e9.zip
test_rebind: wait for tor to timeout, even if it is logging a lot
Fixes bug 28883; bugfix on 0.3.5.4-alpha.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_rebind.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py
index 2215b42253..92a346775e 100644
--- a/src/test/test_rebind.py
+++ b/src/test/test_rebind.py
@@ -11,7 +11,6 @@ import time
LOG_TIMEOUT = 60.0
LOG_WAIT = 0.1
-LOG_CHECK_LIMIT = LOG_TIMEOUT / LOG_WAIT
def fail(msg):
logging.error('FAIL')
@@ -25,8 +24,8 @@ def try_connecting_to_socksport():
socks_socket.close()
def wait_for_log(s):
- log_checked = 0
- while log_checked < LOG_CHECK_LIMIT:
+ cutoff = time.time() + LOG_TIMEOUT
+ while time.time() < cutoff:
l = tor_process.stdout.readline()
l = l.decode('utf8')
if s in l:
@@ -37,7 +36,6 @@ def wait_for_log(s):
# avoid busy-waiting
if len(s) == 0:
time.sleep(LOG_WAIT)
- log_checked += 1
fail('Could not find "{}" in logs after {} seconds'.format(s, LOG_TIMEOUT))
def pick_random_port():