some more test fixes

This commit is contained in:
Arvid Norberg 2013-09-01 17:49:08 +00:00
parent 1c3229caa9
commit d39c55cb8d
4 changed files with 37 additions and 0 deletions

View File

@ -45,6 +45,13 @@ void test_swarm()
{
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_proxy p3;
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48010, 49000), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49010, 50000), "0.0.0.0", 0);
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50010, 51000), "0.0.0.0", 0);
@ -114,6 +121,11 @@ void test_swarm()
ses1.remove_torrent(tor1, session::delete_files);
ses2.remove_torrent(tor2, session::delete_files);
ses3.remove_torrent(tor3, session::delete_files);
// this allows shutting down the sessions in parallel
p1 = ses1.abort();
p2 = ses2.abort();
p3 = ses3.abort();
}
int test_main()

View File

@ -44,6 +44,12 @@ void test_lsd()
{
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(48100, 49000), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49100, 50000), "0.0.0.0", 0);
@ -78,6 +84,10 @@ void test_lsd()
TEST_CHECK(tor2.status().is_seeding);
if (tor2.status().is_seeding) std::cerr << "done\n";
// this allows shutting down the sessions in parallel
p1 = ses1.abort();
p2 = ses2.abort();
}
int test_main()

View File

@ -52,6 +52,9 @@ int test_main()
& ~alert::progress_notification
& ~alert::stats_notification;
session_proxy p1;
session_proxy p2;
session* s = new libtorrent::session(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48875, 49800), "0.0.0.0", 0, alert_mask);
session_settings sett;
@ -92,6 +95,7 @@ int test_main()
TEST_EQUAL(g_udp_tracker_requests, prev_udp_announces + 1);
TEST_EQUAL(g_http_tracker_requests, prev_http_announces + 1);
p1 = s->abort();
fprintf(stderr, "destructing session\n");
delete s;
fprintf(stderr, "done\n");
@ -157,6 +161,7 @@ int test_main()
TEST_EQUAL(g_udp_tracker_requests, prev_udp_announces + 1);
TEST_EQUAL(g_http_tracker_requests, prev_http_announces);
p2 = s->abort();
fprintf(stderr, "destructing session\n");
delete s;
fprintf(stderr, "done\n");

View File

@ -56,6 +56,12 @@ void test_transfer()
remove_all("./tmp1_utp", ec);
remove_all("./tmp2_utp", ec);
// 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(48885, 49930), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49885, 50930), "0.0.0.0", 0);
@ -126,6 +132,10 @@ void test_transfer()
TEST_CHECK(tor1.status().is_finished);
TEST_CHECK(tor2.status().is_finished);
// this allows shutting down the sessions in parallel
p1 = ses1.abort();
p2 = ses2.abort();
}
int test_main()