forked from premiere/premiere-libtorrent
add more logging around the test failure
This commit is contained in:
parent
376126d04d
commit
434be2bd83
|
@ -167,7 +167,7 @@ namespace libtorrent
|
||||||
l.lock();
|
l.lock();
|
||||||
--m_num_waiters;
|
--m_num_waiters;
|
||||||
}
|
}
|
||||||
|
|
||||||
void condition_variable::wait_for(mutex::scoped_lock& l, time_duration rel_time)
|
void condition_variable::wait_for(mutex::scoped_lock& l, time_duration rel_time)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(l.locked());
|
TORRENT_ASSERT(l.locked());
|
||||||
|
|
|
@ -211,23 +211,31 @@ void test_swarm(int flags)
|
||||||
alert const* ret;
|
alert const* ret;
|
||||||
while ((ret = ses1.wait_for_alert(seconds(2))))
|
while ((ret = ses1.wait_for_alert(seconds(2))))
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "wait returned: %d ms\n"
|
||||||
|
, total_milliseconds(clock_type::now() - start));
|
||||||
std::vector<alert*> alerts;
|
std::vector<alert*> alerts;
|
||||||
ses1.pop_alerts(&alerts);
|
ses1.pop_alerts(&alerts);
|
||||||
for (std::vector<alert*>::iterator i = alerts.begin()
|
for (std::vector<alert*>::iterator i = alerts.begin()
|
||||||
, end(alerts.end()); i != end; ++i)
|
, end(alerts.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
std::cerr << ret->message() << std::endl;
|
fprintf(stderr, "%s\n", ret->message().c_str());
|
||||||
}
|
}
|
||||||
start = clock_type::now();
|
start = clock_type::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "loop returned: %d ms\n"
|
||||||
|
, total_milliseconds(clock_type::now() - start));
|
||||||
|
|
||||||
// this allows shutting down the sessions in parallel
|
// this allows shutting down the sessions in parallel
|
||||||
p1 = ses1.abort();
|
p1 = ses1.abort();
|
||||||
p2 = ses2.abort();
|
p2 = ses2.abort();
|
||||||
p3 = ses3.abort();
|
p3 = ses3.abort();
|
||||||
|
|
||||||
TEST_CHECK(clock_type::now() - start < seconds(3));
|
time_point end = clock_type::now();
|
||||||
TEST_CHECK(clock_type::now() - start >= seconds(2));
|
|
||||||
|
fprintf(stderr, "time: %d ms\n", total_milliseconds(end - start));
|
||||||
|
TEST_CHECK(end - start < seconds(3));
|
||||||
|
TEST_CHECK(end - start >= seconds(2));
|
||||||
|
|
||||||
TEST_CHECK(!exists("tmp1_swarm/temporary"));
|
TEST_CHECK(!exists("tmp1_swarm/temporary"));
|
||||||
TEST_CHECK(!exists("tmp2_swarm/temporary"));
|
TEST_CHECK(!exists("tmp2_swarm/temporary"));
|
||||||
|
|
Loading…
Reference in New Issue