diff options
author | Alan Conway <aconway@apache.org> | 2011-10-13 19:07:36 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2011-10-13 19:07:36 +0000 |
commit | 15b989a4d5d6a1e8902a1a74c9508390e5b28a84 (patch) | |
tree | 35c2e68f151849389f090ba046c6c19d58711b37 | |
parent | 574665b57db5d55a33c8f89d8b2d612e3f146d29 (diff) | |
download | qpid-python-15b989a4d5d6a1e8902a1a74c9508390e5b28a84.tar.gz |
QPID-2920: Improved error messages from qpid-cpp-benchmark.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-2920-active@1183029 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-x | qpid/cpp/src/tests/qpid-cpp-benchmark | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/qpid/cpp/src/tests/qpid-cpp-benchmark b/qpid/cpp/src/tests/qpid-cpp-benchmark index 5292943e5a..26283adb6c 100755 --- a/qpid/cpp/src/tests/qpid-cpp-benchmark +++ b/qpid/cpp/src/tests/qpid-cpp-benchmark @@ -94,6 +94,12 @@ class Clients: try: c.kill() except: pass +class PopenCommand(Popen): + """Like Popen but you can query for the command""" + def __init__(self, command, *args, **kwargs): + self.command = command + Popen.__init__(self, command, *args, **kwargs) + clients = Clients() def start_receive(queue, index, opts, ready_queue, broker, host): @@ -123,7 +129,7 @@ def start_receive(queue, index, opts, ready_queue, broker, host): command += ["--connection-options",opts.connection_options] if host: command = ssh_command(host, command) if opts.verbose: print "Receiver: ", command - return clients.add(Popen(command, stdout=PIPE, stderr=PIPE)) + return clients.add(PopenCommand(command, stdout=PIPE, stderr=PIPE)) def start_send(queue, opts, broker, host): address="%s;{%s}"%(queue,",".join(opts.send_option + ["create:always"])) @@ -145,7 +151,7 @@ def start_send(queue, opts, broker, host): command += ["--connection-options",opts.connection_options] if host: command = ssh_command(host, command) if opts.verbose: print "Sender: ", command - return clients.add(Popen(command, stdout=PIPE, stderr=PIPE)) + return clients.add(PopenCommand(command, stdout=PIPE, stderr=PIPE)) def error_msg(out, err): return ("\n[stdout]\n%s\n[stderr]\n%s[end]"%(out, err)) @@ -243,7 +249,8 @@ class ReadyReceiver: for r in receivers: if (r.poll() is not None): out,err=r.communicate() - raise Exception("Receiver error: %s"%error_msg(out,err)) + raise Exception("Receiver error: %s\n%s" % + (" ".join(r.command), error_msg(out,err))) raise Exception("Timed out waiting for receivers to be ready") def flatten(l): |