improve reliability of some of the unit tests
This commit is contained in:
parent
6e68429117
commit
0d6e65ec24
|
@ -5770,7 +5770,7 @@ namespace libtorrent
|
|||
state_updated();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool torrent::unchoke_peer(peer_connection& c, bool optimistic)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
@ -8297,7 +8297,7 @@ namespace libtorrent
|
|||
m_ses.alerts().emplace_alert<torrent_checked_alert>(
|
||||
get_handle());
|
||||
}
|
||||
|
||||
|
||||
// calling pause will also trigger the auto managed
|
||||
// recalculation
|
||||
// if we just got here by downloading the metadata,
|
||||
|
@ -9429,7 +9429,7 @@ namespace libtorrent
|
|||
m_web_seeds.push_back(ent);
|
||||
m_need_save_resume_data = true;
|
||||
}
|
||||
|
||||
|
||||
void torrent::set_allow_peers(bool b, bool graceful)
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
|
|
|
@ -143,8 +143,6 @@ test-suite libtorrent :
|
|||
test_fence.cpp
|
||||
test_dos_blocker.cpp ]
|
||||
|
||||
[ run test_upnp.cpp ]
|
||||
|
||||
[ run test_storage.cpp ]
|
||||
[ run test_session.cpp ]
|
||||
[ run test_read_piece.cpp ]
|
||||
|
@ -179,10 +177,11 @@ test-suite libtorrent :
|
|||
[ run test_metadata_extension.cpp ]
|
||||
[ run test_trackers_extension.cpp ]
|
||||
[ run test_time_critical.cpp ]
|
||||
[ run test_lsd.cpp ]
|
||||
[ run test_pex.cpp ]
|
||||
|
||||
# make these test more reliable
|
||||
# [ run test_upnp.cpp ]
|
||||
# [ run test_lsd.cpp ]
|
||||
# [ run test_priority.cpp ]
|
||||
# [ run test_swarm.cpp ]
|
||||
# [ run test_super_seeding.cpp ]
|
||||
|
|
|
@ -627,7 +627,7 @@ boost::shared_ptr<torrent_info> create_torrent(std::ostream* file, int piece_siz
|
|||
std::vector<char> piece(piece_size);
|
||||
for (int i = 0; i < int(piece.size()); ++i)
|
||||
piece[i] = (i % 26) + 'A';
|
||||
|
||||
|
||||
// calculate the hash for all pieces
|
||||
int num = t.num_pieces();
|
||||
sha1_hash ph = hasher(&piece[0], piece.size()).final();
|
||||
|
@ -642,7 +642,7 @@ boost::shared_ptr<torrent_info> create_torrent(std::ostream* file, int piece_siz
|
|||
total_size -= piece.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector<char> tmp;
|
||||
std::back_insert_iterator<std::vector<char> > out(tmp);
|
||||
|
||||
|
@ -770,7 +770,7 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3
|
|||
TEST_CHECK(!ses3->get_torrents().empty());
|
||||
}
|
||||
|
||||
if (use_metadata_transfer)
|
||||
if (use_metadata_transfer)
|
||||
{
|
||||
param.ti.reset();
|
||||
param.info_hash = t->info_hash();
|
||||
|
|
|
@ -78,7 +78,7 @@ EXPORT bool print_alerts(libtorrent::session& ses, char const* name
|
|||
EXPORT void wait_for_listen(libtorrent::session& ses, char const* name);
|
||||
EXPORT void wait_for_downloading(libtorrent::session& ses, char const* name);
|
||||
EXPORT void test_sleep(int millisec);
|
||||
|
||||
|
||||
EXPORT void create_random_files(std::string const& path, const int file_sizes[], int num_files);
|
||||
|
||||
EXPORT boost::shared_ptr<libtorrent::torrent_info> create_torrent(std::ostream* file = 0
|
||||
|
|
|
@ -123,6 +123,8 @@ void test_swarm(int flags)
|
|||
torrent_handle tor3;
|
||||
|
||||
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;
|
||||
// test using piece sizes smaller than 16kB
|
||||
boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, true
|
||||
|
|
|
@ -43,6 +43,8 @@ void test_remove_url(std::string url)
|
|||
{
|
||||
lt::session s;
|
||||
add_torrent_params p;
|
||||
p.flags &= ~add_torrent_params::flag_paused;
|
||||
p.flags &= ~add_torrent_params::flag_auto_managed;
|
||||
p.url = url;
|
||||
p.save_path = ".";
|
||||
torrent_handle h = s.add_torrent(p);
|
||||
|
@ -94,6 +96,8 @@ TORRENT_TEST(magnet)
|
|||
|
||||
// test magnet link parsing
|
||||
add_torrent_params p;
|
||||
p.flags &= ~add_torrent_params::flag_paused;
|
||||
p.flags &= ~add_torrent_params::flag_auto_managed;
|
||||
p.save_path = ".";
|
||||
error_code ec;
|
||||
p.url = "magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
|
||||
|
|
|
@ -93,6 +93,8 @@ void test_read_piece(int flags)
|
|||
lt::session ses(sett);
|
||||
|
||||
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.ti = ti;
|
||||
if (flags & seed_mode)
|
||||
|
|
|
@ -72,6 +72,10 @@ void test_remap_files_gather(storage_mode_t storage_mode = storage_mode_sparse)
|
|||
session_proxy p2;
|
||||
|
||||
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_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;
|
||||
|
||||
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_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;
|
||||
|
||||
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_int(settings_pack::alert_mask, alert_mask);
|
||||
lt::session ses1(sett);
|
||||
|
|
|
@ -635,7 +635,7 @@ void test_fastresume(std::string const& test_path)
|
|||
TEST_CHECK(exists(combine_path(p.save_path, "temporary")));
|
||||
if (!exists(combine_path(p.save_path, "temporary")))
|
||||
return;
|
||||
|
||||
|
||||
torrent_status s;
|
||||
for (int i = 0; i < 50; ++i)
|
||||
{
|
||||
|
@ -678,12 +678,14 @@ void test_fastresume(std::string const& test_path)
|
|||
lt::session ses(pack);
|
||||
|
||||
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.save_path = combine_path(test_path, "tmp1");
|
||||
p.storage_mode = storage_mode_compact;
|
||||
bencode(std::back_inserter(p.resume_data), resume);
|
||||
torrent_handle h = ses.add_torrent(p, ec);
|
||||
|
||||
|
||||
alert const* a = wait_for_alert(ses, fastresume_rejected_alert::alert_type
|
||||
, "ses");
|
||||
// we expect the fast resume to be rejected because the files were removed
|
||||
|
|
|
@ -59,6 +59,8 @@ void test_running_torrent(boost::shared_ptr<torrent_info> info, boost::int64_t f
|
|||
std::vector<boost::uint8_t> zeroes;
|
||||
zeroes.resize(1000, 0);
|
||||
add_torrent_params p;
|
||||
p.flags &= ~add_torrent_params::flag_paused;
|
||||
p.flags &= ~add_torrent_params::flag_auto_managed;
|
||||
p.ti = info;
|
||||
p.save_path = ".";
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@ TORRENT_TEST(trackers_extension)
|
|||
ses2.add_extension(create_lt_trackers_plugin);
|
||||
|
||||
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.save_path = "./";
|
||||
error_code ec;
|
||||
|
|
|
@ -245,6 +245,8 @@ void test_transfer(int proxy_type, settings_pack const& sett
|
|||
|
||||
add_torrent_params params;
|
||||
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(ses2, "ses2");
|
||||
|
|
|
@ -89,6 +89,8 @@ void test_transfer()
|
|||
|
||||
// for performance testing
|
||||
add_torrent_params atp;
|
||||
atp.flags &= ~add_torrent_params::flag_paused;
|
||||
atp.flags &= ~add_torrent_params::flag_auto_managed;
|
||||
// atp.storage = &disabled_storage_constructor;
|
||||
|
||||
// test using piece sizes smaller than 16kB
|
||||
|
|
Loading…
Reference in New Issue