diff options
Diffstat (limited to 'py/test/Ice/faultTolerance/Client.py')
-rw-r--r-- | py/test/Ice/faultTolerance/Client.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/py/test/Ice/faultTolerance/Client.py b/py/test/Ice/faultTolerance/Client.py new file mode 100644 index 00000000000..c42a43b5919 --- /dev/null +++ b/py/test/Ice/faultTolerance/Client.py @@ -0,0 +1,63 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, Ice, AllTests + +def test(b): + if not b: + raise RuntimeError('test assertion failed') + +def usage(n): + sys.stderr.write("Usage: " + n + " port...\n") + +def run(args, communicator): + ports = [] + for arg in args[1:]: + if arg[0] == '-': + sys.stderr.write(args[0] + ": unknown option `" + arg + "'\n") + usage(args[0]) + return False + + ports.append(int(arg)) + + if len(ports) == 0: + sys.stderr.write(args[0] + ": no ports specified\n") + usage(args[0]) + return False + + try: + AllTests.allTests(communicator, ports) + except Ice.Exception, ex: + print ex + test(False) + + return True + +try: + properties = Ice.getDefaultProperties(sys.argv) + + # + # This test aborts servers, so we don't want warnings. + # + properties.setProperty('Ice.Warn.Connections', '0') + + communicator = Ice.initialize(sys.argv) + status = run(sys.argv, communicator) +except Ice.Exception, ex: + print ex + status = False + +if communicator: + try: + communicator.destroy() + except Ice.Exception, ex: + print ex + status = False + +sys.exit(not status) |