- Timestamp:
- Dec 18, 2019, 5:42:58 PM (15 months ago)
- Branches:
- asyncio, master, proxy-ticket
- Children:
- d5c572b
- Parents:
- 779406c
- Location:
- test/mgstest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/mgstest/http.py
r779406c r3be92d3 32 32 def __init__(self, command, host, port=None, 33 33 output_filter=None, 34 stderr_log=None, 34 35 timeout=socket._GLOBAL_DEFAULT_TIMEOUT, 35 36 blocksize=8192): … … 51 52 # and the socket back to the HTTP connection (write-only). 52 53 self._output_filter = output_filter 54 # If not None, write a copy of the subprocess' stderr to here. 55 self._stderr_log = stderr_log 53 56 # output filter thread 54 57 self._fthread = None … … 77 80 bufsize=0) 78 81 self._ethread = Thread(target=_stderr_writer, 79 args=(self._sproc.stderr, ))82 args=(self._sproc.stderr, self._stderr_log)) 80 83 self._ethread.start() 81 84 self.sock = s_local … … 112 115 113 116 114 def _stderr_writer(stream ):115 """Flush incoming data to sys.stderr .117 def _stderr_writer(stream, copy=None): 118 """Flush incoming data to sys.stderr, and optionally to "copy". 116 119 117 120 This is a workaround to prevent output from gnutls-cli and the … … 119 122 logs. Forcing gnutls-cli stderr through Python ensures 120 123 synchronization (via global interpreter lock). 124 121 125 """ 122 126 for line in stream: 123 127 print(line.decode(), file=sys.stderr, end='', flush=True) 128 if copy: 129 print(line.decode(), file=copy, end='') -
test/mgstest/tests.py
r779406c r3be92d3 77 77 f'description={self.description!r})') 78 78 79 def run(self, timeout=5.0 ):79 def run(self, timeout=5.0, conn_log=None): 80 80 # note: "--logfile" option requires GnuTLS version >= 3.6.7 81 81 command = ['gnutls-cli', '--logfile=/dev/stderr'] … … 87 87 conn = HTTPSubprocessConnection(command, self.host, self.port, 88 88 output_filter=filter_cert_log, 89 stderr_log=conn_log, 89 90 timeout=timeout) 90 91 elif self.transport == Transports.PLAIN: … … 370 371 371 372 372 def run_test_conf(test_config, timeout=5.0 ):373 def run_test_conf(test_config, timeout=5.0, conn_log=None): 373 374 conns = None 374 375 … … 390 391 print(f'Running test connection {i}.') 391 392 sys.stdout.flush() 392 test_conn.run(timeout=timeout )393 test_conn.run(timeout=timeout, conn_log=conn_log)
Note: See TracChangeset
for help on using the changeset viewer.