aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_config.c
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2014-07-28 19:32:23 -0700
committerAndrea Shepard <andrea@torproject.org>2014-07-28 19:32:23 -0700
commit4a5164fd86465ab4546ce4aad0ed8ec1b9e26cd1 (patch)
tree187e3d53a78eb59dba49d46004116d46bbf6ec82 /src/test/test_config.c
parent5d81fd25a0558794902b93d0d73c0f0134ccfce6 (diff)
downloadtor-4a5164fd86465ab4546ce4aad0ed8ec1b9e26cd1.tar.gz
tor-4a5164fd86465ab4546ce4aad0ed8ec1b9e26cd1.zip
Replace all calls to parse_client_transport_line() or parse_server_transport_line() with new parse_transport_line() stub
Diffstat (limited to 'src/test/test_config.c')
-rw-r--r--src/test/test_config.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 5975e1e038..ae01facec7 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -608,84 +608,84 @@ test_config_parse_transport_plugin_line(void *arg)
int old_transport_is_needed_mock_call_count;
/* Bad transport lines - too short */
- r = parse_client_transport_line(options, "bad", 1);
+ r = parse_transport_line(options, "bad", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options, "bad", 1);
+ r = parse_transport_line(options, "bad", 1, 1);
test_assert(r < 0);
- r = parse_client_transport_line(options, "bad bad", 1);
+ r = parse_transport_line(options, "bad bad", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options, "bad bad", 1);
+ r = parse_transport_line(options, "bad bad", 1, 1);
test_assert(r < 0);
/* Test transport list parsing */
- r = parse_client_transport_line(options,
- "transport_1 exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_1 exec /usr/bin/fake-transport", 1, 0);
test_assert(r == 0);
- r = parse_server_transport_line(options,
- "transport_1 exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_1 exec /usr/bin/fake-transport", 1, 1);
test_assert(r == 0);
- r = parse_client_transport_line(options,
- "transport_1,transport_2 exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_1,transport_2 exec /usr/bin/fake-transport", 1, 0);
test_assert(r == 0);
- r = parse_server_transport_line(options,
- "transport_1,transport_2 exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_1,transport_2 exec /usr/bin/fake-transport", 1, 1);
test_assert(r == 0);
/* Bad transport identifiers */
- r = parse_client_transport_line(options,
- "transport_* exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_* exec /usr/bin/fake-transport", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options,
- "transport_* exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_* exec /usr/bin/fake-transport", 1, 1);
test_assert(r < 0);
/* Check SOCKS cases for client transport */
- r = parse_client_transport_line(options,
- "transport_1 socks4 1.2.3.4:567", 1);
+ r = parse_transport_line(options,
+ "transport_1 socks4 1.2.3.4:567", 1, 0);
test_assert(r == 0);
- r = parse_client_transport_line(options,
- "transport_1 socks5 1.2.3.4:567", 1);
+ r = parse_transport_line(options,
+ "transport_1 socks5 1.2.3.4:567", 1, 0);
test_assert(r == 0);
/* Proxy case for server transport */
- r = parse_server_transport_line(options,
- "transport_1 proxy 1.2.3.4:567", 1);
+ r = parse_transport_line(options,
+ "transport_1 proxy 1.2.3.4:567", 1, 1);
test_assert(r == 0);
/* Multiple-transport error exit */
- r = parse_client_transport_line(options,
- "transport_1,transport_2 socks5 1.2.3.4:567", 1);
+ r = parse_transport_line(options,
+ "transport_1,transport_2 socks5 1.2.3.4:567", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options,
- "transport_1,transport_2 proxy 1.2.3.4:567", 1);
+ r = parse_transport_line(options,
+ "transport_1,transport_2 proxy 1.2.3.4:567", 1, 1);
/* No port error exit */
- r = parse_client_transport_line(options,
- "transport_1 socks5 1.2.3.4", 1);
+ r = parse_transport_line(options,
+ "transport_1 socks5 1.2.3.4", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options,
- "transport_1 proxy 1.2.3.4", 1);
+ r = parse_transport_line(options,
+ "transport_1 proxy 1.2.3.4", 1, 1);
test_assert(r < 0);
/* Unparsable address error exit */
- r = parse_client_transport_line(options,
- "transport_1 socks5 1.2.3:6x7", 1);
+ r = parse_transport_line(options,
+ "transport_1 socks5 1.2.3:6x7", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options,
- "transport_1 proxy 1.2.3:6x7", 1);
+ r = parse_transport_line(options,
+ "transport_1 proxy 1.2.3:6x7", 1, 1);
test_assert(r < 0);
/* "Strange {Client|Server}TransportPlugin field" error exit */
- r = parse_client_transport_line(options,
- "transport_1 foo bar", 1);
+ r = parse_transport_line(options,
+ "transport_1 foo bar", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options,
- "transport_1 foo bar", 1);
+ r = parse_transport_line(options,
+ "transport_1 foo bar", 1, 1);
test_assert(r < 0);
/* No sandbox mode error exit */
tmp = options->Sandbox;
options->Sandbox = 1;
- r = parse_client_transport_line(options,
- "transport_1 exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_1 exec /usr/bin/fake-transport", 1, 0);
test_assert(r < 0);
- r = parse_server_transport_line(options,
- "transport_1 exec /usr/bin/fake-transport", 1);
+ r = parse_transport_line(options,
+ "transport_1 exec /usr/bin/fake-transport", 1, 1);
test_assert(r < 0);
options->Sandbox = tmp;
@@ -696,16 +696,16 @@ test_config_parse_transport_plugin_line(void *arg)
MOCK(pt_kickstart_proxy, pt_kickstart_proxy_mock);
old_pt_kickstart_proxy_mock_call_count =
pt_kickstart_proxy_mock_call_count;
- r = parse_server_transport_line(options,
- "transport_1 exec /usr/bin/fake-transport", 0);
+ r = parse_transport_line(options,
+ "transport_1 exec /usr/bin/fake-transport", 0, 1);
test_assert(r == 0);
test_assert(pt_kickstart_proxy_mock_call_count ==
old_pt_kickstart_proxy_mock_call_count + 1);
UNMOCK(pt_kickstart_proxy);
/* This one hits a log line in the !validate_only case only */
- r = parse_server_transport_line(options,
- "transport_1 proxy 1.2.3.4:567", 0);
+ r = parse_transport_line(options,
+ "transport_1 proxy 1.2.3.4:567", 0, 1);
test_assert(r == 0);
/* Check mocked client transport cases */
@@ -721,8 +721,8 @@ test_config_parse_transport_plugin_line(void *arg)
transport_add_from_config_mock_call_count;
old_transport_is_needed_mock_call_count =
transport_is_needed_mock_call_count;
- r = parse_client_transport_line(options,
- "transport_1 exec /usr/bin/fake-transport", 0);
+ r = parse_transport_line(options,
+ "transport_1 exec /usr/bin/fake-transport", 0, 0);
/* Should have succeeded */
test_assert(r == 0);
/* transport_is_needed() should have been called */
@@ -745,8 +745,8 @@ test_config_parse_transport_plugin_line(void *arg)
transport_add_from_config_mock_call_count;
old_transport_is_needed_mock_call_count =
transport_is_needed_mock_call_count;
- r = parse_client_transport_line(options,
- "transport_1 exec /usr/bin/fake-transport", 0);
+ r = parse_transport_line(options,
+ "transport_1 exec /usr/bin/fake-transport", 0, 0);
/* Should have succeeded */
test_assert(r == 0);
/*
@@ -769,8 +769,8 @@ test_config_parse_transport_plugin_line(void *arg)
transport_add_from_config_mock_call_count;
old_transport_is_needed_mock_call_count =
transport_is_needed_mock_call_count;
- r = parse_client_transport_line(options,
- "transport_1 socks5 1.2.3.4:567", 0);
+ r = parse_transport_line(options,
+ "transport_1 socks5 1.2.3.4:567", 0, 0);
/* Should have succeeded */
test_assert(r == 0);
/*