From 76f53297a9893855e2f12695e4cd9a1082e6db6f Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 17 Nov 2019 13:33:47 +0100 Subject: [PATCH] update appveyor image and boost version. explicitly use python2 for test scripts (as the SSL behavior has changed in python 3 in non-trivial ways) --- appveyor.yml | 28 +++++++++---------- examples/Jamfile | 2 +- .../libtorrent/aux_/disable_warnings_push.hpp | 2 ++ include/libtorrent/config.hpp | 4 +-- src/storage_utils.cpp | 2 +- test/Jamfile | 6 ++-- test/http.py | 3 +- test/setup_transfer.cpp | 20 ++++++++++--- test/socks.py | 1 + test/web_server.py | 9 +++--- tools/Jamfile | 3 ++ 11 files changed, 49 insertions(+), 31 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6192aeabe..9cd351ac6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ branches: - master - RC_1_2 - RC_1_1 -image: Previous Visual Studio 2015 +image: Visual Studio 2017 clone_depth: 1 environment: matrix: @@ -38,67 +38,67 @@ install: - if not defined linkflags ( set linkflags="" ) - if not defined include ( set include="" ) - cd %ROOT_DIRECTORY% - - set BOOST_ROOT=c:\Libraries\boost_1_63_0 + - set BOOST_ROOT=c:\Libraries\boost_1_69_0 - set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build - echo %BOOST_ROOT% - echo %BOOST_BUILD_PATH% - - set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine\bin.ntx86 + - set PATH=%PATH%;%BOOST_BUILD_PATH% - ps: '"using msvc : 14.0 ;`nusing gcc : : : -std=c++11 ;`nusing python : 3.5 : c:\\Python35-x64 : c:\\Python35-x64\\include : c:\\Python35-x64\\libs ;`n" | Set-Content $env:HOMEDRIVE\$env:HOMEPATH\user-config.jam' - type %HOMEDRIVE%%HOMEPATH%\user-config.jam - cd %ROOT_DIRECTORY% - set PATH=c:\msys64\mingw32\bin;%PATH% - g++ --version + - set PATH=c:\Python27-x64;%PATH% - python --version - echo %ROOT_DIRECTORY% - - cd %BOOST_BUILD_PATH%\src\engine - - build.bat >nul + - cd %BOOST_BUILD_PATH% + - bootstrap.bat >nul - cd %ROOT_DIRECTORY% build_script: # examples - cd %ROOT_DIRECTORY%\examples - if defined bjam ( - b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% + b2.exe --abbreviate-paths openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% asserts=on export-extra=on ) # tools - cd %ROOT_DIRECTORY%\tools - if defined bjam ( - b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% + b2.exe --abbreviate-paths openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% asserts=on export-extra=on ) # test - cd %ROOT_DIRECTORY%\test - if defined bjam ( - b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% win-tests test_upnp test_natpmp testing.execute=off + b2.exe --abbreviate-paths openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% asserts=on export-extra=on testing.execute=off ) # python binding - cd %ROOT_DIRECTORY%\bindings\python # we use 64 bit python builds - if defined python ( - b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% libtorrent-link=shared stage_module stage_dependencies + b2.exe --abbreviate-paths openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% asserts=on export-extra=on libtorrent-link=shared stage_module stage_dependencies ) # simulations - cd %ROOT_DIRECTORY%\simulation - if defined sim ( - b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% debug-iterators=off picker-debugging=on invariant-checks=full test_debug %linkflags% %include% boost-link=default link=static crypto=built-in define=BOOST_ASIO_DISABLE_IOCP testing.execute=off + b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% debug-iterators=off picker-debugging=on invariant-checks=full test_debug %linkflags% %include% boost-link=default link=static crypto=built-in define=BOOST_ASIO_DISABLE_IOCP asserts=on testing.execute=off ) # minimal support for cmake build - cd %ROOT_DIRECTORY% - mkdir build && cd build - if defined cmake ( - set "PATH=c:\Python27-x64;%PATH%" && - cmake -DCMAKE_CXX_STANDARD=11 -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 14 2015 Win64" .. && + cmake -DCMAKE_CXX_STANDARD=11 -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 Win64" .. && cmake --build . --config Release -- -verbosity:minimal ) test_script: - cd %ROOT_DIRECTORY%\test - if defined bjam ( - appveyor-retry b2.exe -l400 --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% win-tests + appveyor-retry b2.exe -l500 --abbreviate-paths openssl-version=pre1.1 warnings=all warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% asserts=on export-extra=on win-tests ) - cd %ROOT_DIRECTORY%\bindings\python @@ -121,5 +121,5 @@ test_script: # certain unexpected terminations (through exceptions) - cd %ROOT_DIRECTORY%\simulation - if defined sim ( - b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% debug-iterators=off picker-debugging=on invariant-checks=full test_debug %linkflags% %include% boost-link=default link=static crypto=built-in define=BOOST_ASIO_DISABLE_IOCP + b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% debug-iterators=off picker-debugging=on invariant-checks=full test_debug %linkflags% %include% boost-link=default link=static crypto=built-in define=BOOST_ASIO_DISABLE_IOCP asserts=on ) diff --git a/examples/Jamfile b/examples/Jamfile index e969fee89..b1294c580 100644 --- a/examples/Jamfile +++ b/examples/Jamfile @@ -9,7 +9,7 @@ if $(BOOST_ROOT) use-project /boost : $(BOOST_ROOT) ; } -variant debug-mode : debug : on on on ; +variant debug-mode : debug : on on full ; project client_test : requirements diff --git a/include/libtorrent/aux_/disable_warnings_push.hpp b/include/libtorrent/aux_/disable_warnings_push.hpp index bcac96e34..bfd169175 100644 --- a/include/libtorrent/aux_/disable_warnings_push.hpp +++ b/include/libtorrent/aux_/disable_warnings_push.hpp @@ -106,4 +106,6 @@ POSSIBILITY OF SUCH DAMAGE. #pragma warning(disable : 4548) // 'conversion' conversion from 'type1' to 'type2', possible loss of data #pragma warning(disable : 4244) +// potentially uninitialized local variable '' used +#pragma warning(disable : 4701) #endif diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index e58f0f6e5..652d2914d 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -494,7 +494,7 @@ POSSIBILITY OF SUCH DAMAGE. #if !defined(TORRENT_READ_HANDLER_MAX_SIZE) # if defined _GLIBCXX_DEBUG || !defined NDEBUG -constexpr std::size_t TORRENT_READ_HANDLER_MAX_SIZE = 400; +constexpr std::size_t TORRENT_READ_HANDLER_MAX_SIZE = 432; # else // if this is not divisible by 8, we're wasting space constexpr std::size_t TORRENT_READ_HANDLER_MAX_SIZE = 342; @@ -503,7 +503,7 @@ constexpr std::size_t TORRENT_READ_HANDLER_MAX_SIZE = 342; #if !defined(TORRENT_WRITE_HANDLER_MAX_SIZE) # if defined _GLIBCXX_DEBUG || !defined NDEBUG -constexpr std::size_t TORRENT_WRITE_HANDLER_MAX_SIZE = 400; +constexpr std::size_t TORRENT_WRITE_HANDLER_MAX_SIZE = 432; # else // if this is not divisible by 8, we're wasting space constexpr std::size_t TORRENT_WRITE_HANDLER_MAX_SIZE = 342; diff --git a/src/storage_utils.cpp b/src/storage_utils.cpp index 132b2af33..8d4c1e767 100644 --- a/src/storage_utils.cpp +++ b/src/storage_utils.cpp @@ -82,7 +82,7 @@ namespace libtorrent { namespace aux { void clear_bufs(span bufs) { for (auto buf : bufs) - std::fill(buf.begin(), buf.end(), 0); + std::fill(buf.begin(), buf.end(), char(0)); } #if TORRENT_USE_ASSERTS diff --git a/test/Jamfile b/test/Jamfile index 263dcf867..b8d12f5ae 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -42,14 +42,14 @@ explicit libtorrent_test ; lib advapi32 : : Advapi32 ; +variant debug-mode : debug : on on full ; + local default-build = multi shared - on - full on on - on + debug-mode ; project diff --git a/test/http.py b/test/http.py index ce21fc804..8579e2339 100755 --- a/test/http.py +++ b/test/http.py @@ -210,7 +210,7 @@ class ConnectionHandler: break -def start_server(host='localhost', port=8080, IPv6=False, timeout=100, +def start_server(host='localhost', port=8080, IPv6=False, timeout=10, handler=ConnectionHandler): if IPv6: soc_type = socket.AF_INET6 @@ -219,6 +219,7 @@ def start_server(host='localhost', port=8080, IPv6=False, timeout=100, soc = socket.socket(soc_type) soc.settimeout(120) print("PROXY - Serving on %s:%d." % (host, port)) # debug + print('python version: %s' % sys.version_info.__str__()) soc.bind((host, port)) soc.listen(0) while True: diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index 195efc9ee..fb1615f15 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -438,9 +438,9 @@ pid_type async_run(char const* cmdline) char buf[2048]; std::snprintf(buf, sizeof(buf), "%s", cmdline); + std::printf("CreateProcess %s\n", buf); PROCESS_INFORMATION pi; - STARTUPINFOA startup; - memset(&startup, 0, sizeof(startup)); + STARTUPINFOA startup{}; startup.cb = sizeof(startup); startup.dwFlags = STARTF_USESTDHANDLES; startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE); @@ -452,9 +452,21 @@ pid_type async_run(char const* cmdline) if (ret == 0) { int const error = GetLastError(); - std::printf("failed (%d) %s\n", error, error_code(error, system_category()).message().c_str()); + std::printf("ERROR: (%d) %s\n", error, error_code(error, system_category()).message().c_str()); return 0; } + + DWORD len = sizeof(buf); + if (QueryFullProcessImageNameA(pi.hProcess, PROCESS_NAME_NATIVE, buf, &len) == 0) + { + int const error = GetLastError(); + std::printf("ERROR: QueryFullProcessImageName (%d) %s\n", error + , error_code(error, system_category()).message().c_str()); + } + else + { + std::printf("launched: %s\n", buf); + } return pi.dwProcessId; #else pid_type p; @@ -478,7 +490,7 @@ pid_type async_run(char const* cmdline) int ret = posix_spawnp(&p, argv[0], nullptr, nullptr, &argv[0], nullptr); if (ret != 0) { - std::printf("failed (%d) %s\n", errno, strerror(errno)); + std::printf("ERROR (%d) %s\n", errno, strerror(errno)); return 0; } return p; diff --git a/test/socks.py b/test/socks.py index 91c80d737..9949a0ec4 100755 --- a/test/socks.py +++ b/test/socks.py @@ -277,6 +277,7 @@ class SocksHandler(StreamRequestHandler): if __name__ == '__main__': debug('starting socks.py %s' % " ".join(sys.argv)) + debug('python version: %s' % sys.version_info.__str__()) listen_port = 8002 i = 1 while i < len(sys.argv): diff --git a/test/web_server.py b/test/web_server.py index 66b56af15..57a46bc7e 100644 --- a/test/web_server.py +++ b/test/web_server.py @@ -5,6 +5,7 @@ import os import ssl import gzip import base64 +import socket # Python 3 has moved {Simple,Base}HTTPServer to http module try: @@ -165,11 +166,8 @@ class http_handler(BaseHTTPRequestHandler): s.send_header('Content-Encoding', 'gzip') if not keepalive: s.send_header("Connection", "close") - try: - s.request.shutdown() - except Exception as e: - print('Failed to shutdown read-channel of socket: ', e) - sys.stdout.flush() + if not use_ssl: + s.request.shutdown(socket.SHUT_RD) s.end_headers() @@ -204,6 +202,7 @@ if __name__ == '__main__': use_ssl = sys.argv[3] != '0' keepalive = sys.argv[4] != '0' min_interval = sys.argv[5] + print('python version: %s' % sys.version_info.__str__()) http_handler.protocol_version = 'HTTP/1.1' httpd = http_server_with_timeout(('127.0.0.1', port), http_handler) diff --git a/tools/Jamfile b/tools/Jamfile index 087384caa..0fee0b0d7 100644 --- a/tools/Jamfile +++ b/tools/Jamfile @@ -25,6 +25,8 @@ rule link_libtorrent ( properties * ) return $(result) ; } +variant debug-mode : debug : on on full ; + project tools : requirements multi @@ -36,6 +38,7 @@ project tools @link_libtorrent : default-build static + debug-mode ; exe dht : dht_put.cpp : ../ed25519/src ;