summaryrefslogtreecommitdiff
path: root/cpp/demo/IceStorm/counter/expect.py
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/IceStorm/counter/expect.py')
-rwxr-xr-xcpp/demo/IceStorm/counter/expect.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/cpp/demo/IceStorm/counter/expect.py b/cpp/demo/IceStorm/counter/expect.py
index b47e550b8f7..e441c84025f 100755
--- a/cpp/demo/IceStorm/counter/expect.py
+++ b/cpp/demo/IceStorm/counter/expect.py
@@ -8,7 +8,7 @@
#
# **********************************************************************
-import sys, os
+import sys, os, signal
path = [ ".", "..", "../..", "../../..", "../../../.." ]
head = os.path.dirname(sys.argv[0])
@@ -16,16 +16,15 @@ if len(head) > 0:
path = [os.path.join(head, p) for p in path]
path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ]
if len(path) == 0:
- raise "can't find toplevel directory!"
+ raise RuntimeError("can't find toplevel directory!")
sys.path.append(path[0])
-from demoscript import *
-import signal
+from demoscript import Util
-print "cleaning databases...",
+sys.stdout.write("cleaning databases... ")
sys.stdout.flush()
Util.cleanDbDir("db")
-print "ok"
+print("ok")
if Util.defaultHost:
args = ' --IceBox.Service.IceStorm="IceStormService,34:createIceStorm --Ice.Config=config.service %s"' \
@@ -36,7 +35,7 @@ else:
icestorm = Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (Util.getIceBox(), args))
icestorm.expect('.* ready')
-print "testing single client...",
+sys.stdout.write("testing single client... ")
sys.stdout.flush()
server = Util.spawn('./server --Ice.PrintAdapterReady')
server.expect('.* ready')
@@ -44,27 +43,27 @@ client1 = Util.spawn('./client')
client1.expect('init: 0')
client1.sendline('i')
client1.expect('int: 1 total: 1')
-print "ok"
+print("ok")
-print "testing second client...",
+sys.stdout.write("testing second client... ")
sys.stdout.flush()
client2 = Util.spawn('./client')
client2.expect('init: 1')
client2.sendline('i')
client1.expect('int: 1 total: 2')
client2.expect('int: 1 total: 2')
-print "ok"
+print("ok")
-print "testing third client...",
+sys.stdout.write("testing third client... ")
client3 = Util.spawn('./client')
client3.expect('init: 2')
client3.sendline('d')
client1.expect('int: -1 total: 1')
client2.expect('int: -1 total: 1')
client3.expect('int: -1 total: 1')
-print "ok"
+print("ok")
-print "testing removing client...",
+sys.stdout.write("testing removing client... ")
client3.sendline('x')
client3.waitTestSuccess()
@@ -75,7 +74,7 @@ client1.sendline('x')
client1.waitTestSuccess()
client2.sendline('x')
client2.waitTestSuccess()
-print "ok"
+print("ok")
server.kill(signal.SIGINT)
server.waitTestSuccess()