From 6bb688f6996d67521cfa661e5d892c6b42785465 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 9 Oct 2010 19:56:10 +0000 Subject: [PATCH] less printouts in test_transfer --- test/test_transfer.cpp | 76 ++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 70ea0aa7b..eacc3bd42 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -82,7 +82,7 @@ void test_rate() ptime start = time_now(); - for (int i = 0; i < 7; ++i) + for (int i = 0; i < 70; ++i) { print_alerts(ses1, "ses1"); print_alerts(ses2, "ses2"); @@ -90,14 +90,17 @@ void test_rate() torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); - std::cerr - << "up: \033[33m" << st1.upload_payload_rate / 1000000.f << "MB/s " - << " down: \033[32m" << st2.download_payload_rate / 1000000.f << "MB/s " - << "\033[0m" << int(st2.progress * 100) << "% " - << std::endl; + if (i % 10 == 0) + { + std::cerr + << "up: \033[33m" << st1.upload_payload_rate / 1000000.f << "MB/s " + << " down: \033[32m" << st2.download_payload_rate / 1000000.f << "MB/s " + << "\033[0m" << int(st2.progress * 100) << "% " + << std::endl; + } if (tor2.is_seed()) break; - test_sleep(1000); + test_sleep(100); } TEST_CHECK(tor2.is_seed()); @@ -342,18 +345,21 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); - std::cerr - << "\033[32m" << int(st1.download_payload_rate / 1000.f) << "kB/s " - << "\033[33m" << int(st1.upload_payload_rate / 1000.f) << "kB/s " - << "\033[0m" << int(st1.progress * 100) << "% " - << st1.num_peers - << ": " - << "\033[32m" << int(st2.download_payload_rate / 1000.f) << "kB/s " - << "\033[31m" << int(st2.upload_payload_rate / 1000.f) << "kB/s " - << "\033[0m" << int(st2.progress * 100) << "% " - << st2.num_peers - << " cc: " << st2.connect_candidates - << std::endl; + if (i % 10 == 0) + { + std::cerr + << "\033[32m" << int(st1.download_payload_rate / 1000.f) << "kB/s " + << "\033[33m" << int(st1.upload_payload_rate / 1000.f) << "kB/s " + << "\033[0m" << int(st1.progress * 100) << "% " + << st1.num_peers + << ": " + << "\033[32m" << int(st2.download_payload_rate / 1000.f) << "kB/s " + << "\033[31m" << int(st2.upload_payload_rate / 1000.f) << "kB/s " + << "\033[0m" << int(st2.progress * 100) << "% " + << st2.num_peers + << " cc: " << st2.connect_candidates + << std::endl; + } if (!test_move_storage && st2.progress > 0.25f) { @@ -397,7 +403,8 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe test_sleep(100); print_alerts(ses2, "ses2"); torrent_status st2 = tor2.status(); - std::cerr << "\033[0m" << int(st2.progress * 100) << "% " << std::endl; + if (i % 10 == 0) + std::cerr << "\033[0m" << int(st2.progress * 100) << "% " << std::endl; if (st2.state != torrent_status::checking_files) break; } @@ -408,7 +415,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe { print_alerts(ses2, "ses2"); torrent_status st2 = tor2.status(); - std::cerr << "\033[0m" << int(st2.progress * 100) << "% " << std::endl; +// std::cerr << "\033[0m" << int(st2.progress * 100) << "% " << std::endl; TEST_CHECK(st2.state == torrent_status::finished); test_sleep(100); } @@ -507,18 +514,21 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); - std::cerr - << "\033[32m" << int(st1.download_payload_rate / 1000.f) << "kB/s " - << "\033[33m" << int(st1.upload_payload_rate / 1000.f) << "kB/s " - << "\033[0m" << int(st1.progress * 100) << "% " - << st1.num_peers - << ": " - << "\033[32m" << int(st2.download_payload_rate / 1000.f) << "kB/s " - << "\033[31m" << int(st2.upload_payload_rate / 1000.f) << "kB/s " - << "\033[0m" << int(st2.progress * 100) << "% " - << st2.num_peers - << " cc: " << st2.connect_candidates - << std::endl; + if (i % 10 == 0) + { + std::cerr + << "\033[32m" << int(st1.download_payload_rate / 1000.f) << "kB/s " + << "\033[33m" << int(st1.upload_payload_rate / 1000.f) << "kB/s " + << "\033[0m" << int(st1.progress * 100) << "% " + << st1.num_peers + << ": " + << "\033[32m" << int(st2.download_payload_rate / 1000.f) << "kB/s " + << "\033[31m" << int(st2.upload_payload_rate / 1000.f) << "kB/s " + << "\033[0m" << int(st2.progress * 100) << "% " + << st2.num_peers + << " cc: " << st2.connect_candidates + << std::endl; + } if (tor2.is_finished()) break;