merged RC_1_2 into master

This commit is contained in:
arvidn
2019-11-21 09:27:17 +01:00
parent 20f1bc2867
commit c05a815319
7 changed files with 44 additions and 25 deletions

View File

@ -6,6 +6,12 @@ matrix:
include:
- if: repo = arvidn/libtorrent
env: variant=release sonar_scan=1 toolset=gcc check_headers=1
- env: variant=test_debug crypto=openssl tests=1 examples=1 tools=1 toolset=darwin
os: osx
osx_image: xcode11.2
- env: variant=test_debug crypto=openssl docs=1 python=1 toolset=darwin ios=1
os: osx
osx_image: xcode11.2
- env: variant=debug toolset=gcc lint=1 pylint=1 clang_tidy=1
addons:
apt:
@ -38,9 +44,6 @@ matrix:
packages:
- ninja-build
- g++-6
- env: variant=test_debug crypto=openssl docs=1 tests=1 examples=1 tools=1 python=1 toolset=darwin ios=1
os: osx
osx_image: xcode11.2
- env: arch=arm toolset=gcc-arm
notifications:
@ -103,6 +106,7 @@ before_install:
export B2=bjam;
else
export B2=b2;
sysctl hw.ncpu;
fi'
# we have to use python from brew rather than the system provided python
# because of OSX System Integrity Protection, which prevents injecting
@ -211,8 +215,6 @@ install:
sudo chroot rootfs mount -t proc none /proc;
fi'
- which python2
- if [[ "$cmake" == "1" ]]; then
which cmake;
cmake --version;
@ -234,13 +236,13 @@ script:
python3 -m flake8 --max-line-length=120;
fi'
- 'if [ "$sonar_scan" == "1" ]; then
build-wrapper-linux-x86-64 --out-dir bw-output ${B2} -a -j3 optimization=off crypto=$crypto deprecated-functions=off $toolset variant=$variant -l300 &&
build-wrapper-linux-x86-64 --out-dir bw-output ${B2} -a -j2 optimization=off crypto=$crypto deprecated-functions=off $toolset variant=$variant -l300 &&
sonar-scanner -D sonar.login=$SONAR_TOKEN;
fi'
- 'if [[ $clang_tidy == "1" ]]; then
which clang-tidy;
clang-tidy --version;
${B2} -a -j3 clang_tidy;
${B2} -a -j2 clang_tidy;
fi'
# the common boost-build command line arguments. It's important they are all
@ -252,18 +254,18 @@ script:
fi'
- 'if [ "$check_headers" == "1" ]; then
${B2} -j3 check-headers ${B2_ARGS};
${B2} -j2 check-headers ${B2_ARGS};
fi'
# if we are building with code coverage, report it as soon as possible
# libtorrent is the name of the test suite target
- cd $TRAVIS_BUILD_DIR/test;
- 'if [ "$tests" == "1" ]; then
${B2} -j3 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} testing.execute=off &&
${B2} -j2 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} testing.execute=off &&
travis_retry ${B2} -j3 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} -l300 &&
travis_retry ${B2} -j3 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} test_natpmp enum_if -l300 &&
travis_retry ${B2} -j2 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} test_natpmp enum_if -l300 &&
if [[ $TRAVIS_OS_NAME != "osx" ]]; then
travis_retry ${B2} -j3 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} test_lsd -l300;
travis_retry ${B2} -j2 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} test_lsd -l300;
fi &&
if [ "$coverage" == "1" ]; then
codecov --root .. --gcov-exec gcov-5;
@ -274,17 +276,17 @@ script:
# rebuilding libtorrent itself.
- cd $TRAVIS_BUILD_DIR/fuzzers;
- 'if [ "$fuzzers" == "1" ]; then
${B2} -j3 warnings-as-errors=on warnings=all ${B2_ARGS} sanitize=off fuzz=off link=shared stage;
${B2} -j2 warnings-as-errors=on warnings=all ${B2_ARGS} sanitize=off fuzz=off link=shared stage;
fi'
- cd $TRAVIS_BUILD_DIR/examples;
- 'if [ "$examples" == "1" ]; then
${B2} -j3 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} link=shared;
${B2} -j2 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} link=shared;
fi'
- cd $TRAVIS_BUILD_DIR/tools;
- 'if [ "$tools" == "1" ]; then
${B2} -j3 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} link=shared;
${B2} -j2 warnings-as-errors=on sanitize=$sanitizer mmap-disk-io=$mmap warnings=all ${B2_ARGS} link=shared;
fi'
- cd $TRAVIS_BUILD_DIR;
@ -297,7 +299,7 @@ script:
# boost.python cannot be built with warnings-as-errors=on
- cd $TRAVIS_BUILD_DIR/bindings/python;
- 'if [[ "$python" == "1" ]]; then
${B2} -j3 warnings=all sanitize=$sanitizer mmap-disk-io=$mmap ${B2_ARGS} stage_module stage_dependencies libtorrent-link=shared boost-link=shared &&
${B2} -j2 warnings=all sanitize=$sanitizer mmap-disk-io=$mmap ${B2_ARGS} stage_module stage_dependencies libtorrent-link=shared boost-link=shared &&
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
DYLD_LIBRARY_PATH=./dependencies python2 test.py -b;
else
@ -322,7 +324,7 @@ script:
export CXX=g++-6 &&
export CC=gcc-6 &&
BOOST_LIBRARYDIR=/usr/local/lib cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_CXX_STANDARD=14 -Dbuild_tests=ON -Dbuild_examples=ON -Dbuild_tools=ON -Dpython-bindings=ON -G Ninja .. &&
cmake --build . -- -j2;
cmake --build . --parallel 2;
fi
# run through building a tarball and make sure it works

View File

