From 54c451e513be3955c83626cc8fc34f8f8799f417 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 24 Apr 2010 19:36:16 +0000 Subject: [PATCH] improvements to test_transfer --- test/test_transfer.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 684a5d8d6..22e7c405d 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -73,8 +73,12 @@ void test_rate() boost::tie(tor1, tor2, ignore) = setup_transfer(&ses1, &ses2, 0 , true, false, true, "_transfer", 0, &t); - ses1.set_alert_mask(alert::all_categories & ~(alert::performance_warning)); - ses2.set_alert_mask(alert::all_categories & ~(alert::performance_warning)); + ses1.set_alert_mask(alert::all_categories + & ~alert::progress_notification + & ~alert::stats_notification); + ses2.set_alert_mask(alert::all_categories + & ~alert::progress_notification + & ~alert::stats_notification); ptime start = time_now(); @@ -312,8 +316,12 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe std::copy(priorities.begin(), priorities.end(), std::ostream_iterator(std::cerr, ", ")); std::cerr << std::endl; - ses1.set_alert_mask(alert::all_categories & ~alert::progress_notification); - ses2.set_alert_mask(alert::all_categories & ~alert::progress_notification); + ses1.set_alert_mask(alert::all_categories + & ~alert::progress_notification + & ~alert::stats_notification); + ses2.set_alert_mask(alert::all_categories + & ~alert::progress_notification + & ~alert::stats_notification); ses1.set_alert_dispatch(&print_alert); ses2.set_download_rate_limit(tor2.get_torrent_info().piece_length() * 5); @@ -405,13 +413,19 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe tor2.pause(); alert const* a = ses2.wait_for_alert(seconds(10)); + bool got_paused_alert = false; while (a) { std::auto_ptr holder = ses2.pop_alert(); std::cerr << "ses2: " << a->message() << std::endl; - if (alert_cast(a)) break; + if (alert_cast(a)) + { + got_paused_alert = true; + break; + } a = ses2.wait_for_alert(seconds(10)); } + TEST_CHECK(got_paused_alert); std::vector tr = tor2.trackers(); tr.push_back(announce_entry("http://test.com/announce")); @@ -434,6 +448,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe } a = ses2.wait_for_alert(seconds(10)); } + TEST_CHECK(resume_data.size()); std::cerr << "saved resume data" << std::endl; @@ -449,7 +464,9 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe p.save_path = "./tmp2_transfer_moved"; p.resume_data = &resume_data; tor2 = ses2.add_torrent(p, ec); - ses2.set_alert_mask(alert::all_categories & ~alert::progress_notification); + ses2.set_alert_mask(alert::all_categories + & ~alert::progress_notification + & ~alert::stats_notification); tor2.prioritize_pieces(priorities); std::cout << "resetting priorities" << std::endl; tor2.resume();