summaryrefslogtreecommitdiff
path: root/demoscript/Ice/nested.py
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-08-15 13:59:55 -0230
committerDwayne Boone <dwayne@zeroc.com>2007-08-15 13:59:55 -0230
commit1d265d0027c43825a0dd9567589758713a27452c (patch)
tree207e11aba123ed504311ba5b988b79d151852704 /demoscript/Ice/nested.py
parentAdded missing file (diff)
downloadice-1d265d0027c43825a0dd9567589758713a27452c.tar.bz2
ice-1d265d0027c43825a0dd9567589758713a27452c.tar.xz
ice-1d265d0027c43825a0dd9567589758713a27452c.zip
Added expect scripts
Diffstat (limited to 'demoscript/Ice/nested.py')
-rwxr-xr-xdemoscript/Ice/nested.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/demoscript/Ice/nested.py b/demoscript/Ice/nested.py
new file mode 100755
index 00000000000..155d9818b03
--- /dev/null
+++ b/demoscript/Ice/nested.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2007 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 pexpect, sys, signal
+
+def run(client, server):
+ print "testing nested...",
+ sys.stdout.flush()
+ client.sendline('1')
+ server.expect('1')
+ client.expect('.*for exit:')
+ client.sendline('2')
+ server.expect('2')
+ client.expect('1\r{1,2}\n.*for exit:')
+ client.sendline('3')
+ server.expect('3\r{1,2}\n1')
+ client.expect('2\r{1,2}\n.*for exit:')
+ print "ok"
+
+ print "testing blocking...",
+ sys.stdout.flush()
+ client.sendline('21') # This will cause a block.
+ server.expect('\r{1,2}\n'.join(['13', '11', '9', '7', '5', '3']))
+ client.expect('\r{1,2}\n'.join(['12', '10', '8', '6', '4', '2']))
+ client.expect('TimeoutException', timeout=3000)
+ server.expect('TimeoutException', timeout=3000)
+ print "ok"
+
+ client.sendline('x')
+ client.expect(pexpect.EOF)
+ assert client.wait() == 0
+
+ server.kill(signal.SIGINT)
+ server.expect(pexpect.EOF)
+ status = server.wait()
+ assert status == 0 or status == 130 or server.signalstatus == signal.SIGINT