summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/test_entrynodes.c5
-rw-r--r--src/test/test_rebind.py16
2 files changed, 16 insertions, 5 deletions
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index b67c9fae53..4cd50463d4 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -2832,13 +2832,16 @@ test_entry_guard_outdated_dirserver_exclusion(void *arg)
digests, 3, 7, 0);
/* ... and check that because we failed to fetch microdescs from all our
- * primaries, we didnt end up selecting a primary for fetching dir info */
+ * primaries, we didn't end up selecting a primary for fetching dir info */
expect_log_msg_containing("No primary or confirmed guards available.");
teardown_capture_of_logs();
}
done:
+ UNMOCK(networkstatus_get_latest_consensus_by_flavor);
+ UNMOCK(directory_initiate_request);
smartlist_free(digests);
+ tor_free(mock_ns_val);
tor_free(args);
if (conn) {
tor_free(conn->requested_resource);
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py
index c63341a681..2215b42253 100644
--- a/src/test/test_rebind.py
+++ b/src/test/test_rebind.py
@@ -1,6 +1,7 @@
from __future__ import print_function
import errno
+import logging
import os
import random
import socket
@@ -13,7 +14,7 @@ LOG_WAIT = 0.1
LOG_CHECK_LIMIT = LOG_TIMEOUT / LOG_WAIT
def fail(msg):
- print('FAIL')
+ logging.error('FAIL')
sys.exit(msg)
def try_connecting_to_socksport():
@@ -29,8 +30,9 @@ def wait_for_log(s):
l = tor_process.stdout.readline()
l = l.decode('utf8')
if s in l:
+ logging.info('Tor logged: "{}"'.format(l.strip()))
return
- print('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s))
+ 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:
@@ -55,6 +57,10 @@ def pick_random_port():
return port
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s.%(msecs)03d %(message)s',
+ datefmt='%Y-%m-%d %H:%M:%S')
+
if sys.hexversion < 0x02070000:
fail("ERROR: unsupported Python version (should be >= 2.7)")
@@ -75,6 +81,8 @@ tor_path = sys.argv[1]
tor_process = subprocess.Popen([tor_path,
'-ControlPort', '127.0.0.1:{}'.format(control_port),
'-SOCKSPort', '127.0.0.1:{}'.format(socks_port),
+ '-Log', 'debug stdout',
+ '-LogTimeGranularity', '1',
'-FetchServerDescriptors', '0'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
@@ -108,13 +116,13 @@ try_connecting_to_socksport()
control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8'))
wait_for_log('exiting cleanly')
-print('OK')
+logging.info('OK')
try:
tor_process.terminate()
except OSError as e:
if e.errno == errno.ESRCH: # errno 3: No such process
# assume tor has already exited due to SIGNAL HALT
- print("Tor has already exited")
+ logging.warn("Tor has already exited")
else:
raise