improve reliability of some of the unit tests

This commit is contained in:
arvidn 2015-06-10 01:22:01 -04:00
parent 6e68429117
commit 0d6e65ec24
13 changed files with 41 additions and 12 deletions

View File

@ -143,8 +143,6 @@ test-suite libtorrent :
test_fence.cpp test_fence.cpp
test_dos_blocker.cpp ] test_dos_blocker.cpp ]
[ run test_upnp.cpp ]
[ run test_storage.cpp ] [ run test_storage.cpp ]
[ run test_session.cpp ] [ run test_session.cpp ]
[ run test_read_piece.cpp ] [ run test_read_piece.cpp ]
@ -179,10 +177,11 @@ test-suite libtorrent :
[ run test_metadata_extension.cpp ] [ run test_metadata_extension.cpp ]
[ run test_trackers_extension.cpp ] [ run test_trackers_extension.cpp ]
[ run test_time_critical.cpp ] [ run test_time_critical.cpp ]
[ run test_lsd.cpp ]
[ run test_pex.cpp ] [ run test_pex.cpp ]
# make these test more reliable # make these test more reliable
# [ run test_upnp.cpp ]
# [ run test_lsd.cpp ]
# [ run test_priority.cpp ] # [ run test_priority.cpp ]
# [ run test_swarm.cpp ] # [ run test_swarm.cpp ]
# [ run test_super_seeding.cpp ] # [ run test_super_seeding.cpp ]

View File

@ -123,6 +123,8 @@ void test_swarm(int flags)
torrent_handle tor3; torrent_handle tor3;
add_torrent_params p; add_torrent_params p;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
if (flags & seed_mode) p.flags |= add_torrent_params::flag_seed_mode; if (flags & seed_mode) p.flags |= add_torrent_params::flag_seed_mode;
// test using piece sizes smaller than 16kB // test using piece sizes smaller than 16kB
boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, true boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, true

View File

@ -43,6 +43,8 @@ void test_remove_url(std::string url)
{ {
lt::session s; lt::session s;
add_torrent_params p; add_torrent_params p;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.url = url; p.url = url;
p.save_path = "."; p.save_path = ".";
torrent_handle h = s.add_torrent(p); torrent_handle h = s.add_torrent(p);
@ -94,6 +96,8 @@ TORRENT_TEST(magnet)
// test magnet link parsing // test magnet link parsing
add_torrent_params p; add_torrent_params p;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.save_path = "."; p.save_path = ".";
error_code ec; error_code ec;
p.url = "magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd" p.url = "magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"

View File

@ -93,6 +93,8 @@ void test_read_piece(int flags)
lt::session ses(sett); lt::session ses(sett);
add_torrent_params p; add_torrent_params p;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.save_path = "tmp1_read_piece"; p.save_path = "tmp1_read_piece";
p.ti = ti; p.ti = ti;
if (flags & seed_mode) if (flags & seed_mode)

View File

@ -72,6 +72,10 @@ void test_remap_files_gather(storage_mode_t storage_mode = storage_mode_sparse)
session_proxy p2; session_proxy p2;
settings_pack sett; settings_pack sett;
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_lsd, false);
sett.set_bool(settings_pack::enable_dht, false);
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075"); sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
sett.set_int(settings_pack::alert_mask, alert_mask); sett.set_int(settings_pack::alert_mask, alert_mask);
@ -229,6 +233,10 @@ void test_remap_files_scatter(storage_mode_t storage_mode = storage_mode_sparse)
session_proxy p2; session_proxy p2;
settings_pack sett; settings_pack sett;
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_lsd, false);
sett.set_bool(settings_pack::enable_dht, false);
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075"); sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
sett.set_int(settings_pack::alert_mask, alert_mask); sett.set_int(settings_pack::alert_mask, alert_mask);
@ -367,6 +375,10 @@ void test_remap_files_prio(storage_mode_t storage_mode = storage_mode_sparse)
session_proxy p2; session_proxy p2;
settings_pack sett; settings_pack sett;
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_lsd, false);
sett.set_bool(settings_pack::enable_dht, false);
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075"); sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
sett.set_int(settings_pack::alert_mask, alert_mask); sett.set_int(settings_pack::alert_mask, alert_mask);
lt::session ses1(sett); lt::session ses1(sett);

View File

@ -678,6 +678,8 @@ void test_fastresume(std::string const& test_path)
lt::session ses(pack); lt::session ses(pack);
add_torrent_params p; add_torrent_params p;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.ti = boost::make_shared<torrent_info>(boost::cref(*t)); p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
p.save_path = combine_path(test_path, "tmp1"); p.save_path = combine_path(test_path, "tmp1");
p.storage_mode = storage_mode_compact; p.storage_mode = storage_mode_compact;

View File

@ -59,6 +59,8 @@ void test_running_torrent(boost::shared_ptr<torrent_info> info, boost::int64_t f
std::vector<boost::uint8_t> zeroes; std::vector<boost::uint8_t> zeroes;
zeroes.resize(1000, 0); zeroes.resize(1000, 0);
add_torrent_params p; add_torrent_params p;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.ti = info; p.ti = info;
p.save_path = "."; p.save_path = ".";

View File

@ -63,6 +63,8 @@ TORRENT_TEST(trackers_extension)
ses2.add_extension(create_lt_trackers_plugin); ses2.add_extension(create_lt_trackers_plugin);
add_torrent_params atp; add_torrent_params atp;
atp.flags &= ~add_torrent_params::flag_paused;
atp.flags &= ~add_torrent_params::flag_auto_managed;
atp.info_hash = sha1_hash("12345678901234567890"); atp.info_hash = sha1_hash("12345678901234567890");
atp.save_path = "./"; atp.save_path = "./";
error_code ec; error_code ec;

View File

@ -245,6 +245,8 @@ void test_transfer(int proxy_type, settings_pack const& sett
add_torrent_params params; add_torrent_params params;
params.storage_mode = storage_mode; params.storage_mode = storage_mode;
params.flags &= ~add_torrent_params::flag_paused;
params.flags &= ~add_torrent_params::flag_auto_managed;
wait_for_listen(ses1, "ses1"); wait_for_listen(ses1, "ses1");
wait_for_listen(ses2, "ses2"); wait_for_listen(ses2, "ses2");

View File

@ -89,6 +89,8 @@ void test_transfer()
// for performance testing // for performance testing
add_torrent_params atp; add_torrent_params atp;
atp.flags &= ~add_torrent_params::flag_paused;
atp.flags &= ~add_torrent_params::flag_auto_managed;
// atp.storage = &disabled_storage_constructor; // atp.storage = &disabled_storage_constructor;
// test using piece sizes smaller than 16kB // test using piece sizes smaller than 16kB