From 7d2708405b593acaec52d76b6bd71897e57455fa Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 6 Jun 2015 02:23:56 -0400 Subject: [PATCH] split up test_privacy to more easily identify failures (and to suppress output from successfult tests) --- test/test_privacy.cpp | 72 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 9 deletions(-) diff --git a/test/test_privacy.cpp b/test/test_privacy.cpp index 62e28f324..6c94a634f 100644 --- a/test/test_privacy.cpp +++ b/test/test_privacy.cpp @@ -242,31 +242,85 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags) return pr; } -TORRENT_TEST(privacy) +session_proxy pr[20]; + +// not using anonymous mode +// UDP fails open if we can't connect to the proxy +// or if the proxy doesn't support UDP + +TORRENT_TEST(no_proxy) { - session_proxy pr[20]; - // not using anonymous mode - // UDP fails open if we can't connect to the proxy - // or if the proxy doesn't support UDP pr[0] = test_proxy(settings_pack::none, expect_udp_connection | expect_http_connection | expect_dht_msg | expect_peer_connection); +} + +TORRENT_TEST(socks4) +{ pr[1] = test_proxy(settings_pack::socks4, expect_udp_connection | expect_dht_msg); +} + +TORRENT_TEST(socks5) +{ pr[2] = test_proxy(settings_pack::socks5, expect_possible_udp_connection | expect_possible_dht_msg); +} + +TORRENT_TEST(socks5_pw) +{ pr[3] = test_proxy(settings_pack::socks5_pw,expect_possible_udp_connection | expect_possible_dht_msg); +} + +TORRENT_TEST(http) +{ pr[4] = test_proxy(settings_pack::http, expect_udp_connection | expect_dht_msg); +} + +TORRENT_TEST(http_pt) +{ pr[5] = test_proxy(settings_pack::http_pw, expect_udp_connection | expect_dht_msg); +} + +TORRENT_TEST(i2p) +{ pr[6] = test_proxy(settings_pack::i2p_proxy, expect_udp_connection | expect_dht_msg); +} - // using anonymous mode +// using anonymous mode - // anonymous mode doesn't require a proxy when one isn't configured. It could be - // used with a VPN for instance. This will all changed in 1.0, where anonymous - // mode is separated from force_proxy +// anonymous mode doesn't require a proxy when one isn't configured. It could be +// used with a VPN for instance. This will all changed in 1.0, where anonymous +// mode is separated from force_proxy + +TORRENT_TEST(anon_no_proxy) +{ pr[7] = test_proxy(settings_pack::none, force_proxy_mode | expect_peer_connection); +} + +TORRENT_TEST(anon_socks4) +{ pr[8] = test_proxy(settings_pack::socks4, force_proxy_mode | expect_udp_reject); +} + +TORRENT_TEST(anon_socks5) +{ pr[9] = test_proxy(settings_pack::socks5, force_proxy_mode); +} + +TORRENT_TEST(anon_socks5_pw) +{ pr[10] = test_proxy(settings_pack::socks5_pw, force_proxy_mode); +} + +TORRENT_TEST(anon_http) +{ pr[11] = test_proxy(settings_pack::http, force_proxy_mode | expect_udp_reject); +} + +TORRENT_TEST(anon_http_pw) +{ pr[12] = test_proxy(settings_pack::http_pw, force_proxy_mode | expect_udp_reject); +} + +TORRENT_TEST(anon_i2p) +{ pr[13] = test_proxy(settings_pack::i2p_proxy, force_proxy_mode); }