diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_rebind.py | 14 | ||||
-rwxr-xr-x | src/test/test_rebind.sh | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py index 9472d5cef5..f02cb79b78 100644 --- a/src/test/test_rebind.py +++ b/src/test/test_rebind.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + from __future__ import print_function import sys @@ -18,14 +20,14 @@ def try_connecting_to_socksport(): def wait_for_log(s): while True: l = tor_process.stdout.readline() - if s in l: + if s in l.decode('utf8'): return def pick_random_port(): port = 0 random.seed() - for i in xrange(8): + for i in range(8): port = random.randint(10000, 60000) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if s.connect_ex(('127.0.0.1', port)) == 0: @@ -69,18 +71,18 @@ if control_socket.connect_ex(('127.0.0.1', control_port)): print('FAIL') sys.exit('Cannot connect to ControlPort') -control_socket.sendall('AUTHENTICATE \r\n') -control_socket.sendall('SETCONF SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port)) +control_socket.sendall('AUTHENTICATE \r\n'.encode('utf8')) +control_socket.sendall('SETCONF SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('utf8')) wait_for_log('Opened Socks listener') try_connecting_to_socksport() -control_socket.sendall('SETCONF SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port)) +control_socket.sendall('SETCONF SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('utf8')) wait_for_log('Opened Socks listener') try_connecting_to_socksport() -control_socket.sendall('SIGNAL HALT\r\n') +control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8')) time.sleep(0.1) print('OK') diff --git a/src/test/test_rebind.sh b/src/test/test_rebind.sh index 47f38afc45..2e18f9c979 100755 --- a/src/test/test_rebind.sh +++ b/src/test/test_rebind.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -x + exitcode=0 "${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/test_rebind.py" "${TESTING_TOR_BINARY}" || exitcode=1 |