merged RC_1_2 into master
This commit is contained in:
34
.travis.yml
34
.travis.yml
@ -6,6 +6,12 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- if: repo = arvidn/libtorrent
|
- if: repo = arvidn/libtorrent
|
||||||
env: variant=release sonar_scan=1 toolset=gcc check_headers=1
|
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
|
- env: variant=debug toolset=gcc lint=1 pylint=1 clang_tidy=1
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
@ -38,9 +44,6 @@ matrix:
|
|||||||
packages:
|
packages:
|
||||||
- ninja-build
|
- ninja-build
|
||||||
- g++-6
|
- 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
|
- env: arch=arm toolset=gcc-arm
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
@ -103,6 +106,7 @@ before_install:
|
|||||||
export B2=bjam;
|
export B2=bjam;
|
||||||
else
|
else
|
||||||
export B2=b2;
|
export B2=b2;
|
||||||
|
sysctl hw.ncpu;
|
||||||
fi'
|
fi'
|
||||||
# we have to use python from brew rather than the system provided python
|
# we have to use python from brew rather than the system provided python
|
||||||
# because of OSX System Integrity Protection, which prevents injecting
|
# because of OSX System Integrity Protection, which prevents injecting
|
||||||
@ -211,8 +215,6 @@ install:
|
|||||||
sudo chroot rootfs mount -t proc none /proc;
|
sudo chroot rootfs mount -t proc none /proc;
|
||||||
fi'
|
fi'
|
||||||
|
|
||||||
- which python2
|
|
||||||
|
|
||||||
- if [[ "$cmake" == "1" ]]; then
|
- if [[ "$cmake" == "1" ]]; then
|
||||||
which cmake;
|
which cmake;
|
||||||
cmake --version;
|
cmake --version;
|
||||||
@ -234,13 +236,13 @@ script:
|
|||||||
python3 -m flake8 --max-line-length=120;
|
python3 -m flake8 --max-line-length=120;
|
||||||
fi'
|
fi'
|
||||||
- 'if [ "$sonar_scan" == "1" ]; then
|
- '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;
|
sonar-scanner -D sonar.login=$SONAR_TOKEN;
|
||||||
fi'
|
fi'
|
||||||
- 'if [[ $clang_tidy == "1" ]]; then
|
- 'if [[ $clang_tidy == "1" ]]; then
|
||||||
which clang-tidy;
|
which clang-tidy;
|
||||||
clang-tidy --version;
|
clang-tidy --version;
|
||||||
${B2} -a -j3 clang_tidy;
|
${B2} -a -j2 clang_tidy;
|
||||||
fi'
|
fi'
|
||||||
|
|
||||||
# the common boost-build command line arguments. It's important they are all
|
# the common boost-build command line arguments. It's important they are all
|
||||||
@ -252,18 +254,18 @@ script:
|
|||||||
fi'
|
fi'
|
||||||
|
|
||||||
- 'if [ "$check_headers" == "1" ]; then
|
- 'if [ "$check_headers" == "1" ]; then
|
||||||
${B2} -j3 check-headers ${B2_ARGS};
|
${B2} -j2 check-headers ${B2_ARGS};
|
||||||
fi'
|
fi'
|
||||||
|
|
||||||
# if we are building with code coverage, report it as soon as possible
|
# if we are building with code coverage, report it as soon as possible
|
||||||
# libtorrent is the name of the test suite target
|
# libtorrent is the name of the test suite target
|
||||||
- cd $TRAVIS_BUILD_DIR/test;
|
- cd $TRAVIS_BUILD_DIR/test;
|
||||||
- 'if [ "$tests" == "1" ]; then
|
- '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} -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
|
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 &&
|
fi &&
|
||||||
if [ "$coverage" == "1" ]; then
|
if [ "$coverage" == "1" ]; then
|
||||||
codecov --root .. --gcov-exec gcov-5;
|
codecov --root .. --gcov-exec gcov-5;
|
||||||
@ -274,17 +276,17 @@ script:
|
|||||||
# rebuilding libtorrent itself.
|
# rebuilding libtorrent itself.
|
||||||
- cd $TRAVIS_BUILD_DIR/fuzzers;
|
- cd $TRAVIS_BUILD_DIR/fuzzers;
|
||||||
- 'if [ "$fuzzers" == "1" ]; then
|
- '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'
|
fi'
|
||||||
|
|
||||||
- cd $TRAVIS_BUILD_DIR/examples;
|
- cd $TRAVIS_BUILD_DIR/examples;
|
||||||
- 'if [ "$examples" == "1" ]; then
|
- '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'
|
fi'
|
||||||
|
|
||||||
- cd $TRAVIS_BUILD_DIR/tools;
|
- cd $TRAVIS_BUILD_DIR/tools;
|
||||||
- 'if [ "$tools" == "1" ]; then
|
- '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'
|
fi'
|
||||||
|
|
||||||
- cd $TRAVIS_BUILD_DIR;
|
- cd $TRAVIS_BUILD_DIR;
|
||||||
@ -297,7 +299,7 @@ script:
|
|||||||
# boost.python cannot be built with warnings-as-errors=on
|
# boost.python cannot be built with warnings-as-errors=on
|
||||||
- cd $TRAVIS_BUILD_DIR/bindings/python;
|
- cd $TRAVIS_BUILD_DIR/bindings/python;
|
||||||
- 'if [[ "$python" == "1" ]]; then
|
- '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
|
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
||||||
DYLD_LIBRARY_PATH=./dependencies python2 test.py -b;
|
DYLD_LIBRARY_PATH=./dependencies python2 test.py -b;
|
||||||
else
|
else
|
||||||
@ -322,7 +324,7 @@ script:
|
|||||||
export CXX=g++-6 &&
|
export CXX=g++-6 &&
|
||||||
export CC=gcc-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 .. &&
|
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
|
fi
|
||||||
|
|
||||||
# run through building a tarball and make sure it works
|
# run through building a tarball and make sure it works
|
||||||
|
@ -108,7 +108,7 @@ build_script:
|
|||||||
mkdir build &&
|
mkdir build &&
|
||||||
cd 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 -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:
|
test_script:
|
||||||
|
Submodule simulation/libsimulator updated: 5c03f71e44...6eb5a90019
@ -270,6 +270,7 @@ namespace {
|
|||||||
|
|
||||||
// if we're using the bittyrant choker, sort peers by their return
|
// if we're using the bittyrant choker, sort peers by their return
|
||||||
// on investment. i.e. download rate / upload rate
|
// on investment. i.e. download rate / upload rate
|
||||||
|
// TODO: use an incremental partial_sort() here
|
||||||
std::sort(peers.begin(), peers.end()
|
std::sort(peers.begin(), peers.end()
|
||||||
, [](peer_connection const* lhs, peer_connection const* rhs)
|
, [](peer_connection const* lhs, peer_connection const* rhs)
|
||||||
{ return bittyrant_unchoke_compare(lhs, rhs); } );
|
{ return bittyrant_unchoke_compare(lhs, rhs); } );
|
||||||
@ -315,7 +316,7 @@ namespace {
|
|||||||
// it purely based on the current state of our peers.
|
// it purely based on the current state of our peers.
|
||||||
upload_slots = 0;
|
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
|
// to sort the entire list
|
||||||
|
|
||||||
std::sort(peers.begin(), peers.end()
|
std::sort(peers.begin(), peers.end()
|
||||||
@ -355,7 +356,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
int const pieces = sett.get_int(settings_pack::seeding_piece_quota);
|
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()
|
+ slots, peers.end()
|
||||||
, [pieces](peer_connection const* lhs, peer_connection const* rhs)
|
, [pieces](peer_connection const* lhs, peer_connection const* rhs)
|
||||||
{ return unchoke_compare_rr(lhs, rhs, pieces); });
|
{ return unchoke_compare_rr(lhs, rhs, pieces); });
|
||||||
@ -363,7 +364,7 @@ namespace {
|
|||||||
else if (sett.get_int(settings_pack::seed_choking_algorithm)
|
else if (sett.get_int(settings_pack::seed_choking_algorithm)
|
||||||
== settings_pack::fastest_upload)
|
== settings_pack::fastest_upload)
|
||||||
{
|
{
|
||||||
std::partial_sort(peers.begin(), peers.begin()
|
std::nth_element(peers.begin(), peers.begin()
|
||||||
+ slots, peers.end()
|
+ slots, peers.end()
|
||||||
, [](peer_connection const* lhs, peer_connection const* rhs)
|
, [](peer_connection const* lhs, peer_connection const* rhs)
|
||||||
{ return unchoke_compare_fastest_upload(lhs, rhs); });
|
{ return unchoke_compare_fastest_upload(lhs, rhs); });
|
||||||
@ -371,7 +372,7 @@ namespace {
|
|||||||
else if (sett.get_int(settings_pack::seed_choking_algorithm)
|
else if (sett.get_int(settings_pack::seed_choking_algorithm)
|
||||||
== settings_pack::anti_leech)
|
== settings_pack::anti_leech)
|
||||||
{
|
{
|
||||||
std::partial_sort(peers.begin(), peers.begin()
|
std::nth_element(peers.begin(), peers.begin()
|
||||||
+ slots, peers.end()
|
+ slots, peers.end()
|
||||||
, [](peer_connection const* lhs, peer_connection const* rhs)
|
, [](peer_connection const* lhs, peer_connection const* rhs)
|
||||||
{ return unchoke_compare_anti_leech(lhs, rhs); });
|
{ return unchoke_compare_anti_leech(lhs, rhs); });
|
||||||
@ -379,7 +380,7 @@ namespace {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int const pieces = sett.get_int(settings_pack::seeding_piece_quota);
|
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()
|
+ slots, peers.end()
|
||||||
, [pieces](peer_connection const* lhs, peer_connection const* rhs)
|
, [pieces](peer_connection const* lhs, peer_connection const* rhs)
|
||||||
{ return unchoke_compare_rr(lhs, rhs, pieces); } );
|
{ return unchoke_compare_rr(lhs, rhs, pieces); } );
|
||||||
|
@ -317,7 +317,7 @@ namespace {
|
|||||||
if (internal_executor)
|
if (internal_executor)
|
||||||
{
|
{
|
||||||
// the user did not provide an executor, we have to use our own
|
// 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();
|
ios = m_io_service.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +216,7 @@ TORRENT_TEST(extensions)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void post_torrent_added(alert_manager* mgr)
|
void post_torrent_added(alert_manager* mgr)
|
||||||
@ -226,6 +227,8 @@ void post_torrent_added(alert_manager* mgr)
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
// this test is too flaky
|
||||||
|
|
||||||
TORRENT_TEST(wait_for_alert)
|
TORRENT_TEST(wait_for_alert)
|
||||||
{
|
{
|
||||||
alert_manager mgr(100, alert::all_categories);
|
alert_manager mgr(100, alert::all_categories);
|
||||||
@ -266,6 +269,7 @@ TORRENT_TEST(wait_for_alert)
|
|||||||
|
|
||||||
posting_thread.join();
|
posting_thread.join();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
TORRENT_TEST(alert_mask)
|
TORRENT_TEST(alert_mask)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +221,12 @@ void run_suite(std::string const& protocol
|
|||||||
, static_cast<void*>(h), h_errno);
|
, static_cast<void*>(h), h_errno);
|
||||||
if (h == nullptr && h_errno == HOST_NOT_FOUND)
|
if (h == nullptr && h_errno == HOST_NOT_FOUND)
|
||||||
{
|
{
|
||||||
run_test(protocol + "://non-existent-domain.se/non-existing-file", -1, -1, 0, err(), ps);
|
// 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)
|
if (ps.type != settings_pack::none)
|
||||||
stop_proxy(ps.port);
|
stop_proxy(ps.port);
|
||||||
@ -234,8 +239,15 @@ void run_suite(std::string const& protocol
|
|||||||
TORRENT_TEST(no_proxy_ssl) { run_suite("https", settings_pack::none); }
|
TORRENT_TEST(no_proxy_ssl) { run_suite("https", settings_pack::none); }
|
||||||
TORRENT_TEST(http_ssl) { run_suite("https", settings_pack::http); }
|
TORRENT_TEST(http_ssl) { run_suite("https", settings_pack::http); }
|
||||||
TORRENT_TEST(http_pw_ssl) { run_suite("https", settings_pack::http_pw); }
|
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
|
#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)
|
TORRENT_TEST(no_keepalive)
|
||||||
{
|
{
|
||||||
run_suite("http", settings_pack::none, 0);
|
run_suite("http", settings_pack::none, 0);
|
||||||
|
Reference in New Issue
Block a user