diff options
author | Alexander Færøy <ahf@torproject.org> | 2018-12-20 03:55:02 +0100 |
---|---|---|
committer | Alexander Færøy <ahf@torproject.org> | 2018-12-20 03:55:02 +0100 |
commit | 4efe4cc2f918ce45075b010d2cdc09ec7791ac6b (patch) | |
tree | cde7a4670aa361d00aa3a6c251ed19b572d018d5 /src/test/test_pt.c | |
parent | 426c52b377057dc5f4428c664ee56ca77d648c9e (diff) | |
download | tor-4efe4cc2f918ce45075b010d2cdc09ec7791ac6b.tar.gz tor-4efe4cc2f918ce45075b010d2cdc09ec7791ac6b.zip |
Add support for STATUS messages from Pluggable Transports.
This patch adds support for the new STATUS message that PT's can emit
from their standard out. The STATUS message uses the `config_line_t` K/V
format that was recently added in Tor.
See: https://bugs.torproject.org/28846
Diffstat (limited to 'src/test/test_pt.c')
-rw-r--r-- | src/test/test_pt.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/test_pt.c b/src/test/test_pt.c index 271d74f26a..8de687c866 100644 --- a/src/test/test_pt.c +++ b/src/test/test_pt.c @@ -316,6 +316,10 @@ process_read_stdout_replacement(process_t *process, buf_t *buffer) buf_add_string(buffer, "LOG SEVERITY=notice MESSAGE=\"notice msg\"\n"); buf_add_string(buffer, "LOG SEVERITY=info MESSAGE=\"info msg\"\n"); buf_add_string(buffer, "LOG SEVERITY=debug MESSAGE=\"debug msg\"\n"); + } else if (times_called <= 8) { + buf_add_string(buffer, "STATUS TYPE=a K_1=a K_2=b K_3=\"foo bar\"\n"); + buf_add_string(buffer, "STATUS TYPE=b K_1=a K_2=b K_3=\"foo bar\"\n"); + buf_add_string(buffer, "STATUS TYPE=c K_1=a K_2=b K_3=\"foo bar\"\n"); } return (int)buf_datalen(buffer); @@ -440,6 +444,23 @@ test_pt_configure_proxy(void *arg) "650 PT_LOG PT=<testcase> SEVERITY=debug " "MESSAGE=\"debug msg\"\r\n"); + /* Get the STATUS messages out. */ + process_notify_event_stdout(mp->process); + + tt_int_op(controlevent_n, OP_EQ, 13); + tt_int_op(controlevent_event, OP_EQ, EVENT_PT_STATUS); + tt_int_op(smartlist_len(controlevent_msgs), OP_EQ, 13); + + tt_str_op(smartlist_get(controlevent_msgs, 10), OP_EQ, + "650 PT_STATUS " + "PT=<testcase> TYPE=a K_1=a K_2=b K_3=\"foo bar\"\r\n"); + tt_str_op(smartlist_get(controlevent_msgs, 11), OP_EQ, + "650 PT_STATUS " + "PT=<testcase> TYPE=b K_1=a K_2=b K_3=\"foo bar\"\r\n"); + tt_str_op(smartlist_get(controlevent_msgs, 12), OP_EQ, + "650 PT_STATUS " + "PT=<testcase> TYPE=c K_1=a K_2=b K_3=\"foo bar\"\r\n"); + { /* check that the transport info were saved properly in the tor state */ config_line_t *transport_in_state = NULL; smartlist_t *transport_info_sl = smartlist_new(); |