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/demo/IceStorm/replicated/expect.py | |
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/demo/IceStorm/replicated/expect.py')
-rwxr-xr-x | cpp/demo/IceStorm/replicated/expect.py | 71 |
1 files changed, 28 insertions, 43 deletions
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') |