simplify test Jamfile by making each test its own target. Make test_lsd explicit and don't run it on travis OSX, since it can't get the socket there

This commit is contained in:
arvidn 2018-11-14 14:48:05 +01:00 committed by Arvid Norberg
parent 164982c63a
commit eda8227d80
4 changed files with 114 additions and 180 deletions

View File

@ -220,7 +220,11 @@ script:
# libtorrent is the name of the test suite target
- cd test
- 'if [ "$tests" == "1" ]; then
travis_retry bjam -j3 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant libtorrent test_natpmp enum_if -l300 &&
travis_retry bjam -j3 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant -l300 &&
travis_retry bjam -j3 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant test_natpmp enum_if -l300 &&
if [[ $TRAVIS_OS_NAME != "osx" ]]; then
travis_retry bjam -j3 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant test_lsd -l300;
fi &&
if [ "$coverage" == "1" ]; then
codecov --root .. --gcov-exec gcov-5;
fi;

View File

@ -101,8 +101,7 @@ explicit test_natpmp ;
explicit enum_if ;
explicit stage_enum_if ;
test-suite libtorrent :
[ run
run
test_primitives.cpp
test_io.cpp
test_create_torrent.cpp
@ -116,7 +115,6 @@ test-suite libtorrent :
test_ip_voter.cpp
test_sliding_average.cpp
test_socket_io.cpp
# test_random.cpp
test_part_file.cpp
test_peer_list.cpp
test_torrent_info.cpp
@ -144,85 +142,83 @@ test-suite libtorrent :
test_stack_allocator.cpp
test_file_progress.cpp
test_generate_peer_id.cpp
test_alloca.cpp ]
test_alloca.cpp ;
[ run test_listen_socket.cpp
run test_listen_socket.cpp
: : : <crypto>openssl:<library>/torrent//ssl
<crypto>openssl:<library>/torrent//crypto
]
<crypto>openssl:<library>/torrent//crypto ;
[ run test_piece_picker.cpp ]
run test_piece_picker.cpp ;
[ run test_dht.cpp
run test_dht.cpp
test_dht_storage.cpp
test_direct_dht.cpp
test_hasher512.cpp
: : : <crypto>openssl:<library>/torrent//ssl
<crypto>openssl:<library>/torrent//crypto
]
<crypto>openssl:<library>/torrent//crypto ;
[ run test_string.cpp test_utf8.cpp ]
run test_string.cpp test_utf8.cpp ;
[ run test_sha1_hash.cpp ]
[ run test_span.cpp ]
[ run test_bitfield.cpp ]
[ run test_crc32.cpp ]
[ run test_ffs.cpp ]
[ run test_ed25519.cpp ]
[ run test_gzip.cpp ]
[ run test_receive_buffer.cpp ]
[ run test_alert_manager.cpp ]
[ run test_alert_types.cpp ]
[ run test_magnet.cpp ]
[ run test_storage.cpp ]
[ run test_session.cpp ]
[ run test_session_params.cpp ]
[ run test_read_piece.cpp ]
[ run test_remove_torrent.cpp ]
[ run test_flags.cpp ]
run test_sha1_hash.cpp ;
run test_span.cpp ;
run test_bitfield.cpp ;
run test_crc32.cpp ;
run test_ffs.cpp ;
run test_ed25519.cpp ;
run test_gzip.cpp ;
run test_receive_buffer.cpp ;
run test_alert_manager.cpp ;
run test_alert_types.cpp ;
run test_magnet.cpp ;
run test_storage.cpp ;
run test_session.cpp ;
run test_session_params.cpp ;
run test_read_piece.cpp ;
run test_remove_torrent.cpp ;
run test_flags.cpp ;
[ run test_file.cpp ]
[ run test_fast_extension.cpp ]
[ run test_privacy.cpp ]
[ run test_recheck.cpp ]
[ run test_read_resume.cpp ]
[ run test_resume.cpp ]
[ run test_ssl.cpp : :
run test_file.cpp ;
run test_fast_extension.cpp ;
run test_privacy.cpp ;
run test_recheck.cpp ;
run test_read_resume.cpp ;
run test_resume.cpp ;
run test_ssl.cpp : :
: <crypto>openssl:<library>/torrent//ssl
<crypto>openssl:<library>/torrent//crypto ;
run test_tracker.cpp ;
run test_checking.cpp ;
run test_url_seed.cpp ;
run test_web_seed.cpp ;
run test_web_seed_redirect.cpp ;
run test_web_seed_socks4.cpp ;
run test_web_seed_socks5.cpp ;
run test_web_seed_socks5_no_peers.cpp ;
run test_web_seed_socks5_pw.cpp ;
run test_web_seed_http.cpp ;
run test_web_seed_http_pw.cpp ;
run test_web_seed_chunked.cpp ;
run test_web_seed_ban.cpp ;
run test_pe_crypto.cpp ;
run test_remap_files.cpp ;
run test_utp.cpp ;
run test_auto_unchoke.cpp ;
run test_http_connection.cpp : :
: <crypto>openssl:<library>/torrent//ssl
<crypto>openssl:<library>/torrent//crypto
]
[ run test_tracker.cpp ]
[ run test_checking.cpp ]
[ run test_url_seed.cpp ]
[ run test_web_seed.cpp ]
[ run test_web_seed_redirect.cpp ]
[ run test_web_seed_socks4.cpp ]
[ run test_web_seed_socks5.cpp ]
[ run test_web_seed_socks5_no_peers.cpp ]
[ run test_web_seed_socks5_pw.cpp ]
[ run test_web_seed_http.cpp ]
[ run test_web_seed_http_pw.cpp ]
[ run test_web_seed_chunked.cpp ]
[ run test_web_seed_ban.cpp ]
[ run test_pe_crypto.cpp ]
[ run test_remap_files.cpp ]
[ run test_utp.cpp ]
[ run test_auto_unchoke.cpp ]
[ run test_http_connection.cpp : :
: <crypto>openssl:<library>/torrent//ssl
<crypto>openssl:<library>/torrent//crypto
]
[ run test_torrent.cpp ]
[ run test_transfer.cpp ]
[ run test_time_critical.cpp ]
[ run test_pex.cpp ]
[ run test_priority.cpp ]
;
run test_torrent.cpp ;
run test_transfer.cpp ;
run test_time_critical.cpp ;
run test_pex.cpp ;
run test_priority.cpp ;
# turn these tests into simulations
[ run test_upnp.cpp ]
[ run test_lsd.cpp ]
;
run test_upnp.cpp ;
run test_lsd.cpp ;
explicit test_lsd ;
# these are the tests run on appveyor, while the flapping ones are being
# transitioned into simulations
@ -231,6 +227,7 @@ alias win-tests :
test_string
test_dht
test_sha1_hash
test_span
test_bitfield
test_crc32
test_pe_crypto

View File

@ -190,7 +190,6 @@ test_primitives_SOURCES = \
test_ip_voter.cpp \
test_sliding_average.cpp \
test_socket_io.cpp \
test_random.cpp \
test_utf8.cpp \
test_gzip.cpp \
test_bitfield.cpp \

View File

@ -1,66 +0,0 @@
/*
Copyright (c) 2014, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.hpp"
#include "setup_transfer.hpp"
#include "libtorrent/random.hpp"
#include <array>
using namespace lt;
TORRENT_TEST(random)
{
const int repetitions = 200000;
for (int byte = 0; byte < 4; ++byte)
{
std::array<int, 256> buckets;
buckets.fill(0);
for (int i = 0; i < repetitions; ++i)
{
std::uint32_t val = lt::random(0xffffffff);
val >>= byte * 8;
++buckets[val & 0xff];
}
for (std::size_t i = 0; i < 256; ++i)
{
const int expected = repetitions / 256;
// expect each bucket to be within 15% of the expected value
std::printf("%d: %f\n", int(i), double(buckets[i] - expected) * 100.0 / expected);
TEST_CHECK(std::abs(buckets[i] - expected) < expected / 6);
}
}
}