aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_circuitbuild.c
diff options
context:
space:
mode:
authorTaylor Yu <catalyst@torproject.org>2017-04-03 15:00:33 -0400
committerTaylor Yu <catalyst@torproject.org>2017-04-03 15:24:59 -0400
commitb1c7e5d8c0a648b1d210d885f5cc32f41f052996 (patch)
treec4f3c3e82281f2378980a69becb543759e514f5f /src/test/test_circuitbuild.c
parent67c88fd10dd74d03161ec61aac4cdc4ce31bf29d (diff)
downloadtor-b1c7e5d8c0a648b1d210d885f5cc32f41f052996.tar.gz
tor-b1c7e5d8c0a648b1d210d885f5cc32f41f052996.zip
Capture expected log in test_circuitbuild.c
Capture the warning for the unhandled circuit purpose test case, both to clean up the test log and to confirm that it gets logged.
Diffstat (limited to 'src/test/test_circuitbuild.c')
-rw-r--r--src/test/test_circuitbuild.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/test_circuitbuild.c b/src/test/test_circuitbuild.c
index 338bc1a667..a5282df69d 100644
--- a/src/test/test_circuitbuild.c
+++ b/src/test/test_circuitbuild.c
@@ -8,6 +8,7 @@
#include "or.h"
#include "test.h"
#include "test_helpers.h"
+#include "log_test_helpers.h"
#include "config.h"
#include "circuitbuild.h"
@@ -107,11 +108,15 @@ test_new_route_len_unhandled_exit(void *arg)
MOCK(count_acceptable_nodes, mock_count_acceptable_nodes);
tor_capture_bugs_(1);
+ setup_full_capture_of_logs(LOG_WARN);
r = new_route_len(CIRCUIT_PURPOSE_CONTROLLER, &dummy_ei, &dummy_nodes);
tt_int_op(DEFAULT_ROUTE_LEN + 1, OP_EQ, r);
tt_int_op(smartlist_len(tor_get_captured_bug_log_()), OP_EQ, 1);
tt_str_op(smartlist_get(tor_get_captured_bug_log_(), 0), OP_EQ,
"!(exit_ei && !known_purpose)");
+ expect_single_log_msg_containing("Unhandled purpose");
+ expect_single_log_msg_containing("with a chosen exit; assuming routelen");
+ teardown_capture_of_logs();
tor_end_capture_bugs_();
done: