attempt to make test_pe_crypto pass under valgrind in reasonable time
This commit is contained in:
parent
73323e2c3d
commit
17cb5d1041
|
@ -66,9 +66,10 @@ void display_pe_settings(libtorrent::pe_settings s)
|
||||||
, s.prefer_rc4 ? "true": "false");
|
, s.prefer_rc4 ? "true": "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_transfer(libtorrent::pe_settings::enc_policy policy,
|
void test_transfer(libtorrent::pe_settings::enc_policy policy
|
||||||
libtorrent::pe_settings::enc_level level = libtorrent::pe_settings::both,
|
, int timeout
|
||||||
bool pref_rc4 = false)
|
, libtorrent::pe_settings::enc_level level = libtorrent::pe_settings::both
|
||||||
|
, bool pref_rc4 = false)
|
||||||
{
|
{
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
|
@ -110,14 +111,14 @@ void test_transfer(libtorrent::pe_settings::enc_policy policy,
|
||||||
|
|
||||||
fprintf(stderr, "waiting for transfer to complete\n");
|
fprintf(stderr, "waiting for transfer to complete\n");
|
||||||
|
|
||||||
for (int i = 0; i < 50; ++i)
|
for (int i = 0; i < timeout * 10; ++i)
|
||||||
{
|
{
|
||||||
torrent_status s = tor2.status();
|
torrent_status s = tor2.status();
|
||||||
print_alerts(ses1, "ses1");
|
print_alerts(ses1, "ses1");
|
||||||
print_alerts(ses2, "ses2");
|
print_alerts(ses2, "ses2");
|
||||||
|
|
||||||
if (s.is_seeding) break;
|
if (s.is_seeding) break;
|
||||||
test_sleep(1000);
|
test_sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CHECK(tor2.status().is_seeding);
|
TEST_CHECK(tor2.status().is_seeding);
|
||||||
|
@ -137,7 +138,11 @@ void test_transfer(libtorrent::pe_settings::enc_policy policy,
|
||||||
|
|
||||||
void test_enc_handler(libtorrent::encryption_handler* a, libtorrent::encryption_handler* b)
|
void test_enc_handler(libtorrent::encryption_handler* a, libtorrent::encryption_handler* b)
|
||||||
{
|
{
|
||||||
int repcount = 128;
|
#ifdef TORRENT_USE_VALGRIND
|
||||||
|
const int repcount = 10;
|
||||||
|
#else
|
||||||
|
const int repcount = 128;
|
||||||
|
#endif
|
||||||
for (int rep = 0; rep < repcount; ++rep)
|
for (int rep = 0; rep < repcount; ++rep)
|
||||||
{
|
{
|
||||||
std::size_t buf_len = rand() % (512 * 1024);
|
std::size_t buf_len = rand() % (512 * 1024);
|
||||||
|
@ -169,7 +174,12 @@ int test_main()
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||||
int repcount = 128;
|
|
||||||
|
#ifdef TORRENT_USE_VALGRIND
|
||||||
|
const int repcount = 10;
|
||||||
|
#else
|
||||||
|
const int repcount = 128;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int rep = 0; rep < repcount; ++rep)
|
for (int rep = 0; rep < repcount; ++rep)
|
||||||
{
|
{
|
||||||
|
@ -199,17 +209,23 @@ int test_main()
|
||||||
rc42.set_outgoing_key(&test2_key[0], 20);
|
rc42.set_outgoing_key(&test2_key[0], 20);
|
||||||
test_enc_handler(&rc41, &rc42);
|
test_enc_handler(&rc41, &rc42);
|
||||||
|
|
||||||
test_transfer(pe_settings::disabled);
|
#ifdef TORRENT_USE_VALGRIND
|
||||||
|
const int timeout = 10;
|
||||||
|
#else
|
||||||
|
const int timeout = 5;
|
||||||
|
#endif
|
||||||
|
|
||||||
test_transfer(pe_settings::forced, pe_settings::plaintext);
|
test_transfer(pe_settings::disabled, timeout);
|
||||||
test_transfer(pe_settings::forced, pe_settings::rc4);
|
|
||||||
test_transfer(pe_settings::forced, pe_settings::both, false);
|
|
||||||
test_transfer(pe_settings::forced, pe_settings::both, true);
|
|
||||||
|
|
||||||
test_transfer(pe_settings::enabled, pe_settings::plaintext);
|
test_transfer(pe_settings::forced, timeout, pe_settings::plaintext);
|
||||||
test_transfer(pe_settings::enabled, pe_settings::rc4);
|
test_transfer(pe_settings::forced, timeout, pe_settings::rc4);
|
||||||
test_transfer(pe_settings::enabled, pe_settings::both, false);
|
test_transfer(pe_settings::forced, timeout, pe_settings::both, false);
|
||||||
test_transfer(pe_settings::enabled, pe_settings::both, true);
|
test_transfer(pe_settings::forced, timeout, pe_settings::both, true);
|
||||||
|
|
||||||
|
test_transfer(pe_settings::enabled, timeout, pe_settings::plaintext);
|
||||||
|
test_transfer(pe_settings::enabled, timeout, pe_settings::rc4);
|
||||||
|
test_transfer(pe_settings::enabled, timeout, pe_settings::both, false);
|
||||||
|
test_transfer(pe_settings::enabled, timeout, pe_settings::both, true);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "PE test not run because it's disabled\n");
|
fprintf(stderr, "PE test not run because it's disabled\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue