diff options
Diffstat (limited to 'demoscript')
30 files changed, 325 insertions, 343 deletions
diff --git a/demoscript/Freeze/bench.py b/demoscript/Freeze/bench.py index 79b1033fd13..06e35438da5 100755 --- a/demoscript/Freeze/bench.py +++ b/demoscript/Freeze/bench.py @@ -13,55 +13,55 @@ import sys def run(client, isJava=False): if isJava: client.expect('IntIntMap \\(Collections API\\)') - print "IntIntMap (Collections API):" + print("IntIntMap (Collections API):") client.expect('IntIntMap \\(Fast API\\)', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "IntIntMap (Fast API):" + print("IntIntMap (Fast API):") client.expect('IntIntMap with index \\(Collections API\\)', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "IntIntMap with index (Collections API):" + print("IntIntMap with index (Collections API):") client.expect('IntIntMap with index \\(Fast API\\)', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "IntIntMap with index (Fast API):" + print("IntIntMap with index (Fast API):") client.expect('Struct1Struct2Map', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) else: client.expect('IntIntMap') - print "IntIntMap:" + print("IntIntMap:") client.expect('IntIntMap with index', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "IntIntMap with index:" + print("IntIntMap with index:") client.expect('Struct1Struct2Map', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "Struct1Struct2Map:" + print("Struct1Struct2Map:") client.expect('Struct1Struct2Map with index', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "Struct1Struct2Map with index:" + print("Struct1Struct2Map with index:") client.expect('Struct1Class1Map', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "Struct1Class1Map:" + print("Struct1Class1Map:") client.expect('Struct1Class1Map with index', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "Struct1Class1Map with index:" + print("Struct1Class1Map with index:") client.expect('Struct1ObjectMap', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "Struct1ObjectMap:" + print("Struct1ObjectMap:") client.expect('IntIntMap \\(read test\\)', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "IntIntMap (read test):" + print("IntIntMap (read test):") client.expect('IntIntMap with index \\(read test\\)', timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) - print "IntIntMap with index (read test):" + print("IntIntMap with index (read test):") client.waitTestSuccess(timeout=200) - print "%s " % (client.before) + print("%s " % (client.before)) diff --git a/demoscript/Freeze/casino.py b/demoscript/Freeze/casino.py index 4a58a0619ac..b7cbdc8902a 100755 --- a/demoscript/Freeze/casino.py +++ b/demoscript/Freeze/casino.py @@ -11,30 +11,30 @@ import sys, demoscript, signal def run(clientStr, serverStr): - print "cleaning databases...", + sys.stdout.write("cleaning databases... ") sys.stdout.flush() demoscript.Util.cleanDbDir("db") - print "ok" + print("ok") - print "starting server...", + sys.stdout.write("starting server... ") sys.stdout.flush() server = demoscript.Util.spawn(serverStr + ' --Ice.PrintAdapterReady --Freeze.Warn.Deadlocks=0') server.expect('Casino ready') - print "ok" + print("ok") - print "starting client1...", + sys.stdout.write("starting client1... ") sys.stdout.flush() client1 = demoscript.Util.spawn(clientStr) client1.expect('Retrieve bank and players... ok') - print "ok" + print("ok") - print "starting client2...", + sys.stdout.write("starting client2... ") sys.stdout.flush() client2 = demoscript.Util.spawn(clientStr) client2.expect('Retrieve bank and players... ok') - print "ok" + print("ok") - print "gambling...", + sys.stdout.write("gambling... ") sys.stdout.flush() client1.expect('All chips accounted for\? yes\nEach player buys 3,000 chips... ok\nAll chips accounted for\? yes'); server.expect('The bank has [0-9]+ outstanding chips') @@ -48,12 +48,12 @@ def run(clientStr, serverStr): client1.expect('All chips accounted for\? yes', timeout=400) client2.expect('All chips accounted for\? yes', timeout=400) - print "ok" + print("ok") - print "shutting down...", + sys.stdout.write("shutting down... ") sys.stdout.flush() client1.waitTestSuccess() client2.waitTestSuccess() server.kill(signal.SIGINT) server.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/Freeze/library.py b/demoscript/Freeze/library.py index 9ed0fbf1357..38dc33075cb 100755 --- a/demoscript/Freeze/library.py +++ b/demoscript/Freeze/library.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys -from scripts import Expect +import Expect def dequote(s): cur = 0 @@ -38,7 +38,7 @@ def mkregexp(s): return s def run(client, server): - print "populating database... ", + sys.stdout.write("populating database... ") sys.stdout.flush() f = open("books", "r") books = [] @@ -47,16 +47,16 @@ def run(client, server): client.expect('added new book') isbn, title, author = dequote(l) books.append((isbn, title, author)) - print "ok" + print("ok") byauthor = {} for b in books: isbn, title, author = b - if not byauthor.has_key(author): + if author not in byauthor: byauthor[author] = [] byauthor[author].append(b) - print "testing isbn... ", + sys.stdout.write("testing isbn... ") sys.stdout.flush() for b in books: isbn, title, author = b @@ -67,11 +67,11 @@ def run(client, server): client.expect('authors: %s' %(author)) client.sendline('isbn 1000') client.expect('no book with that') - print "ok" + print("ok") - print "testing authors... ", + sys.stdout.write("testing authors... ") sys.stdout.flush() - for a, bl in byauthor.iteritems(): + for a, bl in byauthor.items(): client.sendline('authors "%s"' %(a)) client.expect('number of books found: ([0-9]+)') n = int(client.match.group(1)) @@ -97,9 +97,9 @@ def run(client, server): client.sendline('authors foo') client.expect('number of books found: 0') client.expect('no current book') - print "ok" + print("ok") - print "testing rent/return... ", + sys.stdout.write("testing rent/return... ") sys.stdout.flush() isbn, title, author = books[0] client.sendline('isbn %s' % (isbn)) @@ -117,9 +117,9 @@ def run(client, server): client.expect('rented:', timeout=2) except Expect.TIMEOUT: pass - print "ok" + print("ok") - print "testing remove... ", + sys.stdout.write("testing remove... ") sys.stdout.flush() isbn, title, author = books[0] client.sendline('isbn %s' % (isbn)) @@ -135,4 +135,4 @@ def run(client, server): client.sendline('exit') client.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/Freeze/phonebook.py b/demoscript/Freeze/phonebook.py index 4a5148903f0..de17c0bd504 100755 --- a/demoscript/Freeze/phonebook.py +++ b/demoscript/Freeze/phonebook.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys -from scripts import Expect +import Expect def dequote(s): cur = 0 @@ -38,7 +38,7 @@ def mkregexp(s): return s def run(client, server): - print "populating database... ", + sys.stdout.write("populating database... ") sys.stdout.flush() f = open("contacts", "r") for l in f: @@ -52,9 +52,9 @@ def run(client, server): client.expect('\n', timeout=1) except Expect.TIMEOUT: pass - print "ok" + print("ok") - print "testing...", + sys.stdout.write("testing... ") sys.stdout.flush() client.sendline('find "Doe, John"') client.expect('number of contacts found: 3') @@ -95,4 +95,4 @@ def run(client, server): client.sendline('exit') client.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/Freeze/transform.py b/demoscript/Freeze/transform.py index 0aaec65c62b..e7d6bdb4768 100755 --- a/demoscript/Freeze/transform.py +++ b/demoscript/Freeze/transform.py @@ -12,19 +12,21 @@ import sys, demoscript, time from scripts import Expect def run(createCmd, recreateCmd, readCmd, readnewCmd): - print "cleaning databases...", + sys.stdout.write("cleaning databases... ") sys.stdout.flush() demoscript.Util.cleanDbDir("db") demoscript.Util.cleanDbDir("dbnew") - print "ok" + print("ok") - print "creating database...", + sys.stdout.write("creating database... ") + sys.stdout.flush() create = demoscript.Util.spawn(createCmd) create.expect('7 contacts were successfully created or updated') create.waitTestSuccess() - print "ok" + print("ok") - print "reading database...", + sys.stdout.write("reading database... ") + sys.stdout.flush() read = demoscript.Util.spawn(readCmd) read.expect(["All contacts \(default order\)", 'arnold:\t{1,2}\(333\)333-3333 x1234', @@ -43,28 +45,32 @@ def run(createCmd, recreateCmd, readCmd, readnewCmd): 'ed:\t{1,2}\(666\)666-6666', 'don:\t{1,2}\(777\)777-7777']) read.waitTestSuccess() - print "ok" + print("ok") - print "transforming database...", + sys.stdout.write("transforming database... ") + sys.stdout.flush() transform = demoscript.Util.spawn('transformdb --old ContactData.ice --new NewContactData.ice -f transform.xml db dbnew') transform.waitTestSuccess() - print "ok" + print("ok") - print "reading new database...", + sys.stdout.write("reading new database... ") + sys.stdout.flush() readnew = demoscript.Util.spawn(readnewCmd) readnew.expect('All contacts \(default order\)') readnew.expect('All contacts \(ordered by phone number\)') readnew.expect('DbEnv \"dbnew\": contacts: DB_SECONDARY_BAD: Secondary index inconsistent with primary') readnew.waitTestSuccess(1) - print "ok" + print("ok") - print "recreating database...", + sys.stdout.write("recreating database... ") + sys.stdout.flush() recreate = demoscript.Util.spawn(recreateCmd) recreate.expect('Recreated contacts database successfully!') recreate.waitTestSuccess() - print "ok" + print("ok") - print "rereading new database...", + sys.stdout.write("rereading new database... ") + sys.stdout.flush() readnew = demoscript.Util.spawn(readnewCmd) readnew.expect(["All contacts \(default order\)", 'arnold:\t{1,2}\(333\)333-3333 x1234 arnold@gmail.com', @@ -83,4 +89,4 @@ def run(createCmd, recreateCmd, readCmd, readnewCmd): 'ed:\t{1,2}\(666\)666-6666 ed@gmail.com', 'don:\t{1,2}\(777\)777-7777 don@gmail.com',]) readnew.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/Glacier2/callback.py b/demoscript/Glacier2/callback.py index 5d006ea64de..be51729c148 100755 --- a/demoscript/Glacier2/callback.py +++ b/demoscript/Glacier2/callback.py @@ -12,7 +12,7 @@ import sys, time, signal from scripts import Expect def run(client, server, glacier2): - print "testing ", + sys.stdout.write("testing ") sys.stdout.flush() client.expect('user id:') client.sendline("foo") @@ -21,42 +21,42 @@ def run(client, server, glacier2): client.expect("==>") - print "twoway", + sys.stdout.write("twoway ") sys.stdout.flush() client.sendline('t') server.expect('initiating callback to') client.expect('received callback') glacier2.expect('_fwd/t') - print "oneway", + sys.stdout.write("oneway ") sys.stdout.flush() client.sendline('o') server.expect('initiating callback to') client.expect('received callback') glacier2.expect('_fwd/o') - print "batch", + sys.stdout.write("batch ") sys.stdout.flush() client.sendline('O') + client.sendline('O') + client.sendline('f') try: server.expect('initiating callback to', timeout=1) except Expect.TIMEOUT: pass - client.sendline('O') - client.sendline('f') glacier2.expect('_fwd/O') - print "ok" + print("ok") - print "testing override context field...", + sys.stdout.write("testing override context field... ") sys.stdout.flush() client.sendline('v') client.sendline('t') glacier2.expect('_fwd/t, _ovrd/some_value') server.expect('initiating callback to') client.expect('received callback') - print "ok" + print("ok") - print "testing fake category...", + sys.stdout.write("testing fake category... ") sys.stdout.flush() client.sendline('v') client.sendline('F') @@ -66,7 +66,7 @@ def run(client, server, glacier2): client.expect('received callback', timeout=1) except Expect.TIMEOUT: pass - print "ok" + print("ok") client.sendline('s') server.expect('shutting down...') diff --git a/demoscript/Ice/async.py b/demoscript/Ice/async.py index cf779aa04f4..8b98d0eea21 100644 --- a/demoscript/Ice/async.py +++ b/demoscript/Ice/async.py @@ -9,11 +9,10 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect +import Expect def run(client, server): - print "testing client... ", + sys.stdout.write("testing client... ") sys.stdout.flush() client.sendline('i') server.expect('Hello World!') @@ -25,9 +24,9 @@ def run(client, server): client.sendline('i') server.expect('Hello World!') server.expect('Hello World!') - print "ok" + print("ok") - print "testing shutdown... ", + sys.stdout.write("testing shutdown... ") sys.stdout.flush() client.sendline('d') client.sendline('s') @@ -36,4 +35,4 @@ def run(client, server): client.expect('RequestCanceledException') client.sendline('x') client.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/Ice/bidir.py b/demoscript/Ice/bidir.py index 09cb838c040..6cdca77fa30 100644 --- a/demoscript/Ice/bidir.py +++ b/demoscript/Ice/bidir.py @@ -9,34 +9,34 @@ # ********************************************************************** import sys, signal -from demoscript import * -from scripts import Expect +from demoscript import Util +import Expect def run(clientStr, server): - print "adding client 1... ", + sys.stdout.write("adding client 1... ") sys.stdout.flush() client1 = Util.spawn(clientStr) server.expect('adding client') client1.expect('received callback #1') - print "ok" + print("ok") - print "adding client 2... ", + sys.stdout.write("adding client 2... ") sys.stdout.flush() client2 = Util.spawn(clientStr) server.expect('adding client') client1.expect('received callback #') client2.expect('received callback #') - print "ok" + print("ok") - print "removing client 2...", + sys.stdout.write("removing client 2... ") sys.stdout.flush() client2.kill(signal.SIGINT) client2.waitTestSuccess(timeout=20) server.expect('removing client') client1.expect('received callback #') - print "ok" + print("ok") - print "removing client 1...", + sys.stdout.write("removing client 1... ") sys.stdout.flush() client1.kill(signal.SIGINT) client1.waitTestSuccess() @@ -45,4 +45,4 @@ def run(clientStr, server): server.kill(signal.SIGINT) server.waitTestSuccess(timeout=30) - print "ok" + print("ok") diff --git a/demoscript/Ice/callback.py b/demoscript/Ice/callback.py index 5e675161cec..9329fe5e362 100644 --- a/demoscript/Ice/callback.py +++ b/demoscript/Ice/callback.py @@ -9,11 +9,9 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect def run(client, server): - print "testing...", + sys.stdout.write("testing... ") sys.stdout.flush() client.sendline('t') @@ -24,7 +22,7 @@ def run(client, server): server.expect('initiating callback') client.expect('received callback') - print "ok" + print("ok") client.sendline('s') server.waitTestSuccess() diff --git a/demoscript/Ice/hello.py b/demoscript/Ice/hello.py index baa2210fc5d..990e9426f30 100644 --- a/demoscript/Ice/hello.py +++ b/demoscript/Ice/hello.py @@ -9,26 +9,25 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect +import Expect def runtests(client, server, secure): - print "testing twoway", + sys.stdout.write("testing twoway ") sys.stdout.flush() client.sendline('t') server.expect('Hello World!') - print "oneway", + sys.stdout.write("oneway ") sys.stdout.flush() client.sendline('o') server.expect('Hello World!') if not secure: - print "datagram", + sys.stdout.write("datagram ") sys.stdout.flush() client.sendline('d') server.expect('Hello World!') - print "... ok" + print("... ok") - print "testing batch oneway", + sys.stdout.write("testing batch oneway ") sys.stdout.flush() client.sendline('O') try: @@ -40,7 +39,7 @@ def runtests(client, server, secure): server.expect('Hello World!') server.expect('Hello World!') if not secure: - print "datagram", + sys.stdout.write("datagram ") sys.stdout.flush() client.sendline('D') try: @@ -51,9 +50,9 @@ def runtests(client, server, secure): client.sendline('f') server.expect('Hello World!') server.expect('Hello World!') - print "... ok" + print("... ok") - print "testing timeout...", + sys.stdout.write("testing timeout... ") sys.stdout.flush() client.sendline('T') client.sendline('P') @@ -67,12 +66,12 @@ def runtests(client, server, secure): client.sendline('t') server.expect('Hello World!') client.sendline('T') - print "ok" + print("ok") def run(client, server): runtests(client, server, False) - print "repeating tests with SSL" + print("repeating tests with SSL") client.sendline('S') diff --git a/demoscript/Ice/interleaved.py b/demoscript/Ice/interleaved.py index a31204dd1d7..98df018a653 100644 --- a/demoscript/Ice/interleaved.py +++ b/demoscript/Ice/interleaved.py @@ -9,42 +9,40 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect def runseries(client): - print "testing bytes..." + print("testing bytes...") client.expect('==> ', timeout=240) client.sendline('e') client.expect('==> ', timeout=2000) - print "echo: %s " % (client.before) + print("echo: %s " % (client.before)) - print "testing strings..." + print("testing strings...") client.sendline('2') client.expect('==> ', timeout=240) client.sendline('e') client.expect('==> ', timeout=2000) - print "echo: %s " % (client.before) + print("echo: %s " % (client.before)) - print "testing structs with string..." + print("testing structs with string...") client.sendline('3') client.expect('==> ', timeout=240) client.sendline('e') client.expect('==> ', timeout=2000) - print "echo: %s " % (client.before) + print("echo: %s " % (client.before)) - print "testing structs with two ints and double..." + print("testing structs with two ints and double...") client.sendline('4') client.expect('==> ', timeout=240) client.sendline('e') client.expect('==> ', timeout=2000) - print "echo: %s " % (client.before) + print("echo: %s " % (client.before)) def run(client, server): - print "testing with 2 outstanding requests\n" + print("testing with 2 outstanding requests\n") runseries(client) - print "testing with unlimited outstanding requests\n" + print("testing with unlimited outstanding requests\n") client.sendline('o') runseries(client) diff --git a/demoscript/Ice/invoke.py b/demoscript/Ice/invoke.py index 8120855930e..0b887c7147f 100644 --- a/demoscript/Ice/invoke.py +++ b/demoscript/Ice/invoke.py @@ -9,8 +9,7 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect +from demoscript import Util def runDemo(client, server): sys.stdout.flush() @@ -45,7 +44,8 @@ def runDemo(client, server): client.expect("Got string `hello' and class: s\\.name=green, s\\.value=green") def run(clientStr, server): - print "testing...", + sys.stdout.write("testing... ") + sys.stdout.flush() client = Util.spawn(clientStr) client.expect('==>') @@ -56,4 +56,4 @@ def run(clientStr, server): client.sendline('x') client.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/Ice/multicast.py b/demoscript/Ice/multicast.py index 65c3167ef11..970e3b5410b 100644 --- a/demoscript/Ice/multicast.py +++ b/demoscript/Ice/multicast.py @@ -9,8 +9,8 @@ # ********************************************************************** import sys, signal -from demoscript import * -from scripts import Expect +from demoscript import Util +import Expect def runClient(clientCmd, server1, server2): client = Util.spawn(clientCmd) @@ -25,7 +25,7 @@ def runClient(clientCmd, server1, server2): try: server2.expect('Hello World!', 1) received = True - except Expect.TIMEOUT, e: + except Expect.TIMEOUT as e: ex = e pass @@ -56,20 +56,20 @@ def runDemo(clientCmd, serverCmd): server2.waitTestSuccess() def run(clientCmd, serverCmd): - print "testing multicast discovery (Ipv4)...", + sys.stdout.write("testing multicast discovery (IPv4)... ") sys.stdout.flush() if serverCmd.startswith("java"): runDemo(clientCmd, "java -Djava.net.preferIPv4Stack=true Server") else: runDemo(clientCmd, serverCmd) - print "ok" + print("ok") if Util.getMapping() == "java" and Util.isWin32(): - print "skipping testing multicast discovery (IPv6) under windows...", + sys.stdout.write("skipping testing multicast discovery (IPv6) under Windows...") else: - print "testing multicast discovery (IPv6)...", + sys.stdout.write("testing multicast discovery (IPv6)... ") sys.stdout.flush() serverCmd += ' --Ice.IPv6=1 --Discover.Endpoints="udp -h \\"ff01::1:1\\" -p 10000"' clientCmd += ' --Ice.IPv6=1 --Discover.Proxy="discover:udp -h \\"ff01::1:1\\" -p 10000"' runDemo(clientCmd, serverCmd) - print "ok" + print("ok") diff --git a/demoscript/Ice/nested.py b/demoscript/Ice/nested.py index 71c24788ab4..3a21738aa5a 100644 --- a/demoscript/Ice/nested.py +++ b/demoscript/Ice/nested.py @@ -9,11 +9,9 @@ # ********************************************************************** import sys, signal -from demoscript import * -from scripts import Expect def run(client, server): - print "testing nested...", + sys.stdout.write("testing nested... ") sys.stdout.flush() client.sendline('1') server.expect('1') @@ -24,16 +22,16 @@ def run(client, server): client.sendline('3') server.expect('3\n1') client.expect('2\n.*for exit:') - print "ok" + print("ok") - print "testing blocking...", + sys.stdout.write("testing blocking... ") sys.stdout.flush() client.sendline('21') # This will cause a block. server.expect('\n'.join(['13', '11', '9', '7', '5', '3'])) client.expect('\n'.join(['12', '10', '8', '6', '4', '2'])) client.expect('TimeoutException', timeout=3000) server.expect('TimeoutException', timeout=3000) - print "ok" + print("ok") client.sendline('x') client.waitTestSuccess() diff --git a/demoscript/Ice/nrvo.py b/demoscript/Ice/nrvo.py index 7c2e3e202d2..4dc2fc0d23d 100644 --- a/demoscript/Ice/nrvo.py +++ b/demoscript/Ice/nrvo.py @@ -9,11 +9,9 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect def run(client, server): - print "testing client... ", + sys.stdout.write("testing client... ") sys.stdout.flush() client.sendline('1') client.expect('==> ', timeout=2000) @@ -24,4 +22,4 @@ def run(client, server): client.sendline('s') client.expect('==> ', timeout=2000) client.sendline('x') - print "ok" + print("ok") diff --git a/demoscript/Ice/plugin.py b/demoscript/Ice/plugin.py index e5222bbcc62..b41ff66c561 100644 --- a/demoscript/Ice/plugin.py +++ b/demoscript/Ice/plugin.py @@ -9,15 +9,13 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect def run(client, server): - print "testing...", + sys.stdout.write("testing... ") sys.stdout.flush() client.sendline('t') server.expect('PRINT: Hello World!') - print "ok" + print("ok") client.sendline('s') server.waitTestSuccess() diff --git a/demoscript/Ice/serialize.py b/demoscript/Ice/serialize.py index 85cf6840441..583bbe9cca8 100644 --- a/demoscript/Ice/serialize.py +++ b/demoscript/Ice/serialize.py @@ -9,26 +9,24 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect def runtests(client, server, secure): - print "testing greeting...", + sys.stdout.write("testing greeting... ") sys.stdout.flush() client.sendline('g') server.expect('Hello there!') client.sendline('g') server.expect('Hello there!') - print "ok" + print("ok") - print "testing null greeting...", + sys.stdout.write("testing null greeting... ") sys.stdout.flush() client.sendline('t') client.sendline('g') server.expect('Received null greeting') client.sendline('g') server.expect('Received null greeting') - print "ok" + print("ok") def run(client, server): runtests(client, server, False) diff --git a/demoscript/Ice/session.py b/demoscript/Ice/session.py index d43db35d312..f607db2dcde 100644 --- a/demoscript/Ice/session.py +++ b/demoscript/Ice/session.py @@ -9,15 +9,14 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect +from demoscript import Util def run(clientStr, server): client = Util.spawn(clientStr) client.expect('==>') client.sendline('foo') - print "testing session creation...", + sys.stdout.write("testing session creation... ") sys.stdout.flush() server.expect('The session foo is now created.') client.sendline('c') @@ -28,9 +27,9 @@ def run(clientStr, server): client.sendline('x') client.waitTestSuccess() server.expect("The session foo is now destroyed.") - print "ok" + print("ok") - print "testing session cleanup...", + sys.stdout.write("testing session cleanup... ") sys.stdout.flush() client = Util.spawn(clientStr) client.expect('==>') @@ -40,7 +39,7 @@ def run(clientStr, server): client.sendline('t') client.waitTestSuccess() server.expect("The session foo is now destroyed.\n.*The session foo has timed out.", timeout=25) - print "ok" + print("ok") client = Util.spawn(clientStr) client.expect('==>') diff --git a/demoscript/Ice/throughput.py b/demoscript/Ice/throughput.py index 4f1c14edd23..09dfdd943c7 100644 --- a/demoscript/Ice/throughput.py +++ b/demoscript/Ice/throughput.py @@ -9,43 +9,42 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect +from demoscript import Util def runseries(client): client.expect('==> ', timeout=240) client.sendline('t') client.expect('==> ', timeout=2000) - print "twoway: %s " % (client.before) + print("twoway: %s " % (client.before)) if not Util.fast: client.sendline('o') client.expect('==> ', timeout=2000) - print "oneway: %s " % (client.before) + print("oneway: %s " % (client.before)) client.sendline('r') client.expect('==> ', timeout=2000) - print "receive: %s" % (client.before) + print("receive: %s" % (client.before)) client.sendline('e') client.expect('==> ', timeout=2000) - print "echo: %s" % (client.before) + print("echo: %s" % (client.before)) def run(client, server): - print "testing bytes" + print("testing bytes") runseries(client) - print "testing strings" + print("testing strings") client.sendline('2') runseries(client) - print "testing structs with string... " + print("testing structs with string") client.sendline('3') runseries(client) - print "testing structs with two ints and double... " + print("testing structs with two ints and double") client.sendline('4') runseries(client) diff --git a/demoscript/Ice/value.py b/demoscript/Ice/value.py index bb15cae2724..4c6577696d6 100644 --- a/demoscript/Ice/value.py +++ b/demoscript/Ice/value.py @@ -9,11 +9,9 @@ # ********************************************************************** import sys -from demoscript import * -from scripts import Expect def run(client, server, ruby = False): - print "testing...", + sys.stdout.write("testing... ") sys.stdout.flush() client.expect('press enter') client.sendline('') @@ -42,7 +40,7 @@ def run(client, server, ruby = False): client.expect('==> a derived message 4 u\n==> A DERIVED MESSAGE 4 U.*press enter') client.sendline('') client.expect('==> a derived message 4 u\n==> A DERIVED MESSAGE 4 U') - print "ok" + print("ok") server.waitTestSuccess() client.waitTestSuccess() diff --git a/demoscript/IceBox/hello.py b/demoscript/IceBox/hello.py index 8c64f9c0200..6f941be8e5c 100755 --- a/demoscript/IceBox/hello.py +++ b/demoscript/IceBox/hello.py @@ -9,25 +9,25 @@ # ********************************************************************** import sys, demoscript -from scripts import Expect +import Expect def runtests(client, server, secure): - print "testing twoway", + sys.stdout.write("testing twoway ") sys.stdout.flush() client.sendline('t') server.expect('Hello World!') - print "oneway", + sys.stdout.write("oneway ") sys.stdout.flush() client.sendline('o') server.expect('Hello World!') if not secure: - print "datagram", + sys.stdout.write("datagram ") sys.stdout.flush() client.sendline('d') server.expect('Hello World!') - print "... ok" + print("... ok") - print "testing batch oneway", + sys.stdout.write("testing batch oneway ") sys.stdout.flush() client.sendline('O') try: @@ -39,7 +39,7 @@ def runtests(client, server, secure): server.expect('Hello World!') server.expect('Hello World!') if not secure: - print "datagram", + sys.stdout.write("datagram ") sys.stdout.flush() client.sendline('D') try: @@ -50,13 +50,13 @@ def runtests(client, server, secure): client.sendline('f') server.expect('Hello World!') server.expect('Hello World!') - print "... ok" + print("... ok") def run(client, server): runtests(client, server, False) if not demoscript.Util.isMono(): - print "repeating tests with SSL" + print("repeating tests with SSL") client.sendline('S') diff --git a/demoscript/IceGrid/allocate.py b/demoscript/IceGrid/allocate.py index e1a768b8cc4..ed81add183f 100755 --- a/demoscript/IceGrid/allocate.py +++ b/demoscript/IceGrid/allocate.py @@ -9,11 +9,11 @@ # ********************************************************************** import sys, os -from demoscript import * -from scripts import Expect +from demoscript import Util +import Expect def run(clientCmd): - print "cleaning databases...", + sys.stdout.write("cleaning databases... ") sys.stdout.flush() nodeDir = os.path.join("db", "node") if not os.path.exists(nodeDir): @@ -25,28 +25,28 @@ def run(clientCmd): os.mkdir(regDir) else: Util.cleanDbDir(regDir) - print "ok" + print("ok") if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' - print "starting icegridnode...", + sys.stdout.write("starting icegridnode... ") sys.stdout.flush() node = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) node.expect('IceGrid.Registry.Internal ready\nIceGrid.Registry.Server ready\nIceGrid.Registry.Client ready\nIceGrid.Node ready') - print "ok" + print("ok") - print "deploying application...", + sys.stdout.write("deploying application... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.grid') admin.expect('>>>') admin.sendline("application add \'application-single.xml\'") admin.expect('>>>') - print "ok" + print("ok") - print "testing client...", + sys.stdout.write("testing client... ") sys.stdout.flush() client1 = Util.spawn(clientCmd) client1.expect('user id:') @@ -77,15 +77,15 @@ def run(clientCmd): node.expect('detected termination of server') client2.sendline('x') client2.waitTestSuccess(timeout=1) - print "ok" + print("ok") - print "deploying multiple...", + sys.stdout.write("deploying multiple... ") sys.stdout.flush() admin.sendline("application update \'application-multiple.xml\'") admin.expect('>>>') - print "ok" + print("ok") - print "testing client...", + sys.stdout.write("testing client... ") sys.stdout.flush() client1 = Util.spawn(clientCmd) client1.expect('user id:') @@ -135,7 +135,7 @@ def run(clientCmd): client3.sendline('x') client3.waitTestSuccess(timeout=1) - print "ok" + print("ok") admin.sendline('registry shutdown Master') admin.sendline('exit') diff --git a/demoscript/IceGrid/icebox.py b/demoscript/IceGrid/icebox.py index e3cccfa572a..40de5974e36 100755 --- a/demoscript/IceGrid/icebox.py +++ b/demoscript/IceGrid/icebox.py @@ -9,11 +9,10 @@ # ********************************************************************** import sys, time, os -from demoscript import * -from scripts import Expect +from demoscript import Util def run(clientStr, desc = 'application'): - print "cleaning databases...", + sys.stdout.write("cleaning databases... ") sys.stdout.flush() nodeDir = os.path.join("db", "node") if not os.path.exists(nodeDir): @@ -25,14 +24,14 @@ def run(clientStr, desc = 'application'): os.mkdir(regDir) else: Util.cleanDbDir(regDir) - print "ok" + print("ok") if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' - print "starting icegridnode...", + sys.stdout.write("starting icegridnode... ") sys.stdout.flush() node = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) node.expect('IceGrid.Registry.Internal ready') @@ -41,9 +40,9 @@ def run(clientStr, desc = 'application'): if Util.getMapping() == "cpp": node.expect('IceGrid.Registry.AdminSessionManager ready') node.expect('IceGrid.Node ready') - print "ok" + print("ok") - print "deploying application...", + sys.stdout.write("deploying application... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.grid') admin.expect('>>>') @@ -51,19 +50,19 @@ def run(clientStr, desc = 'application'): admin.expect('>>>') admin.sendline("server start IceBox") admin.expect('>>>', timeout=15) - print "ok" + print("ok") - print "testing client...", + sys.stdout.write("testing client... ") sys.stdout.flush() for s in [ "Homer", "Marge", "Bart", "Lisa", "Maggie" ]: - client = Util.spawn(clientStr) - node.expect("Hello from %s" % s) - client.waitTestSuccess(timeout=1) + client = Util.spawn(clientStr) + node.expect("Hello from %s" % s) + client.waitTestSuccess(timeout=1) - print "ok" + print("ok") - print "testing stop/start of services...", + sys.stdout.write("testing stop/start of services... ") sys.stdout.flush() admin.sendline("service stop IceBox Lisa") @@ -78,7 +77,7 @@ def run(clientStr, desc = 'application'): client = Util.spawn(clientStr) node.expect("Hello from Marge") client.waitTestSuccess(timeout=1) - + client = Util.spawn(clientStr) node.expect("Hello from Bart") client.waitTestSuccess(timeout=1) @@ -104,7 +103,7 @@ def run(clientStr, desc = 'application'): client = Util.spawn(clientStr) node.expect("Hello from Lisa") client.waitTestSuccess(timeout=1) - + client = Util.spawn(clientStr) node.expect("Hello from Maggie") client.waitTestSuccess(timeout=1) @@ -113,9 +112,9 @@ def run(clientStr, desc = 'application'): node.expect("Hello from Bart") client.waitTestSuccess(timeout=1) - print "ok" + print("ok") - print "testing administration with Glacier2...", + sys.stdout.write("testing administration with Glacier2... ") sys.stdout.flush() admin.sendline("server start DemoGlacier2") @@ -124,13 +123,13 @@ def run(clientStr, desc = 'application'): # Windows seems to have problems with the password input. if Util.isWin32(): - admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063" -u foo -p foo') + admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063" -u foo -p foo') else: - admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063"') - admin.expect('user id:') - admin.sendline('foo') - admin.expect('password:') - admin.sendline('foo') + admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063"') + admin.expect('user id:') + admin.sendline('foo') + admin.expect('password:') + admin.sendline('foo') admin.expect('>>>', timeout=100) admin.sendline("service start IceBox Homer") @@ -158,7 +157,7 @@ def run(clientStr, desc = 'application'): node.expect("Hello from Bart") client.waitTestSuccess(timeout=1) - print "ok" + print("ok") admin.sendline('registry shutdown Master') admin.sendline('exit') diff --git a/demoscript/IceGrid/sessionActivation.py b/demoscript/IceGrid/sessionActivation.py index 81cf884e33c..d27264939aa 100755 --- a/demoscript/IceGrid/sessionActivation.py +++ b/demoscript/IceGrid/sessionActivation.py @@ -9,11 +9,10 @@ # ********************************************************************** import sys, os -from demoscript import * -from scripts import Expect +from demoscript import Util def run(clientCmd): - print "cleaning databases...", + sys.stdout.write("cleaning databases... ") sys.stdout.flush() nodeDir = os.path.join("db", "node") if not os.path.exists(nodeDir): @@ -25,28 +24,28 @@ def run(clientCmd): os.mkdir(regDir) else: Util.cleanDbDir(regDir) - print "ok" + print("ok") if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' - print "starting icegridnode...", + sys.stdout.write("starting icegridnode... ") sys.stdout.flush() node = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) node.expect('IceGrid.Registry.Internal ready\nIceGrid.Registry.Server ready\nIceGrid.Registry.Client ready\nIceGrid.Node ready') - print "ok" + print("ok") - print "deploying application...", + sys.stdout.write("deploying application... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.grid') admin.expect('>>>') admin.sendline("application add \'application.xml\'") admin.expect('>>>') - print "ok" + print("ok") - print "testing client...", + sys.stdout.write("testing client... ") sys.stdout.flush() client = Util.spawn(clientCmd) @@ -75,7 +74,7 @@ def run(clientCmd): client.waitTestSuccess(timeout=1) node.expect('detected termination of server') - print "ok" + print("ok") admin.sendline('registry shutdown Master') admin.sendline('exit') diff --git a/demoscript/IceGrid/simple.py b/demoscript/IceGrid/simple.py index 054492c6baa..dd77a818846 100755 --- a/demoscript/IceGrid/simple.py +++ b/demoscript/IceGrid/simple.py @@ -9,11 +9,10 @@ # ********************************************************************** import sys, time, os -from demoscript import * -from scripts import Expect +from demoscript import Util def run(clientStr, desc = 'application'): - print "cleaning databases...", + sys.stdout.write("cleaning databases... ") sys.stdout.flush() nodeDir = os.path.join("db", "node") if not os.path.exists(nodeDir): @@ -25,31 +24,31 @@ def run(clientStr, desc = 'application'): os.mkdir(regDir) else: Util.cleanDbDir(regDir) - print "ok" + print("ok") if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' - print "starting icegridnode...", + sys.stdout.write("starting icegridnode... ") sys.stdout.flush() node = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) node.expect('IceGrid.Registry.Internal ready') node.expect('IceGrid.Registry.Server ready') node.expect('IceGrid.Registry.Client ready') node.expect('IceGrid.Node ready') - print "ok" + print("ok") - print "deploying application...", + sys.stdout.write("deploying application... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.grid') admin.expect('>>>') admin.sendline("application add \'%s.xml\'" %(desc)) admin.expect('>>>') - print "ok" + print("ok") - print "testing client...", + sys.stdout.write("testing client... ") sys.stdout.flush() client = Util.spawn(clientStr) client.expect('==>') @@ -62,15 +61,15 @@ def run(clientStr, desc = 'application'): client.sendline('x') client.waitTestSuccess(timeout=1) - print "ok" + print("ok") - print "deploying template...", + sys.stdout.write("deploying template... ") sys.stdout.flush() admin.sendline("application update \'%s_with_template.xml\'" % (desc)) admin.expect('>>>') - print "ok" + print("ok") - print "testing client...", + sys.stdout.write("testing client... ") sys.stdout.flush() client = Util.spawn(clientStr) client.expect('==>') @@ -83,15 +82,15 @@ def run(clientStr, desc = 'application'): client.sendline('x') client.waitTestSuccess(timeout=1) - print "ok" + print("ok") - print "deploying replicated version...", + sys.stdout.write("deploying replicated version... ") sys.stdout.flush() admin.sendline("application update \'%s_with_replication.xml\'" %(desc)) admin.expect('>>> ') - print "ok" + print("ok") - print "testing client...", + sys.stdout.write("testing client... ") sys.stdout.flush() def testserver(which): @@ -111,7 +110,7 @@ def run(clientStr, desc = 'application'): testserver(2) testserver(3) - print "ok" + print("ok") admin.sendline('registry shutdown Master') admin.sendline('exit') diff --git a/demoscript/IceStorm/clock.py b/demoscript/IceStorm/clock.py index 8ad9e241729..a5e75db91e0 100755 --- a/demoscript/IceStorm/clock.py +++ b/demoscript/IceStorm/clock.py @@ -9,11 +9,10 @@ # ********************************************************************** import sys, time, signal -from demoscript import * -from scripts import Expect +from demoscript import Util def runtest(icestorm, subCmd, subargs, pubCmd, pubargs): - print "testing pub%s/sub%s..." % (pubargs, subargs), + sys.stdout.write("testing pub%s/sub%s... " % (pubargs, subargs)) sys.stdout.flush() sub = Util.spawn('%s --Ice.PrintAdapterReady %s' %(subCmd, subargs)) sub.expect('.* ready') @@ -34,13 +33,13 @@ def runtest(icestorm, subCmd, subargs, pubCmd, pubargs): if sub.hasInterruptSupport(): icestorm.expect('unsubscribe:') - print "ok" + print("ok") def run(subCmd, pubCmd): - 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"' % Util.defaultHost diff --git a/demoscript/Util.py b/demoscript/Util.py index cd49103ca11..33f43d1734b 100644 --- a/demoscript/Util.py +++ b/demoscript/Util.py @@ -28,7 +28,8 @@ if os.path.isdir(os.path.join(toplevel, "cpp")): else: sourcedist = False -from scripts import Expect +sys.path.append(os.path.join(path[0], "scripts")) +import Expect keepGoing = False iceHome = None @@ -47,19 +48,18 @@ host = "127.0.0.1" # debug = False - origenv = {} def dumpenv(): - print "the following environment variables have been set:" + print("the following environment variables have been set:") for k, v in origenv.iteritems(): added = os.environ[k][:len(os.environ[k])-len(v)] - if len(v) > 0: - if isWin32(): - print "%s=%s%%%s%%" % (k, added, k) - else: - print "%s=%s$%s" % (k, added, k) - else: - print "%s=%s" % (k, added) + if len(v) > 0: + if isWin32(): + print("%s=%s%%%s%%" % (k, added, k)) + else: + print("%s=%s$%s" % (k, added, k)) + else: + print("%s=%s" % (k, added)) def addenv(var, val): global origenv @@ -73,10 +73,10 @@ def addenv(var, val): def configurePaths(): if iceHome: - print "[ using Ice installation from " + iceHome, + sys.stdout.write("[ using Ice installation from " + iceHome + " ") if x64: - print "(64bit)", - print "]" + sys.stdout.write("(64bit) ") + sys.stdout.write("]\n") # # If Ice is installed from RPMs, just set the CLASSPATH for Java. @@ -107,7 +107,7 @@ def configurePaths(): # 64-bits binaries are located in a subdirectory with binary # distributions. addenv("PATH", binDir) - if iceHome and x64: + if iceHome and x64: if isWin32(): binDir = os.path.join(binDir, "x64") elif isSolaris(): @@ -138,7 +138,7 @@ def configurePaths(): addenv("CLASSPATH", os.path.join(javaDir, "lib")) addenv("CLASSPATH", os.path.join("classes")) - # + # # On Windows, C# assemblies are found thanks to the .exe.config files. # if isWin32(): @@ -291,50 +291,49 @@ def runDemos(start, args, demos, num = 0, script = False, root = False): prefix = "" suffix = "" - print + sys.stdout.write("\n") if(num > 0): - print "[" + str(num) + "]", - print "%s*** running demo %d/%d in %s%s" % (prefix, index, total, dir, suffix) - print "%s*** configuration:" % prefix, + sys.stdout.write("[" + str(num) + "] ") + print("%s*** running demo %d/%d in %s%s" % (prefix, index, total, dir, suffix)) + sys.stdout.write("%s*** configuration: " % prefix) if len(args.strip()) == 0: - print "Default", + sys.stdout.write("Default ") else: - print args.strip(), - print suffix + sys.stdout.write(args.strip() + " ") + print(suffix) if script: - print "echo \"*** demo started: `date`\"" - print "cd %s" % dir + print("echo \"*** demo started: `date`\"") + print("cd %s" % dir) else: - print "*** demo started:", time.strftime("%x %X") + print("*** demo started: " + time.strftime("%x %X")) sys.stdout.flush() os.chdir(dir) if script: - print "if ! python %s %s; then" % (os.path.join(dir, "expect.py"), args) - print " echo 'demo in %s failed'" % os.path.abspath(dir) + print("if ! %s %s %s; then" % (sys.executable, os.path.join(dir, "expect.py"), args)) + print(" echo 'demo in %s failed'" % os.path.abspath(dir)) if not keepGoing: - print " exit 1" - print "fi" + print(" exit 1") + print("fi") else: - status = os.system('python "' + os.path.join(dir, "expect.py") + '" ' + args) + status = os.system(sys.executable + ' "' + os.path.join(dir, "expect.py") + '" ' + args) if status: if(num > 0): - print "[" + str(num) + "]", + sys.stdout.write("[" + str(num) + "] ") message = "demo in " + dir + " failed with exit status", status, - print message + print(message) if keepGoing == False: - print "exiting" + print("exiting") sys.exit(status) else: - print " ** Error logged and will be displayed again when suite is completed **" + print(" ** Error logged and will be displayed again when suite is completed **") demoErrors.append(message) - def run(demos, protobufDemos = [], root = False): def usage(): - print """usage: %s + print("""usage: %s --start=index Start running the demos at the given demo." --loop Run the demos in a loop." --filter=<regex> Run all the demos that match the given regex." @@ -352,10 +351,10 @@ def run(demos, protobufDemos = [], root = False): --script Generate a script to run the demos. --service-dir=<path> Directory to locate services for C++Builder/VC6. --env Dump the environment." - --noenv Do not automatically modify environment.""" % (sys.argv[0]) + --noenv Do not automatically modify environment.""" % (sys.argv[0])) sys.exit(2) - global keepGoing + global keepGoing try: opts, args = getopt.getopt(sys.argv[1:], "lr:R:", [ @@ -425,9 +424,9 @@ def run(demos, protobufDemos = [], root = False): runDemos(start, arg, demos, script = script, root = root) if len(demoErrors) > 0: - print "The following errors occurred:" + print("The following errors occurred:") for x in demoErrors: - print x + print(x) def guessBuildModeForDir(cwd): import glob @@ -450,7 +449,7 @@ def guessBuildMode(): if not iceHome and sourcedist: m = guessBuildModeForDir(os.path.join(toplevel, "cpp", "bin")) else: - m = guessBuildModeForDir(".") + m = guessBuildModeForDir(".") if m is None: raise RuntimeError("cannot guess debug or release mode") return m @@ -459,10 +458,10 @@ def isDebugBuild(): global buildmode # Guess the mode, if not set on the command line. if not isWin32(): - return False + return False if buildmode is None: - buildmode = guessBuildMode() - print "(guessed build mode %s)" % buildmode + buildmode = guessBuildMode() + print("(guessed build mode %s)" % buildmode) return buildmode == "debug" def getIceVersion(): @@ -486,7 +485,7 @@ def getIceBox(mapping = "cpp"): if isNoServices(): return os.path.join(getServiceDir(), "icebox.exe") if isWin32() and isDebugBuild(): - return "iceboxd" + return "iceboxd" return "icebox" elif mapping == "cs": if isMono(): # Mono cannot locate icebox in the PATH. @@ -533,7 +532,6 @@ def spawn(command, cwd = None, mapping = None): for arg in tokens[1:len(tokens)]: args += " " + arg - if defaultHost: command = '%s %s' % (command, defaultHost) args = '%s %s' % (args, defaultHost) @@ -553,7 +551,7 @@ def spawn(command, cwd = None, mapping = None): else: command = "./" + command elif mapping == "py": - command = "python -u " + command + command = sys.executable + " -u " + command elif mapping == "vb": command = "./" + command elif mapping == "java": @@ -572,7 +570,7 @@ def spawn(command, cwd = None, mapping = None): if isWin32(): # Under Win32 ./ does not work. command = command.replace("./", "") if debug: - print '(%s)' % (command) + print('(%s)' % (command)) return Expect.Expect(command, logfile = tracefile, desc = desc, mapping = mapping, cwd = cwd) def cleanDbDir(path): @@ -608,12 +606,12 @@ def addLdPath(libpath): def processCmdLine(): def usage(): - print "usage: " + sys.argv[0] + " --x64 --preferIPv4 --env --noenv --fast --trace=output --debug --host host --mode=[debug|release] --ice-home=<dir> --service-dir=<dir>" - sys.exit(2) + print("usage: " + sys.argv[0] + " --x64 --preferIPv4 --env --noenv --fast --trace=output --debug --host host --mode=[debug|release] --ice-home=<dir> --service-dir=<dir>") + sys.exit(2) try: - opts, args = getopt.getopt(sys.argv[1:], "", ["env", "noenv", "x64", "preferIPv4", "fast", "trace=", "debug", "host=", "mode=", "ice-home=", "--servicedir="]) + opts, args = getopt.getopt(sys.argv[1:], "", ["env", "noenv", "x64", "preferIPv4", "fast", "trace=", "debug", "host=", "mode=", "ice-home=", "--servicedir="]) except getopt.GetoptError: - usage() + usage() global fast global defaultHost @@ -635,38 +633,38 @@ def processCmdLine(): noenv = False for o, a in opts: - if o == "--debug": - debug = True - if o == "--trace": - if a == "stdout": - tracefile = sys.stdout - else: - tracefile = open(a, "w") - if o == "--host": - host = a - if o == "--env": - env = True - if o == "--noenv": - noenv = True - if o == "--fast": - fast = True - if o == "--x64": - x64 = True - if o == "--preferIPv4": - preferIPv4 = True + if o == "--debug": + debug = True + if o == "--trace": + if a == "stdout": + tracefile = sys.stdout + else: + tracefile = open(a, "w") + if o == "--host": + host = a + if o == "--env": + env = True + if o == "--noenv": + noenv = True + if o == "--fast": + fast = True + if o == "--x64": + x64 = True + if o == "--preferIPv4": + preferIPv4 = True if o == "--ice-home": iceHome = a if o == "--service-dir": serviceDir = a - if o == "--mode": - buildmode = a - if buildmode != 'debug' and buildmode != 'release': - usage() + if o == "--mode": + buildmode = a + if buildmode != 'debug' and buildmode != 'release': + usage() if host != "": - defaultHost = " --Ice.Default.Host=%s" % (host) + defaultHost = " --Ice.Default.Host=%s" % (host) else: - defaultHost = None + defaultHost = None if not iceHome and os.environ.get("USE_BIN_DIST", "no") == "yes" or os.environ.get("ICE_HOME", "") != "": if os.environ.get("ICE_HOME", "") != "": @@ -683,7 +681,7 @@ def processCmdLine(): dumpenv() if iceHome and isWin32() and not buildmode: - print "Error: please define --mode=debug or --mode=release" + print("Error: please define --mode=debug or --mode=release") sys.exit(1) import inspect diff --git a/demoscript/book/evictor_filesystem.py b/demoscript/book/evictor_filesystem.py index f7bb4b418eb..e7437477d66 100755 --- a/demoscript/book/evictor_filesystem.py +++ b/demoscript/book/evictor_filesystem.py @@ -11,7 +11,7 @@ import sys, signal def run(client, server): - print "testing...", + sys.stdout.write("testing... ") sys.stdout.flush() client.expect('>') client.sendline('pwd') @@ -133,4 +133,4 @@ def run(client, server): server.kill(signal.SIGINT) server.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/book/lifecycle.py b/demoscript/book/lifecycle.py index f7bb4b418eb..e7437477d66 100755 --- a/demoscript/book/lifecycle.py +++ b/demoscript/book/lifecycle.py @@ -11,7 +11,7 @@ import sys, signal def run(client, server): - print "testing...", + sys.stdout.write("testing... ") sys.stdout.flush() client.expect('>') client.sendline('pwd') @@ -133,4 +133,4 @@ def run(client, server): server.kill(signal.SIGINT) server.waitTestSuccess() - print "ok" + print("ok") diff --git a/demoscript/book/map_filesystem.py b/demoscript/book/map_filesystem.py index f7bb4b418eb..e7437477d66 100755 --- a/demoscript/book/map_filesystem.py +++ b/demoscript/book/map_filesystem.py @@ -11,7 +11,7 @@ import sys, signal def run(client, server): - print "testing...", + sys.stdout.write("testing... ") sys.stdout.flush() client.expect('>') client.sendline('pwd') @@ -133,4 +133,4 @@ def run(client, server): server.kill(signal.SIGINT) server.waitTestSuccess() - print "ok" + print("ok") |