@ -108,7 +108,7 @@ build_script:
mkdir build &&
cd build &&
cmake -DBOOST_LIBRARYDIR=%BOOST_ROOT%\stage\lib -DCMAKE_CXX_STANDARD=14 -Dbuild_tests=ON -Dbuild_examples=ON -Dbuild_tools=ON -Dpython-bindings=%python% -Dboost-python-module-name="python" -Dskip-python-runtime-test=true -DPython_ADDITIONAL_VERSIONS="2.7" -G "Visual Studio 15 2017" -A x64 .. &&
cmake --build . --config Release -- -verbosity:minimal
cmake --build . --config Release --parallel %NUMBER_OF_PROCESSORS% -- -verbosity:minimal
)
test_script:

View File

@ -270,6 +270,7 @@ namespace {
// if we're using the bittyrant choker, sort peers by their return
// on investment. i.e. download rate / upload rate
// TODO: use an incremental partial_sort() here
std::sort(peers.begin(), peers.end()
, [](peer_connection const* lhs, peer_connection const* rhs)
{ return bittyrant_unchoke_compare(lhs, rhs); } );
@ -315,7 +316,7 @@ namespace {
// it purely based on the current state of our peers.
upload_slots = 0;
// TODO: optimize this using partial_sort or something. We don't need
// TODO: use an incremental partial_sort() here. We don't need
// to sort the entire list
std::sort(peers.begin(), peers.end()
@ -355,7 +356,7 @@ namespace {
{
int const pieces = sett.get_int(settings_pack::seeding_piece_quota);
std::partial_sort(peers.begin(), peers.begin()
std::nth_element(peers.begin(), peers.begin()
+ slots, peers.end()
, [pieces](peer_connection const* lhs, peer_connection const* rhs)
{ return unchoke_compare_rr(lhs, rhs, pieces); });
@ -363,7 +364,7 @@ namespace {
else if (sett.get_int(settings_pack::seed_choking_algorithm)
== settings_pack::fastest_upload)
{
std::partial_sort(peers.begin(), peers.begin()
std::nth_element(peers.begin(), peers.begin()
+ slots, peers.end()
, [](peer_connection const* lhs, peer_connection const* rhs)
{ return unchoke_compare_fastest_upload(lhs, rhs); });
@ -371,7 +372,7 @@ namespace {
else if (sett.get_int(settings_pack::seed_choking_algorithm)
== settings_pack::anti_leech)
{
std::partial_sort(peers.begin(), peers.begin()
std::nth_element(peers.begin(), peers.begin()
+ slots, peers.end()
, [](peer_connection const* lhs, peer_connection const* rhs)
{ return unchoke_compare_anti_leech(lhs, rhs); });
@ -379,7 +380,7 @@ namespace {
else
{
int const pieces = sett.get_int(settings_pack::seeding_piece_quota);
std::partial_sort(peers.begin(), peers.begin()
std::nth_element(peers.begin(), peers.begin()
+ slots, peers.end()
, [pieces](peer_connection const* lhs, peer_connection const* rhs)
{ return unchoke_compare_rr(lhs, rhs, pieces); } );

View File

@ -317,7 +317,7 @@ namespace {
if (internal_executor)
{
// the user did not provide an executor, we have to use our own
m_io_service = std::make_shared<io_context>();
m_io_service = std::make_shared<io_context>(1);
ios = m_io_service.get();
}

View File

@ -216,6 +216,7 @@ TORRENT_TEST(extensions)
#endif
}
/*
namespace {
void post_torrent_added(alert_manager* mgr)
@ -226,6 +227,8 @@ void post_torrent_added(alert_manager* mgr)
} // anonymous namespace
// this test is too flaky
TORRENT_TEST(wait_for_alert)
{
alert_manager mgr(100, alert::all_categories);
@ -266,6 +269,7 @@ TORRENT_TEST(wait_for_alert)
posting_thread.join();
}
*/
TORRENT_TEST(alert_mask)
{

View File

@ -221,6 +221,11 @@ void run_suite(std::string const& protocol
, static_cast<void*>(h), h_errno);
if (h == nullptr && h_errno == HOST_NOT_FOUND)
{
// if we have a proxy, we'll be able to connect to it, we will just get an
// error from the proxy saying it failed to connect to the final target
if (protocol == "http" && (ps.type == settings_pack::http || ps.type == settings_pack::http_pw))
run_test(protocol + "://non-existent-domain.se/non-existing-file", -1, -1, 1, err(), ps);
else
run_test(protocol + "://non-existent-domain.se/non-existing-file", -1, -1, 0, err(), ps);
}
if (ps.type != settings_pack::none)
@ -234,8 +239,15 @@ void run_suite(std::string const& protocol
TORRENT_TEST(no_proxy_ssl) { run_suite("https", settings_pack::none); }
TORRENT_TEST(http_ssl) { run_suite("https", settings_pack::http); }
TORRENT_TEST(http_pw_ssl) { run_suite("https", settings_pack::http_pw); }
TORRENT_TEST(socks5_proxy_ssl) { run_suite("https", settings_pack::socks5); }
TORRENT_TEST(socks5_pw_proxy_ssl) { run_suite("https", settings_pack::socks5_pw); }
#endif // USE_OPENSSL
TORRENT_TEST(http_proxy) { run_suite("http", settings_pack::http); }
TORRENT_TEST(http__pwproxy) { run_suite("http", settings_pack::http_pw); }
TORRENT_TEST(socks5_proxy) { run_suite("http", settings_pack::socks5); }
TORRENT_TEST(socks5_pw_proxy) { run_suite("http", settings_pack::socks5_pw); }
TORRENT_TEST(no_keepalive)
{
run_suite("http", settings_pack::none, 0);