some more unit test fixes

This commit is contained in:
Arvid Norberg 2013-09-01 18:00:01 +00:00
parent d39c55cb8d
commit 31da1eb4ae
2 changed files with 13 additions and 1 deletions

View File

@ -90,7 +90,7 @@ void test_transfer(bool clear_files, bool disconnect
test_sleep(100);
}
if (disconnect) return;
if (disconnect) goto done;
TEST_CHECK(tor2.status().has_metadata);
TEST_CHECK(tor3.status().has_metadata);
@ -109,6 +109,8 @@ void test_transfer(bool clear_files, bool disconnect
TEST_CHECK(tor2.status().is_seeding);
if (tor2.status().is_seeding) std::cerr << "done\n";
done:
// this allows shutting down the sessions in parallel
p1 = ses1.abort();
p2 = ses2.abort();

View File

@ -48,6 +48,12 @@ int test_main()
{
using namespace libtorrent;
// these are declared before the session objects
// so that they are destructed last. This enables
// the sessions to destruct in parallel
session_proxy p1;
session_proxy p2;
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 49000), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49130, 50000), "0.0.0.0", 0);
ses1.add_extension(create_lt_trackers_plugin);
@ -116,6 +122,10 @@ int test_main()
TEST_CHECK(tor1.trackers().size() == 1);
// this allows shutting down the sessions in parallel
p1 = ses1.abort();
p2 = ses2.abort();
return 0;
}