From 208321dab00b942a81b99732462525b15b830ffe Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 20 Jun 2013 05:28:42 +0000 Subject: [PATCH] improve test logging --- test/setup_transfer.cpp | 4 +++- test/setup_transfer.hpp | 3 ++- test/test_auto_unchoke.cpp | 2 +- test/test_lsd.cpp | 2 +- test/test_metadata_extension.cpp | 2 +- test/test_pex.cpp | 2 +- test/test_swarm.cpp | 2 +- test/test_transfer.cpp | 6 +++--- test/test_utp.cpp | 2 +- 9 files changed, 14 insertions(+), 11 deletions(-) diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index e7911daba..20aa3ebc2 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -162,11 +162,13 @@ void wait_for_listen(libtorrent::session& ses, char const* name) } while (a); } -void print_ses_rate(libtorrent::torrent_status const* st1 +void print_ses_rate(float time + , libtorrent::torrent_status const* st1 , libtorrent::torrent_status const* st2 , libtorrent::torrent_status const* st3) { std::cerr + << time << "s " << int(st1->download_payload_rate / 1000.f) << "kB/s " << int(st1->upload_payload_rate / 1000.f) << "kB/s " << int(st1->progress * 100) << "% " diff --git a/test/setup_transfer.hpp b/test/setup_transfer.hpp index 244458eae..165cda885 100644 --- a/test/setup_transfer.hpp +++ b/test/setup_transfer.hpp @@ -45,7 +45,8 @@ namespace libtorrent std::auto_ptr wait_for_alert(libtorrent::session& ses, int type); -void print_ses_rate(libtorrent::torrent_status const* st1 +void print_ses_rate(float time + , libtorrent::torrent_status const* st1 , libtorrent::torrent_status const* st2 , libtorrent::torrent_status const* st3 = NULL); diff --git a/test/test_auto_unchoke.cpp b/test/test_auto_unchoke.cpp index 6f18a6e78..8b749f326 100644 --- a/test/test_auto_unchoke.cpp +++ b/test/test_auto_unchoke.cpp @@ -103,7 +103,7 @@ void test_swarm() torrent_status st2 = tor2.status(); torrent_status st3 = tor3.status(); - print_ses_rate(&st1, &st2, &st3); + print_ses_rate(i, &st1, &st2, &st3); test_sleep(1000); } diff --git a/test/test_lsd.cpp b/test/test_lsd.cpp index 1d0a997b0..3f103a1a4 100644 --- a/test/test_lsd.cpp +++ b/test/test_lsd.cpp @@ -69,7 +69,7 @@ void test_lsd() torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); - print_ses_rate(&st1, &st2); + print_ses_rate(i, &st1, &st2); if (st2.is_seeding /*&& st3.is_seeding*/) break; test_sleep(1000); diff --git a/test/test_metadata_extension.cpp b/test/test_metadata_extension.cpp index cc0fd979e..f67bd5f0e 100644 --- a/test/test_metadata_extension.cpp +++ b/test/test_metadata_extension.cpp @@ -94,7 +94,7 @@ void test_transfer(bool clear_files, bool disconnect torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); - print_ses_rate(&st1, &st2); + print_ses_rate(i, &st1, &st2); if (st2.is_seeding) break; test_sleep(1000); } diff --git a/test/test_pex.cpp b/test/test_pex.cpp index 126825925..b6931e610 100644 --- a/test/test_pex.cpp +++ b/test/test_pex.cpp @@ -118,7 +118,7 @@ void test_pex() st2 = tor2.status(); st3 = tor3.status(); - print_ses_rate(&st1, &st2, &st3); + print_ses_rate(i, &st1, &st2, &st3); // this is the success condition if (st1.num_peers == 2 && st2.num_peers == 2 && st3.num_peers == 2) diff --git a/test/test_swarm.cpp b/test/test_swarm.cpp index a4aa33851..7e80a8395 100644 --- a/test/test_swarm.cpp +++ b/test/test_swarm.cpp @@ -131,7 +131,7 @@ void test_swarm(bool super_seeding = false, bool strict = false, bool seed_mode ++count_dl_rates3; } - print_ses_rate(&st1, &st2, &st3); + print_ses_rate(i, &st1, &st2, &st3); if (st2.is_seeding && st3.is_seeding) break; test_sleep(1000); diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 2ea350b41..2157d44a4 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -91,7 +91,7 @@ void test_rate() torrent_status st2 = tor2.status(); if (i % 10 == 0) - print_ses_rate(&st1, &st2); + print_ses_rate(i / 10.f, &st1, &st2); if (st2.is_seeding) break; test_sleep(100); @@ -364,7 +364,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe if (i % 10 == 0) { - print_ses_rate(&st1, &st2); + print_ses_rate(i / 10.f, &st1, &st2); } if (!test_move_storage && st2.progress > 0.25f) @@ -536,7 +536,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe torrent_status st2 = tor2.status(); if (i % 10 == 0) - print_ses_rate(&st1, &st2); + print_ses_rate(i / 10.f, &st1, &st2); if (tor2.status().is_finished) break; diff --git a/test/test_utp.cpp b/test/test_utp.cpp index 95a6afdf0..b4f027e21 100644 --- a/test/test_utp.cpp +++ b/test/test_utp.cpp @@ -115,7 +115,7 @@ void test_transfer() torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); - print_ses_rate(&st1, &st2); + print_ses_rate(i / 2.f, &st1, &st2); if (st2.is_finished) break;