improve test logging

This commit is contained in:
Arvid Norberg 2013-06-20 05:28:42 +00:00
parent 67f631e44e
commit 208321dab0
9 changed files with 14 additions and 11 deletions

View File

@ -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) << "% "

View File

@ -45,7 +45,8 @@ namespace libtorrent
std::auto_ptr<libtorrent::alert> 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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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;