From 65475d54a66e2528e49f31dd2e212dbbd40dba79 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 14 Oct 2013 08:15:08 +0000 Subject: [PATCH] valgrind unit test polish --- test/test_privacy.cpp | 9 ++++++++- test/test_ssl.cpp | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/test/test_privacy.cpp b/test/test_privacy.cpp index 3743d28b1..41b09a64f 100644 --- a/test/test_privacy.cpp +++ b/test/test_privacy.cpp @@ -146,7 +146,14 @@ void test_proxy(proxy_settings::proxy_type proxy_type, int flags) h.connect_peer(tcp::endpoint(address_v4::from_string("127.0.0.1"), peer_port)); rejected_trackers.clear(); - for (int i = 0; i < 15; ++i) + +#ifdef TORRENT_USE_VALGRIND + const int timeout = 90; +#else + const int timeout = 15; +#endif + + for (int i = 0; i < timeout; ++i) { print_alerts(*s, "s", false, false, false, &alert_predicate); test_sleep(100); diff --git a/test/test_ssl.cpp b/test/test_ssl.cpp index b9da5769a..f46aed303 100644 --- a/test/test_ssl.cpp +++ b/test/test_ssl.cpp @@ -185,6 +185,11 @@ void test_ssl(int test_idx, bool use_utp) , "test"); } +#ifdef TORRENT_USE_VALGRIND + const int timeout = 100; +#else + const int timeout = 40; +#endif for (int i = 0; i < 40; ++i) { print_alerts(ses1, "ses1", true, true, true, &on_alert); @@ -209,7 +214,11 @@ void test_ssl(int test_idx, bool use_utp) << std::endl; } - if (peer_disconnects >= 2) break; + if (peer_disconnects >= 2) + { + fprintf(stderr, "too many disconnects (%d), breaking\n", peer_disconnects); + break; + } if (st2.is_finished) break;