tests don't need the default session features turned on

This commit is contained in:
Arvid Norberg 2008-12-20 23:06:06 +00:00
parent 5f74c1e754
commit 16bfde875d
11 changed files with 27 additions and 26 deletions

View File

@ -188,6 +188,7 @@ namespace aux {
, m_total_failed_bytes(0)
, m_total_redundant_bytes(0)
{
TORRENT_ASSERT(listen_interface);
error_code ec;
m_listen_interface = tcp::endpoint(address::from_string(listen_interface, ec), listen_port_range.first);
TORRENT_ASSERT(!ec);

View File

@ -16,9 +16,9 @@ void test_swarm()
{
using namespace libtorrent;
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48010, 49000));
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49010, 50000));
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50010, 51000));
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);
ses1.set_severity_level(alert::debug);
ses2.set_severity_level(alert::debug);

View File

@ -161,7 +161,7 @@ void test_reject_fast()
{
boost::intrusive_ptr<torrent_info> t = ::create_torrent();
sha1_hash ih = t->info_hash();
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000));
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000), "0.0.0.0", 0);
ses1.add_torrent(t, "./tmp1");
test_sleep(2000);
@ -225,7 +225,7 @@ void test_respect_suggest()
{
boost::intrusive_ptr<torrent_info> t = ::create_torrent();
sha1_hash ih = t->info_hash();
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000));
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000), "0.0.0.0", 0);
ses1.add_torrent(t, "./tmp1");
test_sleep(2000);

View File

@ -46,9 +46,9 @@ void test_lsd()
{
using namespace libtorrent;
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48100, 49000));
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49100, 50000));
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50100, 51000));
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);
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50100, 51000), "0.0.0.0", 0);
// this is to avoid everything finish from a single peer
// immediately. To make the swarm actually connect all

View File

@ -80,8 +80,8 @@ void test_transfer(libtorrent::pe_settings::enc_policy policy,
using namespace libtorrent;
using std::cerr;
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48800, 49000));
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49800, 50000));
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48800, 49000), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49800, 50000), "0.0.0.0", 0);
pe_settings s;
s.out_enc_policy = libtorrent::pe_settings::enabled;

View File

@ -47,9 +47,9 @@ void test_pex()
{
using namespace libtorrent;
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48200, 49000));
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49200, 50000));
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50200, 51000));
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48200, 49000), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49200, 50000), "0.0.0.0", 0);
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50200, 51000), "0.0.0.0", 0);
// this is to avoid everything finish from a single peer
// immediately. To make the swarm actually connect all

View File

@ -429,7 +429,7 @@ void test_fastresume()
entry resume;
{
session ses;
session ses(fingerprint(" ", 0,0,0,0), 0);
ses.set_alert_mask(alert::all_categories);
torrent_handle h = ses.add_torrent(boost::intrusive_ptr<torrent_info>(new torrent_info(*t))
@ -455,7 +455,7 @@ void test_fastresume()
// make sure the fast resume check fails! since we removed the file
{
session ses;
session ses(fingerprint(" ", 0,0,0,0), 0);
ses.set_alert_mask(alert::all_categories);
torrent_handle h = ses.add_torrent(t, "tmp1", resume
, storage_mode_compact);
@ -490,7 +490,7 @@ void test_rename_file_in_fastresume()
entry resume;
{
session ses;
session ses(fingerprint(" ", 0,0,0,0), 0);
ses.set_alert_mask(alert::all_categories);
torrent_handle h = ses.add_torrent(boost::intrusive_ptr<torrent_info>(new torrent_info(*t))
@ -519,7 +519,7 @@ void test_rename_file_in_fastresume()
// make sure the fast resume check succeeds, even though we renamed the file
{
session ses;
session ses(fingerprint(" ", 0,0,0,0), 0);
ses.set_alert_mask(alert::all_categories);
torrent_handle h = ses.add_torrent(t, "tmp2", resume
, storage_mode_compact);

View File

@ -53,11 +53,11 @@ void test_swarm(bool super_seeding = false, bool strict = false)
try { remove_all("./tmp2_swarm"); } catch (std::exception&) {}
try { remove_all("./tmp3_swarm"); } catch (std::exception&) {}
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48000, 49000));
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48000, 49000), "0.0.0.0", 0);
ses1.set_alert_mask(alert::all_categories & ~alert::progress_notification);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49000, 50000));
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49000, 50000), "0.0.0.0", 0);
ses2.set_alert_mask(alert::all_categories & ~alert::progress_notification);
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50000, 51000));
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50000, 51000), "0.0.0.0", 0);
ses3.set_alert_mask(alert::all_categories & ~alert::progress_notification);

View File

@ -13,7 +13,7 @@ using namespace libtorrent;
void test_running_torrent(boost::intrusive_ptr<torrent_info> info, size_type file_size)
{
session ses(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 48140));
session ses(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 48140), "0.0.0.0", 0);
ses.set_alert_mask(alert::storage_notification);
add_torrent_params p;

View File

@ -51,8 +51,8 @@ using boost::tuples::ignore;
// test the maximum transfer rate
void test_rate()
{
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48575, 49000));
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49575, 50000));
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48575, 49000), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49575, 50000), "0.0.0.0", 0);
torrent_handle tor1;
torrent_handle tor2;
@ -108,8 +108,8 @@ void print_alert(alert const& a)
void test_transfer()
{
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48075, 49000));
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49075, 50000));
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48075, 49000), "0.0.0.0", 0);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49075, 50000), "0.0.0.0", 0);
#ifndef TORRENT_DISABLE_ENCRYPTION
pe_settings pes;

View File

@ -52,7 +52,7 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file, int proxy)
{
using namespace libtorrent;
session ses;
session ses(fingerprint(" ", 0,0,0,0), 0);
session_settings settings;
settings.ignore_limits_on_local_network = false;
ses.set_settings(settings);