diff options
author | Matthew Newhook <matthew@zeroc.com> | 2008-06-11 16:44:51 +0800 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2008-06-11 16:44:51 +0800 |
commit | 0dd0df2dc467619f302820ad52166ed7b0a702a7 (patch) | |
tree | e0559cb6ace61eba74c8ff30e1979a17b727e9bd /cpp | |
parent | fixed makefile. (diff) | |
download | ice-0dd0df2dc467619f302820ad52166ed7b0a702a7.tar.bz2 ice-0dd0df2dc467619f302820ad52166ed7b0a702a7.tar.xz ice-0dd0df2dc467619f302820ad52166ed7b0a702a7.zip |
cygwin python is no longer required under Windows to run the expect scripts.
Numerous cleanups and bug fixes to the expect scripts.
The following bugs have been fixed:
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=3091 - under windows a timeout does not kill the spawned servers.
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=3167 - cleanup IceBox expect scripts.
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=3131 - demoscript environment setup.
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=3130 - config/DemoUtil.py should be in demoscript.
Squashed commit of the following:
commit c82e5b70dab99b69caf4044341f6453e0a2b8192
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Wed Jun 11 14:42:34 2008 +0800
fix bug with multicast demo script.
commit c6e61dddf2fc73088e5ecacd096c01fc30c5477a
Author: Matthew Newhook <matthew@zeroc.com>
Date: Wed Jun 11 14:14:52 2008 +0800
guess the build mode if not set on the command line under Windows.
commit 6e797cdca50d6a30493f56e978da4b6f8a08e70d
Author: Matthew Newhook <matthew@zeroc.com>
Date: Tue Jun 10 17:16:49 2008 +0800
use dirname, not split.
commit 862fb56fac680d42037d251c54938ed294596690
Author: Matthew Newhook <matthew@zeroc.com>
Date: Tue Jun 10 17:07:24 2008 +0800
simplify environment setup.
commit d647b35588019ab841c5fe076950e7c19dcbf22c
Author: Matthew Newhook <matthew@zeroc.com>
Date: Tue Jun 10 16:38:40 2008 +0800
use iceHome not sourcedist in the environment setup.
commit 18a82ad794517406f80add4071f46848220bae27
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Tue Jun 10 16:00:49 2008 +0800
fix another hasInterruptSupport problem.
commit 18b276f2c5dcf8a2c38c79e7dc8e8b5f20ce884e
Author: Matthew Newhook <matthew@centosvm4.matthew.zeroc.com>
Date: Tue Jun 10 15:28:08 2008 +0800
Fix printing of the environment.
commit 42d5f59dbd2db1811abdd759387e53081858edb0
Author: Matthew Newhook <matthew@centosvm4.matthew.zeroc.com>
Date: Tue Jun 10 14:12:19 2008 +0800
remove -u from iceca. Put another workaround in the makecerts script.
commit 1bfcc656f25ec3f4f49b5c534bd1c50d50801a4c
Author: Matthew Newhook <matthew@zeroc.com>
Date: Mon Jun 9 12:19:31 2008 +0800
New method to find the top level directory.
commit 1c771768e29b7ff9d141b39f8e03b6790564b4ea
Author: Matthew Newhook <matthew@zeroc.com>
Date: Mon Jun 9 11:28:25 2008 +0800
Print environment variables in a more sane manner. Don't add cs/bin to the PATH & java/lib to CLASSPATH if not using a source dist.
commit a477ceac74b04f297cb342bc7229e2a3a70695e1
Author: Matthew Newhook <matthew@zeroc.com>
Date: Fri Jun 6 16:32:09 2008 +0800
fix various problems when testing with the demo dist.
commit 9bdb41f02130a5716a52ea0ae161fd88697277e5
Author: Matthew Newhook <matthew@zeroc.com>
Date: Fri Jun 6 13:35:41 2008 +0800
Stop copying obsolete DemoUtil.py.
commit d1b4eabc643d0ea04374640ef3f3a2452aaa19bd
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Fri Jun 6 13:20:59 2008 +0800
fix win32 problem.
commit f92d9bf033e253cb8e3ee8dbce1583c7a695ad9f
Author: Matthew Newhook <matthew@zeroc.com>
Date: Fri Jun 6 13:08:27 2008 +0800
more cleanups.
commit 8ecea1446b8a64afdf029f4e722d473c58149f84
Author: Matthew Newhook <matthew@zeroc.com>
Date: Fri Jun 6 12:45:58 2008 +0800
get rid of the processCmdLine.
commit a868ebcd7f868d7b9340f8df6d47ab87d43d37d3
Author: Matthew Newhook <matthew@zeroc.com>
Date: Fri Jun 6 12:38:16 2008 +0800
fix preamble.
commit 148f2922a794fa0ef696e8b4ba51749d4b15cb2c
Author: Matthew Newhook <matthew@zeroc.com>
Date: Fri Jun 6 12:30:07 2008 +0800
fixed some errors in the scripts.
commit 3b9fb9a6b755fe3d84864cdd6853b2a59588a089
Author: Matthew Newhook <matthew@centosvm4.matthew.zeroc.com>
Date: Thu Jun 5 14:47:39 2008 +0800
python 2.3 support.
commit 56956b0a56dd2de5753db060bdadfdb4ddb242a8
Author: Matthew Newhook <matthew@zeroc.com>
Date: Thu Jun 5 14:05:51 2008 +0800
change setenv to addenv. Use hasInterruptSupport in Except.
commit e2907ffd17bc59eaa9d5dd74fb74dbb7ac9addba
Author: Matthew Newhook <matthew@zeroc.com>
Date: Thu Jun 5 13:02:24 2008 +0800
minor cleanup and optimizations.
commit 97fbc27302ee1f74572b634e3b7d4efe6654540f
Author: Matthew Newhook <matthew@zeroc.com>
Date: Thu Jun 5 12:52:57 2008 +0800
fix top level allDemos.
commit 04630047daffafe524e3aed7833dd48e82b90bf2
Author: Matthew Newhook <matthew@zeroc.com>
Date: Thu Jun 5 12:39:57 2008 +0800
Align scripts with the testsuite.
commit 2909a30d682cb6f9cb192f21bf652c3b8037371d
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Thu Jun 5 10:55:13 2008 +0800
Some Win32 fixes.
commit bc760c357a33a11f3f645169c291c69e1f16fb43
Author: Matthew Newhook <matthew@zeroc.com>
Date: Wed Jun 4 18:03:12 2008 +0800
lots of cleanups.
commit c69fbac2457b5a14cc8a48beae3381652f50f599
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Tue Jun 3 16:54:45 2008 +0800
fix some python problems.
commit 326a95af7c720c0c740975c11251feb2f9b4762b
Author: Matthew Newhook <matthew@zeroc.com>
Date: Tue Jun 3 16:16:13 2008 +0800
use python -u for iceca.
commit 990c03c6d314c7d95137a69ebce03425e0eff56c
Author: Matthew Newhook <matthew@zeroc.com>
Date: Tue Jun 3 14:47:00 2008 +0800
first set of unix changes.
commit aa02eaec6c5d44d526b3236908a53c855754217c
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Tue Jun 3 14:46:51 2008 +0800
Get rid of \r in the input stream. Fix scripts accordingly. Fix signal handling under windows.
commit 558015fb4131980f1f4b3fa23c3ddf366d186d20
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Mon Jun 2 16:38:21 2008 +0800
fix signal handling.
commit cadfb7bcabb4c68317fc77c9076607dfb2201e2b
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Fri May 30 17:40:38 2008 +0800
working on a fix for hanging.
commit 9b9ffa736d1540c8bfdaa3693df3022e6377cdec
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Thu May 29 17:53:11 2008 +0800
Removed dependence on cygwin.
commit cce2d732036585fe8e34f92d6b75ae9c27465622
Author: U-MARCH4\matthew <matthew@march4.(none)>
Date: Thu May 29 16:17:42 2008 +0800
windows expect script changes.
Diffstat (limited to 'cpp')
42 files changed, 600 insertions, 748 deletions
diff --git a/cpp/allDemos.py b/cpp/allDemos.py index e7a42b73f63..0fe6c8f2991 100755 --- a/cpp/allDemos.py +++ b/cpp/allDemos.py @@ -12,13 +12,13 @@ import os, sys for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.abspath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "DemoUtil.py")): + if os.path.exists(os.path.join(toplevel, "demoscript")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import DemoUtil +sys.path.append(os.path.join(toplevel, "demoscript")) +import Util # # List of all basic demos. @@ -64,10 +64,5 @@ demos = [ "book/lifecycle", ] -# -# These demos are currently disabled on cygwin -# -if DemoUtil.isCygwin() == 0: - demos += [ ] - -DemoUtil.run(demos) +if __name__ == "__main__": + Util.run(demos) diff --git a/cpp/demo/Freeze/backup/expect.py b/cpp/demo/Freeze/backup/expect.py index 82e2369a078..22c794143f4 100755 --- a/cpp/demo/Freeze/backup/expect.py +++ b/cpp/demo/Freeze/backup/expect.py @@ -10,35 +10,35 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * +import shutil import signal, time -import demoscript.pexpect as pexpect + +def cleandb(): + shutil.rmtree("db.save", True) + Util.cleanDbDir("db/data") + Util.cleanDbDir("db/logs") + for filename in [ os.path.join("db", f) for f in os.listdir("db") if f.startswith("__") ]: + os.remove(filename) print "cleaning databases...", sys.stdout.flush() -os.system('rm -fr db.save') -demoscript.Util.cleanDbDir("db/data") -demoscript.Util.cleanDbDir("db/logs") -os.system('rm -fr db/__*') +cleandb() for d in os.listdir('.'): if d.startswith('hotbackup'): - os.system('rm -rf %s' % (d)) + shutil.rmtree(d) print "ok" -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') print "populating map...", sys.stdout.flush() @@ -46,10 +46,12 @@ client.expect('Updating map', timeout=60) time.sleep(3) # Let the client do some work for a bit. print "ok" - print "performing full backup...", sys.stdout.flush() -backup = demoscript.Util.spawn('./backup full') +if Util.isWin32(): + backup = Util.spawn('./backup.bat full') +else: + backup = Util.spawn('./backup full') backup.expect('hot backup started', timeout=30) backup.waitTestSuccess(timeout=30) print "ok" @@ -61,7 +63,10 @@ print "ok" print "performing incremental backup...", sys.stdout.flush() -backup = demoscript.Util.spawn('./backup incremental') +if Util.isWin32(): + backup = Util.spawn('./backup.bat incremental') +else: + backup = Util.spawn('./backup incremental') backup.expect('hot backup started', timeout=30) backup.waitTestSuccess(timeout=30) print "ok" @@ -76,9 +81,7 @@ assert os.path.isdir('hotbackup') print "killing client with SIGTERM...", sys.stdout.flush() client.kill(signal.SIGTERM) -client.expect(pexpect.EOF, timeout=30) -client.wait() -assert client.signalstatus == signal.SIGTERM +client.waitTestSuccess(-signal.SIGTERM) print "ok" print "Client output: ", @@ -86,11 +89,22 @@ print "%s " % (client.before) print "restarting client...", sys.stdout.flush() -os.system('rm -fr db/data/* db/logs/* db/__*') -os.system('cp -Rp hotbackup/* db') +cleandb() +# Annoying. shutil.copytree cannot be used since db already exists +# (and cannot be removed since it contains .gitignore. +#os.system('cp -Rp hotbackup/* db') +for root, dirnames, filesnames in os.walk("hotbackup"): + dbroot = os.path.join("db", root[len("hotbackup")+1:]) + for d in dirnames: + try: + os.mkdir(os.path.join("db", d)) + except OSError: + pass + for f in filesnames: + shutil.copy2(os.path.join(root, f), os.path.join(dbroot, f)) sys.stdout.flush() -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('(.*)Updating map', timeout=60) assert client.match.group(1).find('Creating new map') == -1 print "ok" @@ -102,9 +116,7 @@ print "ok" print "killing client with SIGTERM...", client.kill(signal.SIGTERM) -client.expect(pexpect.EOF, timeout=30) -client.wait() -assert client.signalstatus == signal.SIGTERM +client.waitTestSuccess(-signal.SIGTERM) print "ok" print "Restarted client output:", diff --git a/cpp/demo/Freeze/bench/expect.py b/cpp/demo/Freeze/bench/expect.py index 6feaa730e62..8e12f3bc1a6 100755 --- a/cpp/demo/Freeze/bench/expect.py +++ b/cpp/demo/Freeze/bench/expect.py @@ -10,26 +10,22 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.Freeze.bench +from demoscript import * +from demoscript.Freeze import bench print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" -client = demoscript.Util.spawn('./client') -demoscript.Freeze.bench.run(client) +client = Util.spawn('./client') +bench.run(client) diff --git a/cpp/demo/Freeze/casino/expect.py b/cpp/demo/Freeze/casino/expect.py index a374606fc26..37ec2a3c0d8 100755 --- a/cpp/demo/Freeze/casino/expect.py +++ b/cpp/demo/Freeze/casino/expect.py @@ -10,20 +10,16 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.Freeze.casino +from demoscript import * +from demoscript.Freeze import casino -demoscript.Freeze.casino.run('./client', './server') +casino.run('./client', './server') diff --git a/cpp/demo/Freeze/customEvictor/expect.py b/cpp/demo/Freeze/customEvictor/expect.py index e38e1db5ce8..f53ca913d6e 100755 --- a/cpp/demo/Freeze/customEvictor/expect.py +++ b/cpp/demo/Freeze/customEvictor/expect.py @@ -10,35 +10,31 @@ import sys, os, signal -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" - -if demoscript.Util.isDarwin(): +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * + +if Util.isDarwin(): print "This demo is not supported under MacOS." sys.exit(0) print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" print "testing IceUtl::Cache evictor" -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect(".* ready", timeout=120) -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.waitTestSuccess(timeout=8 * 60) print client.before @@ -46,10 +42,10 @@ server.kill(signal.SIGINT) server.waitTestSuccess(timeout=60) print "testing simple evictor" -server = demoscript.Util.spawn('./server simple --Ice.PrintAdapterReady') +server = Util.spawn('./server simple --Ice.PrintAdapterReady') server.expect(".* ready") -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.waitTestSuccess(timeout=8*60) print client.before diff --git a/cpp/demo/Freeze/library/expect.py b/cpp/demo/Freeze/library/expect.py index e275b3529ba..094f57596b7 100755 --- a/cpp/demo/Freeze/library/expect.py +++ b/cpp/demo/Freeze/library/expect.py @@ -10,42 +10,38 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.Freeze.library +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.Freeze import library print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') +server = Util.spawn('./server --Ice.PrintAdapterReady --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('>') -demoscript.Freeze.library.run(client, server) +library.run(client, server) print "running with collocated server" print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" -server = demoscript.Util.spawn('./collocated --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') +server = Util.spawn('./collocated --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('>>> ') -demoscript.Freeze.library.run(server, server) +library.run(server, server) diff --git a/cpp/demo/Freeze/phonebook/expect.py b/cpp/demo/Freeze/phonebook/expect.py index 417bafa9139..217f222585b 100755 --- a/cpp/demo/Freeze/phonebook/expect.py +++ b/cpp/demo/Freeze/phonebook/expect.py @@ -10,42 +10,38 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.Freeze.phonebook +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.Freeze import phonebook print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') +server = Util.spawn('./server --Ice.PrintAdapterReady --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('>>> ') -demoscript.Freeze.phonebook.run(client, server) +phonebook.run(client, server) print "running with collocated server" print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" -server = demoscript.Util.spawn('./collocated --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') +server = Util.spawn('./collocated --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('>>> ') -demoscript.Freeze.phonebook.run(server, server) +phonebook.run(server, server) diff --git a/cpp/demo/Freeze/transform/expect.py b/cpp/demo/Freeze/transform/expect.py index 9c7ecc95002..16b09002458 100755 --- a/cpp/demo/Freeze/transform/expect.py +++ b/cpp/demo/Freeze/transform/expect.py @@ -10,20 +10,16 @@ import sys, os, signal -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Freeze.transform -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Freeze import transform -demoscript.Freeze.transform.run('./create', './recreate', './read', './readnew') +transform.run('./create', './recreate', './read', './readnew') diff --git a/cpp/demo/Glacier2/callback/expect.py b/cpp/demo/Glacier2/callback/expect.py index bb5722b5780..e270ca40558 100755 --- a/cpp/demo/Glacier2/callback/expect.py +++ b/cpp/demo/Glacier2/callback/expect.py @@ -10,31 +10,27 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.Glacier2.callback +from demoscript import * +from demoscript.Glacier2 import callback -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -sessionserver = demoscript.Util.spawn('./sessionserver --Ice.PrintAdapterReady') +sessionserver = Util.spawn('./sessionserver --Ice.PrintAdapterReady') sessionserver.expect('.* ready') -glacier2 = demoscript.Util.spawn('glacier2router --Ice.Config=config.glacier2 --Ice.PrintAdapterReady --Glacier2.SessionTimeout=5') +glacier2 = Util.spawn('glacier2router --Ice.Config=config.glacier2 --Ice.PrintAdapterReady --Glacier2.SessionTimeout=5') glacier2.expect('Glacier2.Client ready') glacier2.expect('Glacier2.Server ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') -demoscript.Glacier2.callback.run(client, server, sessionserver, glacier2) +callback.run(client, server, sessionserver, glacier2) diff --git a/cpp/demo/Glacier2/chat/expect.py b/cpp/demo/Glacier2/chat/expect.py index fa5fde3feb2..e690378d1c8 100755 --- a/cpp/demo/Glacier2/chat/expect.py +++ b/cpp/demo/Glacier2/chat/expect.py @@ -9,31 +9,28 @@ # ********************************************************************** import sys, os, signal -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +from demoscript import * + +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -glacier2 = demoscript.Util.spawn('glacier2router --Ice.Config=config.glacier2 --Ice.PrintAdapterReady') +glacier2 = Util.spawn('glacier2router --Ice.Config=config.glacier2 --Ice.PrintAdapterReady') glacier2.expect('Glacier2.Client ready') glacier2.expect('Glacier2.Server ready') print "starting client 1...", sys.stdout.flush() -client1 = demoscript.Util.spawn('./client') +client1 = Util.spawn('./client') client1.expect('user id:') client1.sendline("foo") client1.expect('password:') @@ -42,7 +39,7 @@ print "ok" print "starting client 2...", sys.stdout.flush() -client2 = demoscript.Util.spawn('./client') +client2 = Util.spawn('./client') client2.expect('user id:') client2.sendline("bar") client2.expect('password:') diff --git a/cpp/demo/Ice/async/expect.py b/cpp/demo/Ice/async/expect.py index 7726ea82e40..867e133db04 100755 --- a/cpp/demo/Ice/async/expect.py +++ b/cpp/demo/Ice/async/expect.py @@ -10,25 +10,21 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.async -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import async -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('.*==>') -demoscript.Ice.async.run(client, server) +async.run(client, server) diff --git a/cpp/demo/Ice/bidir/expect.py b/cpp/demo/Ice/bidir/expect.py index 01fe30a36e1..6227eaba91f 100755 --- a/cpp/demo/Ice/bidir/expect.py +++ b/cpp/demo/Ice/bidir/expect.py @@ -10,23 +10,19 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.bidir -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import bidir -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -demoscript.Ice.bidir.run('./client', server) +bidir.run('./client', server) diff --git a/cpp/demo/Ice/callback/expect.py b/cpp/demo/Ice/callback/expect.py index b1876940da1..6a6f6b13a75 100755 --- a/cpp/demo/Ice/callback/expect.py +++ b/cpp/demo/Ice/callback/expect.py @@ -10,25 +10,21 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.callback -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import callback -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('.*==>') -demoscript.Ice.callback.run(client, server) +callback.run(client, server) diff --git a/cpp/demo/Ice/converter/expect.py b/cpp/demo/Ice/converter/expect.py index 03b603661e4..4badb4776ba 100755 --- a/cpp/demo/Ice/converter/expect.py +++ b/cpp/demo/Ice/converter/expect.py @@ -10,24 +10,20 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" - -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * + +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('.*==>') print "testing with conversion... ", diff --git a/cpp/demo/Ice/hello/expect.py b/cpp/demo/Ice/hello/expect.py index 4ee059ae80a..fd3062f9d2e 100755 --- a/cpp/demo/Ice/hello/expect.py +++ b/cpp/demo/Ice/hello/expect.py @@ -10,25 +10,21 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.hello -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import hello -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('.*==>') -demoscript.Ice.hello.run(client, server) +hello.run(client, server) diff --git a/cpp/demo/Ice/invoke/expect.py b/cpp/demo/Ice/invoke/expect.py index f3f21bf5697..59d8a51b02a 100755 --- a/cpp/demo/Ice/invoke/expect.py +++ b/cpp/demo/Ice/invoke/expect.py @@ -10,25 +10,21 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.invoke -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import invoke -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('.*==>') -demoscript.Ice.invoke.run(client, server) +invoke.run(client, server) diff --git a/cpp/demo/Ice/latency/expect.py b/cpp/demo/Ice/latency/expect.py index e4164bb4707..0117766751d 100755 --- a/cpp/demo/Ice/latency/expect.py +++ b/cpp/demo/Ice/latency/expect.py @@ -10,27 +10,23 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +from demoscript import * -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') print "testing ping... ", sys.stdout.flush() -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.waitTestSuccess(timeout=100) print "ok" diff --git a/cpp/demo/Ice/minimal/expect.py b/cpp/demo/Ice/minimal/expect.py index 7c06c021c4f..0a98bf47619 100755 --- a/cpp/demo/Ice/minimal/expect.py +++ b/cpp/demo/Ice/minimal/expect.py @@ -10,27 +10,23 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +from demoscript import * -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') print "testing...", sys.stdout.flush() -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.waitTestSuccess() server.expect('Hello World!') print "ok" diff --git a/cpp/demo/Ice/multicast/expect.py b/cpp/demo/Ice/multicast/expect.py index 4a06aa97447..8bd1825de1f 100755 --- a/cpp/demo/Ice/multicast/expect.py +++ b/cpp/demo/Ice/multicast/expect.py @@ -10,20 +10,16 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.multicast -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import multicast -demoscript.Ice.multicast.run("./client", "./server") +multicast.run("./client", "./server") diff --git a/cpp/demo/Ice/nested/expect.py b/cpp/demo/Ice/nested/expect.py index e54ff70cea6..58067b1b96b 100755 --- a/cpp/demo/Ice/nested/expect.py +++ b/cpp/demo/Ice/nested/expect.py @@ -10,25 +10,21 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.nested -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import nested -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client --Ice.Override.Timeout=2000') +client = Util.spawn('./client --Ice.Override.Timeout=2000') client.expect('.*for exit:') -demoscript.Ice.nested.run(client, server) +nested.run(client, server) diff --git a/cpp/demo/Ice/session/expect.py b/cpp/demo/Ice/session/expect.py index f34cec7d88b..1974eaf543a 100755 --- a/cpp/demo/Ice/session/expect.py +++ b/cpp/demo/Ice/session/expect.py @@ -10,23 +10,19 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.session -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import session -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -demoscript.Ice.session.run('./client', server) +session.run('./client', server) diff --git a/cpp/demo/Ice/throughput/expect.py b/cpp/demo/Ice/throughput/expect.py index 8c267cae01e..cb7a4e4e0c0 100755 --- a/cpp/demo/Ice/throughput/expect.py +++ b/cpp/demo/Ice/throughput/expect.py @@ -10,24 +10,20 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.throughput -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import throughput -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') -demoscript.Ice.throughput.run(client, server) +throughput.run(client, server) diff --git a/cpp/demo/Ice/value/expect.py b/cpp/demo/Ice/value/expect.py index eb450713900..87ebed8d301 100755 --- a/cpp/demo/Ice/value/expect.py +++ b/cpp/demo/Ice/value/expect.py @@ -10,24 +10,20 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -import demoscript.Ice.value -demoscript.Util.defaultLanguage = "C++" +from demoscript import * +from demoscript.Ice import value -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') -demoscript.Ice.value.run(client, server) +value.run(client, server) diff --git a/cpp/demo/IceBox/hello/expect.py b/cpp/demo/IceBox/hello/expect.py index dbe177c7c3c..061669fb69b 100755 --- a/cpp/demo/IceBox/hello/expect.py +++ b/cpp/demo/IceBox/hello/expect.py @@ -10,32 +10,30 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.IceBox.hello +from demoscript import * +from demoscript.IceBox import hello -if demoscript.Util.defaultHost: - args = ' --IceBox.UseSharedCommunicator.IceStorm=1' +# Override the service command line +if Util.defaultHost: + args = ' --IceBox.Service.Hello="HelloService:create --Ice.Config=config.service %s"' % Util.defaultHost else: args = '' directory = os.path.dirname(os.path.abspath(__file__)) -demoscript.Util.addLdPath(directory) -server = demoscript.Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (demoscript.Util.getIceBox(), args)) +Util.addLdPath(directory) + +server = Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (Util.getIceBox(), args)) server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.expect('.*==>') -demoscript.IceBox.hello.run(client, server) +hello.run(client, server) diff --git a/cpp/demo/IceGrid/allocate/expect.py b/cpp/demo/IceGrid/allocate/expect.py index 72cf2fb3229..5fbed8d84f3 100755 --- a/cpp/demo/IceGrid/allocate/expect.py +++ b/cpp/demo/IceGrid/allocate/expect.py @@ -10,20 +10,16 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.IceGrid.allocate +from demoscript import * +from demoscript.IceGrid import allocate -demoscript.IceGrid.allocate.run('./client') +allocate.run('./client') diff --git a/cpp/demo/IceGrid/icebox/expect.py b/cpp/demo/IceGrid/icebox/expect.py index c10608ee3a1..f7199bd499f 100755 --- a/cpp/demo/IceGrid/icebox/expect.py +++ b/cpp/demo/IceGrid/icebox/expect.py @@ -10,24 +10,20 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.IceGrid.icebox +from demoscript import * +from demoscript.IceGrid import icebox desc = 'application.xml' -if demoscript.Util.mode == 'debug': +if Util.mode == 'debug': fi = open(desc, "r") desc = 'tmp_application.xml' fo = open(desc, "w") @@ -39,6 +35,6 @@ if demoscript.Util.mode == 'debug': fo.close() directory = os.path.dirname(os.path.abspath(__file__)) -demoscript.Util.addLdPath(directory) +Util.addLdPath(directory) -demoscript.IceGrid.icebox.run('./client', desc[0:len(desc)-4]) +icebox.run('./client', desc[0:len(desc)-4]) diff --git a/cpp/demo/IceGrid/replication/expect.py b/cpp/demo/IceGrid/replication/expect.py index 555be83b38d..97a455b28dc 100755 --- a/cpp/demo/IceGrid/replication/expect.py +++ b/cpp/demo/IceGrid/replication/expect.py @@ -10,61 +10,56 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" - +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * import signal print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db/master") -demoscript.Util.cleanDbDir("db/node1") -demoscript.Util.cleanDbDir("db/node2") -demoscript.Util.cleanDbDir("db/replica1") -demoscript.Util.cleanDbDir("db/replica2") +Util.cleanDbDir("db/master") +Util.cleanDbDir("db/node1") +Util.cleanDbDir("db/node2") +Util.cleanDbDir("db/replica1") +Util.cleanDbDir("db/replica2") print "ok" -if demoscript.Util.defaultHost: +if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' print "starting icegridnodes...", sys.stdout.flush() -master = demoscript.Util.spawn('icegridregistry --Ice.Config=config.master --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut=') -master.expect('IceGrid.Registry.Internal ready\r{1,2}\nIceGrid.Registry.Server ready\r{1,2}\nIceGrid.Registry.Client ready') -replica1 = demoscript.Util.spawn('icegridregistry --Ice.Config=config.replica1 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut=') -replica1.expect('IceGrid.Registry.Server ready\r{1,2}\nIceGrid.Registry.Client ready') -replica2 = demoscript.Util.spawn('icegridregistry --Ice.Config=config.replica2 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut=') -replica2.expect('IceGrid.Registry.Server ready\r{1,2}\nIceGrid.Registry.Client ready') -node1 = demoscript.Util.spawn('icegridnode --Ice.Config=config.node1 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut= %s' % (args)) +master = Util.spawn('icegridregistry --Ice.Config=config.master --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut=') +master.expect('IceGrid.Registry.Internal ready\nIceGrid.Registry.Server ready\nIceGrid.Registry.Client ready') +replica1 = Util.spawn('icegridregistry --Ice.Config=config.replica1 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut=') +replica1.expect('IceGrid.Registry.Server ready\nIceGrid.Registry.Client ready') +replica2 = Util.spawn('icegridregistry --Ice.Config=config.replica2 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut=') +replica2.expect('IceGrid.Registry.Server ready\nIceGrid.Registry.Client ready') +node1 = Util.spawn('icegridnode --Ice.Config=config.node1 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut= %s' % (args)) node1.expect('IceGrid.Node ready') -node2 = demoscript.Util.spawn('icegridnode --Ice.Config=config.node2 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut= %s' % (args)) +node2 = Util.spawn('icegridnode --Ice.Config=config.node2 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut= %s' % (args)) node2.expect('IceGrid.Node ready') print "ok" print "deploying application...", sys.stdout.flush() -admin = demoscript.Util.spawn('icegridadmin --Ice.Config=config.client') +admin = Util.spawn('icegridadmin --Ice.Config=config.client') admin.expect('>>>') admin.sendline("application add \'application.xml\'") admin.expect('>>>') print "ok" def runtest(): - client = demoscript.Util.spawn('./client') + client = Util.spawn('./client') client.expect('iterations:') client.sendline('5') client.expect('\(in ms\):') diff --git a/cpp/demo/IceGrid/secure/expect.py b/cpp/demo/IceGrid/secure/expect.py index 4c431d7167b..c4363002259 100755 --- a/cpp/demo/IceGrid/secure/expect.py +++ b/cpp/demo/IceGrid/secure/expect.py @@ -10,42 +10,33 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" - +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * import signal print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db/registry") -demoscript.Util.cleanDbDir("db/node") -demoscript.Util.cleanDbDir("certs") +Util.cleanDbDir("db/registry") +Util.cleanDbDir("db/node") +Util.cleanDbDir("certs") print "ok" -if demoscript.Util.defaultHost: +if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' -# If this is cygwin add the location of the real python to the PATH. -if demoscript.Util.isCygwin(): - os.environ["PATH"] = demoscript.Util.pythonhome + os.pathsep + os.environ["PATH"] - print "creating certificates...", sys.stdout.flush() -makecerts = demoscript.Util.spawn('python makecerts.py') +makecerts = Util.spawn('python -u makecerts.py') makecerts.expect("Do you want to keep this as the CA subject name?") makecerts.sendline("y") makecerts.expect("Enter the email address of the CA:") @@ -73,9 +64,9 @@ print "starting icegrid...", sys.stdout.flush() registryProps = " --Ice.PrintAdapterReady" + \ " --IceGrid.Registry.AdminSSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier" -registry = demoscript.Util.spawn('icegridregistry --Ice.Config=config.registry' + registryProps) -registry.expect('IceGrid.Registry.Internal ready\r{1,2}\nIceGrid.Registry.Server ready\r{1,2}\nIceGrid.Registry.Client ready') -node = demoscript.Util.spawn('icegridnode --Ice.Config=config.node --Ice.PrintAdapterReady %s' % (args)) +registry = Util.spawn('icegridregistry --Ice.Config=config.registry' + registryProps) +registry.expect('IceGrid.Registry.Internal ready\nIceGrid.Registry.Server ready\nIceGrid.Registry.Client ready') +node = Util.spawn('icegridnode --Ice.Config=config.node --Ice.PrintAdapterReady %s' % (args)) node.expect('IceGrid.Node ready') print "ok" @@ -85,14 +76,14 @@ sys.stdout.flush() glacier2Props = " --Ice.PrintAdapterReady --Glacier2.SessionTimeout=5" + \ " --Glacier2.SSLSessionManager=DemoIceGrid/AdminSSLSessionManager" + \ " --Glacier2.SSLPermissionsVerifier=DemoGlacier2/NullSSLPermissionsVerifier" -glacier2 = demoscript.Util.spawn('glacier2router --Ice.Config=config.glacier2' + glacier2Props) +glacier2 = Util.spawn('glacier2router --Ice.Config=config.glacier2' + glacier2Props) glacier2.expect('Glacier2.Client ready') glacier2.expect('Glacier2.Server ready') print "ok" print "deploying application...", sys.stdout.flush() -admin = demoscript.Util.spawn('icegridadmin --Ice.Config=config.admin') +admin = Util.spawn('icegridadmin --Ice.Config=config.admin') admin.expect('>>>') admin.sendline("application add application.xml") admin.expect('>>>') @@ -101,7 +92,7 @@ admin.waitTestSuccess(timeout=120) print "ok" def runtest(): - client = demoscript.Util.spawn('./client') + client = Util.spawn('./client') client.expect('==>') client.sendline('t') node.expect("SimpleServer says Hello World!") @@ -121,7 +112,7 @@ print "ok" print "testing icegridadmin...", sys.stdout.flush() -admin = demoscript.Util.spawn('icegridadmin --Ice.Config=config.admin --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"') +admin = Util.spawn('icegridadmin --Ice.Config=config.admin --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"') admin.expect('>>>') admin.sendline("server list") admin.expect('SimpleServer') @@ -129,7 +120,7 @@ admin.expect('>>>') admin.sendline('exit') admin.waitTestSuccess(timeout=120) -admin = demoscript.Util.spawn('icegridadmin --Ice.Config=config.admin --ssl') +admin = Util.spawn('icegridadmin --Ice.Config=config.admin --ssl') admin.expect('>>>') admin.sendline("server list") admin.expect('SimpleServer') @@ -137,7 +128,7 @@ admin.expect('>>>') admin.sendline('exit') admin.waitTestSuccess(timeout=120) -admin = demoscript.Util.spawn('icegridadmin --Ice.Config=config.admin --ssl --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"') +admin = Util.spawn('icegridadmin --Ice.Config=config.admin --ssl --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"') admin.expect('>>>') admin.sendline("server list") admin.expect('SimpleServer') @@ -150,7 +141,7 @@ print "ok" print "completing shutdown...", sys.stdout.flush() -admin = demoscript.Util.spawn('icegridadmin --Ice.Config=config.admin') +admin = Util.spawn('icegridadmin --Ice.Config=config.admin') admin.expect('>>>') admin.sendline('node shutdown Node') diff --git a/cpp/demo/IceGrid/secure/makecerts.py b/cpp/demo/IceGrid/secure/makecerts.py index 00d8798e72c..3f9ebfc92a6 100755 --- a/cpp/demo/IceGrid/secure/makecerts.py +++ b/cpp/demo/IceGrid/secure/makecerts.py @@ -11,6 +11,7 @@ import os, sys, shutil, glob def iceca(args): + os.environ['PYTHONUNBUFFERED'] = '1' if os.system("iceca " + args): sys.exit(1) diff --git a/cpp/demo/IceGrid/sessionActivation/expect.py b/cpp/demo/IceGrid/sessionActivation/expect.py index c589f5917d0..821455ebd92 100755 --- a/cpp/demo/IceGrid/sessionActivation/expect.py +++ b/cpp/demo/IceGrid/sessionActivation/expect.py @@ -10,21 +10,17 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.IceGrid.sessionActivation +from demoscript import * +from demoscript.IceGrid import sessionActivation -demoscript.IceGrid.sessionActivation.run('./client') +sessionActivation.run('./client') diff --git a/cpp/demo/IceGrid/simple/expect.py b/cpp/demo/IceGrid/simple/expect.py index 025c07f9f9a..f64723b42e4 100755 --- a/cpp/demo/IceGrid/simple/expect.py +++ b/cpp/demo/IceGrid/simple/expect.py @@ -10,20 +10,16 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.IceGrid.simple +from demoscript import * +from demoscript.IceGrid import simple -demoscript.IceGrid.simple.run('./client') +simple.run('./client') diff --git a/cpp/demo/IceStorm/clock/expect.py b/cpp/demo/IceStorm/clock/expect.py index 39018549829..56df2a309d1 100755 --- a/cpp/demo/IceStorm/clock/expect.py +++ b/cpp/demo/IceStorm/clock/expect.py @@ -10,20 +10,16 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.IceStorm.clock +from demoscript import * +from demoscript.IceStorm import clock -demoscript.IceStorm.clock.run('./subscriber', './publisher') +clock.run('./subscriber', './publisher') diff --git a/cpp/demo/IceStorm/counter/expect.py b/cpp/demo/IceStorm/counter/expect.py index a264a5750a3..983680de84c 100755 --- a/cpp/demo/IceStorm/counter/expect.py +++ b/cpp/demo/IceStorm/counter/expect.py @@ -10,40 +10,37 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +from demoscript import * import signal print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" -if demoscript.Util.defaultHost: - args = ' --IceBox.UseSharedCommunicator.IceStorm=1' +if Util.defaultHost: + args = ' --IceBox.Service.IceStorm="IceStormService,33:createIceStorm --Ice.Config=config.service %s"' \ + % Util.defaultHost else: args = '' -icestorm = demoscript.Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (demoscript.Util.getIceBox(), args)) +icestorm = Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (Util.getIceBox(), args)) icestorm.expect('.* ready') print "testing single client...", sys.stdout.flush() -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client1 = demoscript.Util.spawn('./client') +client1 = Util.spawn('./client') client1.expect('init: 0') client1.sendline('i') client1.expect('int: 1 total: 1') @@ -51,7 +48,7 @@ print "ok" print "testing second client...", sys.stdout.flush() -client2 = demoscript.Util.spawn('./client') +client2 = Util.spawn('./client') client2.expect('init: 1') client2.sendline('i') client1.expect('int: 1 total: 2') @@ -59,7 +56,7 @@ client2.expect('int: 1 total: 2') print "ok" print "testing third client...", -client3 = demoscript.Util.spawn('./client') +client3 = Util.spawn('./client') client3.expect('init: 2') client3.sendline('d') client1.expect('int: -1 total: 1') @@ -83,6 +80,6 @@ print "ok" server.kill(signal.SIGINT) server.waitTestSuccess() -admin = demoscript.Util.spawn('iceboxadmin --Ice.Config=config.icebox shutdown') +admin = Util.spawn('iceboxadmin --Ice.Config=config.icebox shutdown') admin.waitTestSuccess() icestorm.waitTestSuccess() diff --git a/cpp/demo/IceStorm/replicated/expect.py b/cpp/demo/IceStorm/replicated/expect.py index 0a92a007ae0..3a267aba693 100755 --- a/cpp/demo/IceStorm/replicated/expect.py +++ b/cpp/demo/IceStorm/replicated/expect.py @@ -10,24 +10,20 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript - -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * import time, signal desc = 'application.xml' -if demoscript.Util.mode == 'debug': +if Util.mode == 'debug': fi = open(desc, "r") desc = 'tmp_application.xml' fo = open(desc, "w") @@ -40,24 +36,24 @@ if demoscript.Util.mode == 'debug': print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db/node") -demoscript.Util.cleanDbDir("db/registry") +Util.cleanDbDir("db/node") +Util.cleanDbDir("db/registry") print "ok" -if demoscript.Util.defaultHost: +if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' print "starting icegridnode...", sys.stdout.flush() -node = demoscript.Util.spawn('icegridnode --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) -node.expect('IceGrid.Registry.Server ready\r{1,2}\nIceGrid.Registry.Client ready\r{1,2}\nIceGrid.Node ready') +node = Util.spawn('icegridnode --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) +node.expect('IceGrid.Registry.Server ready\nIceGrid.Registry.Client ready\nIceGrid.Node ready') print "ok" print "deploying application...", sys.stdout.flush() -admin = demoscript.Util.spawn('icegridadmin --Ice.Config=config.grid') +admin = Util.spawn('icegridadmin --Ice.Config=config.grid') admin.expect('>>>') admin.sendline("application add \'%s\'" %(desc)) admin.expect('>>>') @@ -65,31 +61,22 @@ print "ok" print "testing pub/sub...", sys.stdout.flush() -sub = demoscript.Util.spawn('./subscriber --Ice.PrintAdapterReady') - -# Match each of the patterns once. -def matchpat(e, pat, timeout=60): - matched = [] - for i in pat: - m = e.expect(pat, timeout=timeout) - assert not m in matched - matched.append(m) - assert len(matched) == len(pat) - -matchpat(node, [ 'Election: node 1: reporting for duty in group 3:[-0-9A-Fa-f]+ with coordinator 3', +sub = Util.spawn('./subscriber --Ice.PrintAdapterReady') + +node.expectall([ 'Election: node 1: reporting for duty in group 3:[-0-9A-Fa-f]+ with coordinator 3', 'Election: node 2: reporting for duty in group 3:[-0-9A-Fa-f]+ with coordinator 3', - 'Election: node 3: reporting for duty in group 3:[-0-9A-Fa-f]+ as coordinator' ]) + 'Election: node 3: reporting for duty in group 3:[-0-9A-Fa-f]+ as coordinator' ], timeout=60) -matchpat(node, ['DemoIceStorm-3: Topic: time: subscribeAndGetPublisher: [-0-9A-Fa-f]+', +node.expectall(['DemoIceStorm-3: Topic: time: subscribeAndGetPublisher: [-0-9A-Fa-f]+', 'DemoIceStorm-1: Topic: time: add replica observer: [-0-9A-Fa-f]+', - 'DemoIceStorm-2: Topic: time: add replica observer: [-0-9A-Fa-f]+' ]) + 'DemoIceStorm-2: Topic: time: add replica observer: [-0-9A-Fa-f]+' ], timeout=60) sub.expect('.* ready') -pub = demoscript.Util.spawn('./publisher') +pub = Util.spawn('./publisher') time.sleep(3) -sub.expect('[0-9][0-9]/[0-9][0-9].*\r{1,2}\n[0-9][0-9]/[0-9][0-9]') +sub.expect('[0-9][0-9]/[0-9][0-9].*\n[0-9][0-9]/[0-9][0-9]') print "ok" sub.kill(signal.SIGINT) @@ -97,11 +84,9 @@ sub.waitTestSuccess() pub.kill(signal.SIGINT) pub.waitTestSuccess() -# With Cygwin SIGINT isn't intercepted. -if not demoscript.Util.isCygwin(): - matchpat(node, [ 'DemoIceStorm-1: Topic: time: remove replica observer: [-0-9A-Fa-f]+', - 'DemoIceStorm-2: Topic: time: remove replica observer: [-0-9A-Fa-f]+' , - 'DemoIceStorm-3: Topic: time: unsubscribe: [-0-9A-Fa-f]+' ]) +node.expectall([ 'DemoIceStorm-1: Topic: time: remove replica observer: [-0-9A-Fa-f]+', + 'DemoIceStorm-2: Topic: time: remove replica observer: [-0-9A-Fa-f]+' , + 'DemoIceStorm-3: Topic: time: unsubscribe: [-0-9A-Fa-f]+' ], timeout=60) admin.sendline('registry shutdown Master') admin.sendline('exit') diff --git a/cpp/demo/IceStorm/replicated2/expect.py b/cpp/demo/IceStorm/replicated2/expect.py index c933f5303d6..bd896254af9 100755 --- a/cpp/demo/IceStorm/replicated2/expect.py +++ b/cpp/demo/IceStorm/replicated2/expect.py @@ -10,39 +10,44 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +from demoscript import * import time, signal print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db1"); -demoscript.Util.cleanDbDir("db2") -demoscript.Util.cleanDbDir("db3") +Util.cleanDbDir("db1"); +Util.cleanDbDir("db2") +Util.cleanDbDir("db3") print "ok" -directory = os.path.dirname(os.path.abspath(__file__)) -demoscript.Util.addLdPath(directory) +if Util.defaultHost: + a1 = ' --IceBox.Service.IceStorm="IceStormService,33:createIceStorm --Ice.Config=config.s1 %s"' \ + % Util.defaultHost + a2 = ' --IceBox.Service.IceStorm="IceStormService,33:createIceStorm --Ice.Config=config.s2 %s"' \ + % Util.defaultHost + a3 = ' --IceBox.Service.IceStorm="IceStormService,33:createIceStorm --Ice.Config=config.s3 %s"' \ + % Util.defaultHost +else: + a1 = '' + a2 = '' + a3 = '' print "starting replicas...", sys.stdout.flush() -ib1 = demoscript.Util.spawn('%s --Ice.Config=config.ib1 --Ice.PrintAdapterReady' % (demoscript.Util.getIceBox())) +ib1 = Util.spawn('%s --Ice.Config=config.ib1 --Ice.PrintAdapterReady %s' % (Util.getIceBox(), a1)) ib1.expect('.* ready') -ib2 = demoscript.Util.spawn('%s --Ice.Config=config.ib2 --Ice.PrintAdapterReady' % (demoscript.Util.getIceBox())) +ib2 = Util.spawn('%s --Ice.Config=config.ib2 --Ice.PrintAdapterReady %s' % (Util.getIceBox(), a2)) ib2.expect('.* ready') -ib3 = demoscript.Util.spawn('%s --Ice.Config=config.ib3 --Ice.PrintAdapterReady' % (demoscript.Util.getIceBox())) +ib3 = Util.spawn('%s --Ice.Config=config.ib3 --Ice.PrintAdapterReady %s' % (Util.getIceBox(), a3)) ib3.expect('.* ready') print "ok" @@ -52,7 +57,7 @@ ib1.expect('Election: node 0: reporting for duty in group 2:[-0-9A-Fa-f]+ with c print "testing pub/sub...", sys.stdout.flush() -sub = demoscript.Util.spawn('./subscriber --Ice.PrintAdapterReady') +sub = Util.spawn('./subscriber --Ice.PrintAdapterReady') ib1.expect('Topic: time: add replica observer: [-0-9A-Fa-f]+') ib2.expect('Topic: time: add replica observer: [-0-9A-Fa-f]+' ) @@ -60,10 +65,10 @@ ib3.expect('Topic: time: subscribeAndGetPublisher: [-0-9A-Fa-f]+') sub.expect('.* ready') -pub = demoscript.Util.spawn('./publisher') +pub = Util.spawn('./publisher') time.sleep(3) -sub.expect('[0-9][0-9]/[0-9][0-9].*\r{1,2}\n[0-9][0-9]/[0-9][0-9]') +sub.expect('[0-9][0-9]/[0-9][0-9].*\n[0-9][0-9]/[0-9][0-9]') print "ok" print "shutting down...", @@ -73,16 +78,14 @@ sub.waitTestSuccess() pub.kill(signal.SIGINT) pub.waitTestSuccess() -# With Cygwin SIGINT isn't intercepted. -if not demoscript.Util.isCygwin(): - ib1.expect('Topic: time: remove replica observer: [-0-9A-Fa-f]+') - ib2.expect('Topic: time: remove replica observer: [-0-9A-Fa-f]+') - ib3.expect('Topic: time: unsubscribe: [-0-9A-Fa-f]+') +ib1.expect('Topic: time: remove replica observer: [-0-9A-Fa-f]+') +ib2.expect('Topic: time: remove replica observer: [-0-9A-Fa-f]+') +ib3.expect('Topic: time: unsubscribe: [-0-9A-Fa-f]+') -admin = demoscript.Util.spawn('iceboxadmin --Ice.Config=config.ib1 shutdown') +admin = Util.spawn('iceboxadmin --Ice.Config=config.ib1 shutdown') admin.waitTestSuccess() -admin = demoscript.Util.spawn('iceboxadmin --Ice.Config=config.ib2 shutdown') +admin = Util.spawn('iceboxadmin --Ice.Config=config.ib2 shutdown') admin.waitTestSuccess() -admin = demoscript.Util.spawn('iceboxadmin --Ice.Config=config.ib3 shutdown') +admin = Util.spawn('iceboxadmin --Ice.Config=config.ib3 shutdown') admin.waitTestSuccess() print "ok" diff --git a/cpp/demo/IceUtil/workqueue/expect.py b/cpp/demo/IceUtil/workqueue/expect.py index b66616041cc..d984916b693 100755 --- a/cpp/demo/IceUtil/workqueue/expect.py +++ b/cpp/demo/IceUtil/workqueue/expect.py @@ -10,23 +10,18 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.Ice.hello +from demoscript import * -server = demoscript.Util.spawn('./workqueue') +server = Util.spawn('./workqueue') server.expect('Pushing work items') print "testing...", diff --git a/cpp/demo/book/freeze_filesystem/expect.py b/cpp/demo/book/freeze_filesystem/expect.py index bdd92351ebd..3742d56522e 100755 --- a/cpp/demo/book/freeze_filesystem/expect.py +++ b/cpp/demo/book/freeze_filesystem/expect.py @@ -10,29 +10,25 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.book.freeze_filesystem +from demoscript import * +from demoscript.book import freeze_filesystem print "cleaning databases...", sys.stdout.flush() -demoscript.Util.cleanDbDir("db") +Util.cleanDbDir("db") print "ok" -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') -demoscript.book.freeze_filesystem.run(client, server) +freeze_filesystem.run(client, server) diff --git a/cpp/demo/book/lifecycle/expect.py b/cpp/demo/book/lifecycle/expect.py index 32d39dd41d7..f8e8707519d 100755 --- a/cpp/demo/book/lifecycle/expect.py +++ b/cpp/demo/book/lifecycle/expect.py @@ -10,24 +10,20 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" -import demoscript.book.lifecycle +from demoscript import * +from demoscript.book import lifecycle -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') -demoscript.book.lifecycle.run(client, server) +lifecycle.run(client, server) diff --git a/cpp/demo/book/printer/expect.py b/cpp/demo/book/printer/expect.py index dce603e111d..c70a9ec3716 100755 --- a/cpp/demo/book/printer/expect.py +++ b/cpp/demo/book/printer/expect.py @@ -10,31 +10,26 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" +from demoscript import * import signal -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') print "testing...", sys.stdout.flush() -client = demoscript.Util.spawn('./client') +client = Util.spawn('./client') client.waitTestSuccess() server.expect('Hello World!') server.kill(signal.SIGTERM) -server.wait() -server.signalstatus == signal.SIGTERM +server.waitTestSuccess(-signal.SIGTERM) print "ok" diff --git a/cpp/demo/book/simple_filesystem/expect.py b/cpp/demo/book/simple_filesystem/expect.py index 91810f49981..53427483f18 100755 --- a/cpp/demo/book/simple_filesystem/expect.py +++ b/cpp/demo/book/simple_filesystem/expect.py @@ -10,29 +10,26 @@ import sys, os -try: - import demoscript -except ImportError: - for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "demoscript")): - break - else: - raise "can't find toplevel directory!" - sys.path.append(os.path.join(toplevel)) - import demoscript +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +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!" +sys.path.append(path[0]) + +from demoscript import * -import demoscript.Util -demoscript.Util.defaultLanguage = "C++" import signal -server = demoscript.Util.spawn('./server --Ice.PrintAdapterReady') +server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') print "testing...", sys.stdout.flush() -client = demoscript.Util.spawn('./client') -client.expect('Contents of root directory:\r{1,2}\n.*Down to a sunless sea.') +client = Util.spawn('./client') +client.expect('Contents of root directory:\n.*Down to a sunless sea.') client.waitTestSuccess() server.kill(signal.SIGINT) server.waitTestSuccess() diff --git a/cpp/src/Ice/FactoryTableDef.cpp b/cpp/src/Ice/FactoryTableDef.cpp index a217e3a996b..fa2595a0870 100644 --- a/cpp/src/Ice/FactoryTableDef.cpp +++ b/cpp/src/Ice/FactoryTableDef.cpp @@ -156,4 +156,3 @@ IceInternal::FactoryTableDef::removeObjectFactory(const std::string& t) } } } - diff --git a/cpp/src/ca/iceca.bat b/cpp/src/ca/iceca.bat index ebb699e1a46..63299efba5c 100755 --- a/cpp/src/ca/iceca.bat +++ b/cpp/src/ca/iceca.bat @@ -10,4 +10,4 @@ REM ********************************************************************** REM .bat wrapper for iceca python script. Assumes python is in your PATH.
-@python -u %~dp0iceca %*
+@python %~dp0iceca %*
|