qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject [qpid-dispatch] branch dev-protocol-adaptors-2 updated: DISPATCH-1873: TCP echo test client prints errors to stderr
Date Tue, 08 Dec 2020 14:41:00 GMT
This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch dev-protocol-adaptors-2
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/dev-protocol-adaptors-2 by this push:
     new 0aaba5a  DISPATCH-1873: TCP echo test client prints errors to stderr
0aaba5a is described below

commit 0aaba5a5eda991f4499ebe7698b1da4adbff1f95
Author: Chuck Rolke <chug@apache.org>
AuthorDate: Tue Dec 8 09:38:38 2020 -0500

    DISPATCH-1873: TCP echo test client prints errors to stderr
    
    Fix applies only when run as main.
---
 tests/TCP_echo_client.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/TCP_echo_client.py b/tests/TCP_echo_client.py
index aa29bc9..e747896 100755
--- a/tests/TCP_echo_client.py
+++ b/tests/TCP_echo_client.py
@@ -191,6 +191,8 @@ class TcpEchoClient:
                         else:
                             # socket closed
                             self.keep_running = False
+                            if not in_list_idx == self.count:
+                                self.error = "ERROR server closed. Echoed %d of %d messages."
% (in_list_idx, self.count)
                     if self.keep_running and mask & selectors.EVENT_WRITE:
                         if out_ready_to_send:
                             n_sent = self.sock.send(payload_out[out_list_idx][out_byte_idx:])
@@ -299,10 +301,20 @@ def main(argv):
                 keep_running = False
 
     except Exception:
+        client.error = "ERROR: exception : '%s'" % traceback.format_exc()
         if logger is not None:
             logger.log("%s Exception: %s" % (prefix, traceback.format_exc()))
         retval = 1
 
+    if client.error is not None:
+        # write client errors to stderr
+        def eprint(*args, **kwargs):
+            print(*args, file=sys.stderr, **kwargs)
+
+        elines = client.error.split("\n")
+        for line in elines:
+            eprint("ERROR:", prefix, line)
+
     return retval
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message