From f40ecac4dd4ce8bceec6f5f6f829044edc278b45 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 2 Aug 2019 07:07:52 -0700 Subject: [PATCH] improve testing on appveyor. revert appveyor image --- appveyor.yml | 2 +- test/setup_transfer.cpp | 6 +++--- test/socks.py | 16 ++++++++++------ test/web_server.py | 9 +++++++++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b38d7fe20..11bb01adb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ branches: - master - RC_1_2 - RC_1_1 -image: Visual Studio 2015 +image: Previous Visual Studio 2015 clone_depth: 1 environment: matrix: diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index c5f182819..195efc9ee 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -446,12 +446,12 @@ pid_type async_run(char const* cmdline) startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE); startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); startup.hStdError = GetStdHandle(STD_OUTPUT_HANDLE); - int ret = CreateProcessA(NULL, buf, NULL, NULL, TRUE - , CREATE_NEW_PROCESS_GROUP, NULL, NULL, &startup, &pi); + int const ret = CreateProcessA(NULL, buf, NULL, NULL, TRUE + , 0, NULL, NULL, &startup, &pi); if (ret == 0) { - int error = GetLastError(); + int const error = GetLastError(); std::printf("failed (%d) %s\n", error, error_code(error, system_category()).message().c_str()); return 0; } diff --git a/test/socks.py b/test/socks.py index 5784af3f2..91c80d737 100755 --- a/test/socks.py +++ b/test/socks.py @@ -16,18 +16,20 @@ except Exception: def debug(s): - print('socks.py: ', s, file=sys.stderr) + print('socks.py: ', s) + sys.stdout.flush() def error(s): - print('socks.py, ERROR: ', s, file=sys.stderr) + print('socks.py, ERROR: ', s) + sys.stdout.flush() class MyTCPServer(ThreadingTCPServer): allow_reuse_address = True def handle_timeout(self): - raise Exception('timeout') + raise Exception('socks.py: timeout') CLOSE = object() @@ -208,7 +210,7 @@ class SocksHandler(StreamRequestHandler): try: out_address = socket.getaddrinfo(dest_address, dest_port)[0][4] except Exception as e: - print(e) + error('%s' % e) return if cmd == UDP_ASSOCIATE: @@ -220,7 +222,7 @@ class SocksHandler(StreamRequestHandler): try: outbound_sock.connect(out_address) except Exception as e: - print(e) + error('%s' % e) return if address_type == IPV6: @@ -232,7 +234,7 @@ class SocksHandler(StreamRequestHandler): try: forward(self.request, outbound_sock, 'client') except Exception as e: - print(e) + error('%s' % e) def send_reply_v4(self, xxx_todo_changeme): (bind_addr, bind_port) = xxx_todo_changeme @@ -274,6 +276,7 @@ class SocksHandler(StreamRequestHandler): if __name__ == '__main__': + debug('starting socks.py %s' % " ".join(sys.argv)) listen_port = 8002 i = 1 while i < len(sys.argv): @@ -292,6 +295,7 @@ if __name__ == '__main__': if sys.argv[i] != '--help': debug('unknown option "%s"' % sys.argv[i]) print('usage: socks.py [--username --password ] [--port ]') + sys.stdout.flush() sys.exit(1) i += 1 diff --git a/test/web_server.py b/test/web_server.py index 7b5893a66..66b56af15 100644 --- a/test/web_server.py +++ b/test/web_server.py @@ -43,6 +43,7 @@ class http_handler(BaseHTTPRequestHandler): print('INCOMING-REQUEST: ', s.requestline) print(s.headers) + sys.stdout.flush() global chunked_encoding global keepalive @@ -55,6 +56,7 @@ class http_handler(BaseHTTPRequestHandler): file_path = os.path.normpath(s.path) print(file_path) print(s.path) + sys.stdout.flush() if s.path == '/password_protected': passed = False @@ -111,6 +113,7 @@ class http_handler(BaseHTTPRequestHandler): try: filename = os.path.normpath(s.path[1:s.path.find('seed?') + 4]) print('filename = %s' % filename) + sys.stdout.flush() f = open(filename, 'rb') f.seek(piece * 32 * 1024 + int(ranges[0])) data = f.read(int(ranges[1]) - int(ranges[0]) + 1) @@ -118,11 +121,13 @@ class http_handler(BaseHTTPRequestHandler): s.send_response(200) print('sending %d bytes' % len(data)) + sys.stdout.flush() s.send_header("Content-Length", "%d" % len(data)) s.end_headers() s.wfile.write(data) except Exception as e: print('FILE ERROR: ', filename, e) + sys.stdout.flush() s.send_response(404) s.send_header("Content-Length", "0") s.end_headers() @@ -164,6 +169,7 @@ class http_handler(BaseHTTPRequestHandler): s.request.shutdown() except Exception as e: print('Failed to shutdown read-channel of socket: ', e) + sys.stdout.flush() s.end_headers() @@ -175,15 +181,18 @@ class http_handler(BaseHTTPRequestHandler): s.wfile.write('%x\r\n' % to_send) data = f.read(to_send) print('read %d bytes' % to_send) + sys.stdout.flush() s.wfile.write(data) if chunked_encoding: s.wfile.write('\r\n') length -= to_send print('sent %d bytes (%d bytes left)' % (len(data), length)) + sys.stdout.flush() if chunked_encoding: s.wfile.write('0\r\n\r\n') except Exception as e: print('FILE ERROR: ', filename, e) + sys.stdout.flush() s.send_response(404) s.send_header("Content-Length", "0") s.end_headers()