diff options
author | teor <teor@torproject.org> | 2019-11-06 11:19:38 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-11-06 11:19:38 +1000 |
commit | 03e77ef036e41486b8bfe138d11790c928f49f35 (patch) | |
tree | 637844fa0ea98b61df95dc2985f2cbfe62580a04 /src/test/test_rebind.py | |
parent | 54e2d0dc2d790a9e84ec44db2d53d535d8076602 (diff) | |
parent | 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26 (diff) | |
download | tor-03e77ef036e41486b8bfe138d11790c928f49f35.tar.gz tor-03e77ef036e41486b8bfe138d11790c928f49f35.zip |
Merge branch 'maint-0.3.5' into maint-0.4.0
Diffstat (limited to 'src/test/test_rebind.py')
-rw-r--r-- | src/test/test_rebind.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py index 232b200326..c9b9200b2d 100644 --- a/src/test/test_rebind.py +++ b/src/test/test_rebind.py @@ -32,15 +32,17 @@ def wait_for_log(s): cutoff = time.time() + LOG_TIMEOUT while time.time() < cutoff: l = tor_process.stdout.readline() - l = l.decode('utf8') + l = l.decode('utf8', 'backslashreplace') if s in l: logging.info('Tor logged: "{}"'.format(l.strip())) return - logging.info('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s)) # readline() returns a blank string when there is no output # avoid busy-waiting - if len(s) == 0: + if len(l) == 0: + logging.debug('Tor has not logged anything, waiting for "{}"'.format(s)) time.sleep(LOG_WAIT) + else: + logging.info('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s)) fail('Could not find "{}" in logs after {} seconds'.format(s, LOG_TIMEOUT)) def pick_random_port(): @@ -120,18 +122,18 @@ if control_socket.connect_ex(('127.0.0.1', control_port)): tor_process.terminate() fail('Cannot connect to ControlPort') -control_socket.sendall('AUTHENTICATE \r\n'.encode('utf8')) -control_socket.sendall('SETCONF SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('utf8')) +control_socket.sendall('AUTHENTICATE \r\n'.encode('ascii')) +control_socket.sendall('SETCONF SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('ascii')) wait_for_log('Opened Socks listener') try_connecting_to_socksport() -control_socket.sendall('SETCONF SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('utf8')) +control_socket.sendall('SETCONF SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('ascii')) wait_for_log('Opened Socks listener') try_connecting_to_socksport() -control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8')) +control_socket.sendall('SIGNAL HALT\r\n'.encode('ascii')) wait_for_log('exiting cleanly') logging.info('OK') |