From 5e5e31cf9a2d7631af619a334cf1c65eff2011bc Mon Sep 17 00:00:00 2001 From: arvidn Date: Wed, 10 Jun 2015 21:10:22 -0400 Subject: [PATCH] fix test privacy to not destruct session, potentially, after other global destructors --- examples/client_test.cpp | 2 +- test/test_privacy.cpp | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 615da045d..022f9d6a7 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -375,7 +375,7 @@ FILE* g_log_file = 0; std::string const& piece_bar(libtorrent::bitfield const& p, int width) { const int table_size = 18; - + double piece_per_char = p.size() / double(width); static std::string bar; bar.clear(); diff --git a/test/test_privacy.cpp b/test/test_privacy.cpp index 6c94a634f..df045a306 100644 --- a/test/test_privacy.cpp +++ b/test/test_privacy.cpp @@ -242,45 +242,43 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags) return pr; } -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) { - pr[0] = test_proxy(settings_pack::none, expect_udp_connection | expect_http_connection | expect_dht_msg | expect_peer_connection); + 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); + 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); + 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); + prtest_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); + prtest_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); + prtest_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); + prtest_proxy(settings_pack::i2p_proxy, expect_udp_connection | expect_dht_msg); } // using anonymous mode @@ -291,36 +289,36 @@ TORRENT_TEST(i2p) TORRENT_TEST(anon_no_proxy) { - pr[7] = test_proxy(settings_pack::none, force_proxy_mode | expect_peer_connection); + prtest_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); + prtest_proxy(settings_pack::socks4, force_proxy_mode | expect_udp_reject); } TORRENT_TEST(anon_socks5) { - pr[9] = test_proxy(settings_pack::socks5, force_proxy_mode); + prtest_proxy(settings_pack::socks5, force_proxy_mode); } TORRENT_TEST(anon_socks5_pw) { - pr[10] = test_proxy(settings_pack::socks5_pw, force_proxy_mode); + prtest_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); + prtest_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); + prtest_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); + prtest_proxy(settings_pack::i2p_proxy, force_proxy_mode); }