[qpid-dispatch] branch master updated: DISPATCH-1922 Use check_output from Python std lib (#1066)
This is an automated email from the ASF dual-hosted git repository. jdanek pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git The following commit(s) were added to refs/heads/master by this push: new 341e39e DISPATCH-1922 Use check_output from Python std lib (#1066) 341e39e is described below commit 341e39e5442f513fc25f3995e7ded1dd41cf4f09 Author: Jiri Daněk AuthorDate: Mon Mar 8 19:02:20 2021 +0100 DISPATCH-1922 Use check_output from Python std lib (#1066) --- docs/man/help2txt.py | 27 --- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/docs/man/help2txt.py b/docs/man/help2txt.py index 41595a6..5a0509f 100644 --- a/docs/man/help2txt.py +++ b/docs/man/help2txt.py @@ -25,9 +25,8 @@ from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import -from subprocess import Popen, PIPE, CalledProcessError - import re +import subprocess import sys IS_PY2 = sys.version_info[0] == 2 @@ -37,29 +36,11 @@ else: PY_STRING_TYPE = str -def check_output(args, stdin=None, stderr=None, shell=False, universal_newlines=False, **kwargs): -""" -Run command args and return its output as a byte string. -kwargs are passed through to L{subprocess.Popen} -@return: stdout of command (mixed with stderr if stderr=STDOUT) -@raise L{CalledProcessError}: If command returns non-0 exit status. -""" -if "stdout" in kwargs: -raise ValueError("Must not specify stdout in check_output") -p = Popen(args, stdout=PIPE, stdin=stdin, stderr=stderr, shell=shell, universal_newlines=universal_newlines, **kwargs) -out, err = p.communicate() -if p.returncode: -e = CalledProcessError(p.returncode, args) -e.output = err or out -raise e -return out - - def help2txt(help_out): VALUE = r"(?:[\w-]+|<[^>]+>)" DEFAULT = r"(?: +\([^)]+\))?" OPTION = r"-[\w-]+(?:[ =]%s)?%s" % (VALUE, DEFAULT) # -opt[(=| )value][(default)] -OPTIONS = r"%s(?:, *%s)*" % (OPTION, OPTION)# opt[,opt...] +OPTIONS = r"%s(?:, *%s)*" % (OPTION, OPTION) # opt[,opt...] HELP = r"(?:[ \t]+\w.*$)|(?:(?:\n[ \t]+[^-\s].*$)+)" # same line or following lines indented. OPT_HELP = r"^\s+(%s)(%s)" % (OPTIONS, HELP) SUBHEAD = r"^((?: +\w+)*):$" @@ -69,7 +50,7 @@ def help2txt(help_out): help_out = help_out.decode() options = re.search("^Options:$", help_out, re.IGNORECASE | re.MULTILINE) -if (options): +if options: help_out = help_out[options.end():] result = "" @@ -89,7 +70,7 @@ def main(argv): raise ValueError("Wrong number of arguments\nUsage %s" " [args,...]" % argv[0]) program = argv[1:] -print(help2txt(check_output(program))) +print(help2txt(subprocess.check_output(program))) if __name__ == "__main__": - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-dispatch] branch master updated: DISPATCH-1981: TCP self test to force Q2 flow control
This is an automated email from the ASF dual-hosted git repository. chug pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git The following commit(s) were added to refs/heads/master by this push: new 4439fea DISPATCH-1981: TCP self test to force Q2 flow control 4439fea is described below commit 4439fea1fbcfcffb2a2d6657bcd13e4d6ec96bad Author: Chuck Rolke AuthorDate: Mon Mar 8 11:29:10 2021 -0500 DISPATCH-1981: TCP self test to force Q2 flow control The echo server is rewritten to generate Q2 holdoff more reliably. The self test uses the connection-stall feature of the the echo server. The server does not read the message content, beyond normal TCP window and python prefetch, so that the router gets into a Q2 block state. This closes #1060 --- tests/TCP_echo_server.py | 56 -- tests/system_tests_tcp_adaptor.py | 227 -- 2 files changed, 263 insertions(+), 20 deletions(-) diff --git a/tests/TCP_echo_server.py b/tests/TCP_echo_server.py index 9e1a286..678132c 100755 --- a/tests/TCP_echo_server.py +++ b/tests/TCP_echo_server.py @@ -46,7 +46,6 @@ class ClientRecord(object): the inbound and outbound data list buffers for this socket's payload. """ - def __init__(self, address): self.addr = address self.inb = b'' @@ -87,7 +86,8 @@ def split_chunk_for_display(raw_bytes): class TcpEchoServer: -def __init__(self, prefix="ECHO_SERVER", port="0", echo_count=0, timeout=0.0, logger=None): +def __init__(self, prefix="ECHO_SERVER", port="0", echo_count=0, timeout=0.0, logger=None, + conn_stall=0.0, close_on_conn=False, close_on_data=False): """ Start echo server in separate thread @@ -104,6 +104,9 @@ class TcpEchoServer: self.echo_count = echo_count self.timeout = timeout self.logger = logger +self.conn_stall = conn_stall +self.close_on_conn = close_on_conn +self.close_on_data = close_on_data self.keep_running = True self.HOST = '127.0.0.1' self.is_running = False @@ -115,7 +118,11 @@ class TcpEchoServer: def run(self): """ -Run server in daemon thread +Run server in daemon thread. +A single thread runs multiple sockets through selectors. +Note that timeouts and such are done in line and processing stops for +all sockets when one socket is timing out. For the intended one-at-a-time +test cases this works but it is not general solution for all cases. :return: """ try: @@ -160,11 +167,12 @@ class TcpEchoServer: for key, mask in events: if key.data is None: if key.fileobj is self.sock: -self.do_accept(key.fileobj, sel, self.logger) +self.do_accept(key.fileobj, sel, self.logger, self.conn_stall, self.close_on_conn) else: pass # Only listener 'sock' has None in opaque data field else: -total_echoed += self.do_service(key, mask, sel, self.logger) +n_echoed = self.do_service(key, mask, sel, self.logger, self.close_on_data) +total_echoed += n_echoed if n_echoed > 0 else 0 else: pass # select timeout. probably. @@ -176,14 +184,22 @@ class TcpEchoServer: self.is_running = False -def do_accept(self, sock, sel, logger): +def do_accept(self, sock, sel, logger, conn_stall, close_on_conn): conn, addr = sock.accept() logger.log('%s Accepted connection from %s:%d' % (self.prefix, addr[0], addr[1])) +if conn_stall > 0.0: +logger.log('%s Connection from %s:%d stall start' % (self.prefix, addr[0], addr[1])) +time.sleep(conn_stall) +logger.log('%s Connection from %s:%d stall end' % (self.prefix, addr[0], addr[1])) +if close_on_conn: +logger.log('%s Connection from %s:%d closing due to close_on_conn' % (self.prefix, addr[0], addr[1])) +conn.close() +return conn.setblocking(False) events = selectors.EVENT_READ | selectors.EVENT_WRITE sel.register(conn, events, data=ClientRecord(addr)) -def do_service(self, key, mask, sel, logger): +def do_service(self, key, mask, sel, logger, close_on_data): retval = 0 sock = key.fileobj data = key.data @@ -205,6 +221,11 @@ class TcpEchoServer: return 1 if recv_data: data.outb += recv_data +if close_on_data: +logger.log('%s Connection to %s:%d closed due to close_on_data' % (se
[qpid-dispatch] branch master updated: DISPATCH-1969 Create CI job that renders Dispatch documentation (#1065)
This is an automated email from the ASF dual-hosted git repository. jdanek pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git The following commit(s) were added to refs/heads/master by this push: new 5d2172e DISPATCH-1969 Create CI job that renders Dispatch documentation (#1065) 5d2172e is described below commit 5d2172e2dbcacd476fce4e3e3aa0035c57a26d25 Author: Jiri Daněk AuthorDate: Mon Mar 8 15:02:42 2021 +0100 DISPATCH-1969 Create CI job that renders Dispatch documentation (#1065) --- .github/workflows/build.yaml | 61 1 file changed, 61 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 058a907..859daa0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -232,6 +232,67 @@ jobs: path: | **/core + docs: +name: 'Docs (${{ matrix.os }})' +runs-on: ${{ matrix.os }} +strategy: + matrix: +os: [ ubuntu-20.04 ] +buildType: [ RelWithDebInfo ] +env: + DispatchBuildDir: ${{github.workspace}}/build + InstallPrefix: ${{github.workspace}}/install + DispatchCMakeExtraArgs: > +-DCONSOLE_INSTALL=OFF +steps: + + - uses: actions/checkout@v2 + + - name: Create Build and Install directories +run: mkdir -p "${DispatchBuildDir}" "{InstallPrefix}" + + - name: Add Qpid PPA repository +if: ${{ runner.os == 'Linux' }} +# the `released` ppa does not yet have Proton 0.33.0, have to use `testing` +run: | + sudo add-apt-repository ppa:qpid/testing && sudo apt-get update + + - name: Install Linux build dependencies +if: ${{ runner.os == 'Linux' }} +run: | + sudo apt install -y libqpid-proton-proactor1-dev python3-qpid-proton libpython3-dev libwebsockets-dev libnghttp2-dev + + - name: "Workaround for: make[3]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libqpid-proton-core.so', needed by 'src/libqpid-dispatch.so'. Stop." +if: ${{ runner.os == 'Linux' }} +run: sudo ln -s /usr/lib/x86_64-linux-gnu/libqpid-proton-core.so.10 /usr/lib/x86_64-linux-gnu/libqpid-proton-core.so + + - name: Install Linux docs dependencies +if: ${{ runner.os == 'Linux' }} +run: | + sudo apt install -y asciidoc asciidoctor dblatex + + - name: qpid-dispatch cmake configure +working-directory: ${{env.DispatchBuildDir}} +run: > + cmake "${{github.workspace}}" \ +"-DCMAKE_INSTALL_PREFIX=${InstallPrefix}" \ +${DispatchCMakeExtraArgs} + + - name: CMake build for docs +run: cmake --build "${DispatchBuildDir}" -t docs + + - name: Store the rendered user-guide +uses: actions/upload-artifact@v2 +with: + name: UserGuide + path: ${{env.DispatchBuildDir}}/docs/books/user-guide + + - name: Store the rendered html man pages +uses: actions/upload-artifact@v2 +with: + name: Manpages + path: ${{env.DispatchBuildDir}}/docs/man/*.html + console-test: name: Console Tests runs-on: ubuntu-latest - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org