diff options
-rwxr-xr-x | config/DemoUtil.py | 44 | ||||
-rwxr-xr-x[-rw-r--r--] | cpp/demo/Freeze/backup/db/DB_CONFIG | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | cpp/demo/Freeze/backup/db/data/.gitignore | 0 | ||||
-rwxr-xr-x | cpp/demo/IceGrid/icebox/expect.py | 14 | ||||
-rwxr-xr-x | cpp/demo/IceStorm/replicated/expect.py | 10 | ||||
-rwxr-xr-x | cpp/demo/IceStorm/replicated2/expect.py | 8 | ||||
-rwxr-xr-x | demoscript/IceGrid/icebox.py | 22 | ||||
-rwxr-xr-x | demoscript/IceStorm/clock.py | 12 | ||||
-rw-r--r-- | demoscript/Util.py | 35 | ||||
-rwxr-xr-x | py/demo/IceGrid/simple/expect.py | 4 | ||||
-rw-r--r-- | vb/demo/Glacier2/callback/Client.vb | 3 | ||||
-rwxr-xr-x | vb/demo/Ice/minimal/Client.vb | 10 |
12 files changed, 104 insertions, 58 deletions
diff --git a/config/DemoUtil.py b/config/DemoUtil.py index d375e59b762..61e35592a83 100755 --- a/config/DemoUtil.py +++ b/config/DemoUtil.py @@ -76,9 +76,23 @@ def configurePaths(): os.environ["PATH"] = binDir + os.pathsep + os.pathsep + os.getenv("PATH", "") javaDir = getIceDir("java") - os.environ["CLASSPATH"] = os.path.join(javaDir, "lib", "Ice.jar") + os.pathsep + os.getenv("CLASSPATH", "") - os.environ["CLASSPATH"] = os.path.join(javaDir, "lib") + os.pathsep + os.getenv("CLASSPATH", "") - os.environ["CLASSPATH"] = os.path.join("classes") + os.pathsep + os.getenv("CLASSPATH", "") + def translate(path): + if not isCygwin(): + return path + child = os.popen("cygpath -w %s" % path) + path = child.read().strip() + err = child.close() + if err: + raise "cygpath failed" + return path + + if isCygwin(): + sep = ';' + else: + sep = os.pathsep + os.environ["CLASSPATH"] = translate(os.path.join(javaDir, "lib", "Ice.jar")) + sep + os.getenv("CLASSPATH", "") + os.environ["CLASSPATH"] = translate(os.path.join(javaDir, "lib")) + sep + os.getenv("CLASSPATH", "") + os.environ["CLASSPATH"] = translate(os.path.join("classes")) + sep + os.getenv("CLASSPATH", "") # # On Windows, C# assemblies are found thanks to the .exe.config files. @@ -90,11 +104,11 @@ def configurePaths(): # On Windows x64, set PYTHONPATH to python/x64. # if isCygwin() and x64: - os.environ["PYTHONPATH"] = os.path.join(getIceDir("py"), "python", "x64") + os.pathsep + \ + os.environ["PYTHONPATH"] = translate(os.path.join(getIceDir("py"), "python", "x64")) + sep + \ os.getenv("PYTHONPATH", "") else: - os.environ["PYTHONPATH"] = os.path.join(getIceDir("py"), "python") + os.pathsep + os.getenv("PYTHONPATH", "") - os.environ["RUBYLIB"] = os.path.join(getIceDir("rb"), "ruby") + os.pathsep + os.getenv("RUBYLIB", "") + os.environ["PYTHONPATH"] = translate(os.path.join(getIceDir("py"), "python")) + sep + os.getenv("PYTHONPATH", "") + os.environ["RUBYLIB"] = translate(os.path.join(getIceDir("rb"), "ruby")) + sep + os.getenv("RUBYLIB", "") def findTopLevel(): global toplevel @@ -238,11 +252,10 @@ def run(demos): if args: usage() - demoFilter = None - removeFilter = False start = 0 loop = False arg = "" + filters = [] for o, a in opts: if o in ("-l", "--loop"): loop = True @@ -255,9 +268,11 @@ def run(demos): elif o in ("-c", "--continue"): keepGoing = True elif o in ("-r", "-R", "--filter", '--rfilter'): - demoFilter = re.compile(a) + testFilter = re.compile(a) if o in ("--rfilter", "-R"): - removeFilter = True + filters.append((testFilter, True)) + else: + filters.append((testFilter, False)) elif o in ("--host", "--fast", "--trace", "--debug", "--mode"): if o == "--mode": if a not in ( "debug", "release"): @@ -285,12 +300,13 @@ def run(demos): configurePaths() - if demoFilter != None: + + for testFilter, removeFilter in filters: if removeFilter: - demos = [ x for x in demos if not demoFilter.search(x) ] + demos = [ x for x in demos if not testFilter.search(x) ] else: - demos = [ x for x in demos if demoFilter.search(x) ] - + demos = [ x for x in demos if testFilter.search(x) ] + if loop: num = 1 while 1: diff --git a/cpp/demo/Freeze/backup/db/DB_CONFIG b/cpp/demo/Freeze/backup/db/DB_CONFIG index 7e738e09d58..7e738e09d58 100644..100755 --- a/cpp/demo/Freeze/backup/db/DB_CONFIG +++ b/cpp/demo/Freeze/backup/db/DB_CONFIG diff --git a/cpp/demo/Freeze/backup/db/data/.gitignore b/cpp/demo/Freeze/backup/db/data/.gitignore index 39af5887579..39af5887579 100644..100755 --- a/cpp/demo/Freeze/backup/db/data/.gitignore +++ b/cpp/demo/Freeze/backup/db/data/.gitignore diff --git a/cpp/demo/IceGrid/icebox/expect.py b/cpp/demo/IceGrid/icebox/expect.py index 525d1ceb0e3..c10608ee3a1 100755 --- a/cpp/demo/IceGrid/icebox/expect.py +++ b/cpp/demo/IceGrid/icebox/expect.py @@ -26,7 +26,19 @@ import demoscript.Util demoscript.Util.defaultLanguage = "C++" import demoscript.IceGrid.icebox +desc = 'application.xml' +if demoscript.Util.mode == 'debug': + fi = open(desc, "r") + desc = 'tmp_application.xml' + fo = open(desc, "w") + for l in fi: + if l.find('exe="icebox"') != -1: + l = l.replace('exe="icebox"', 'exe="iceboxd.exe"') + fo.write(l) + fi.close() + fo.close() + directory = os.path.dirname(os.path.abspath(__file__)) demoscript.Util.addLdPath(directory) -demoscript.IceGrid.icebox.run('./client') +demoscript.IceGrid.icebox.run('./client', desc[0:len(desc)-4]) diff --git a/cpp/demo/IceStorm/replicated/expect.py b/cpp/demo/IceStorm/replicated/expect.py index aa8c85bba0e..0a92a007ae0 100755 --- a/cpp/demo/IceStorm/replicated/expect.py +++ b/cpp/demo/IceStorm/replicated/expect.py @@ -32,7 +32,7 @@ if demoscript.Util.mode == 'debug': desc = 'tmp_application.xml' fo = open(desc, "w") for l in fi: - if l.find('exe="icebox"'): + if l.find('exe="icebox"') != -1: l = l.replace('exe="icebox"', 'exe="iceboxd.exe"') fo.write(l) fi.close() @@ -97,9 +97,11 @@ sub.waitTestSuccess() pub.kill(signal.SIGINT) pub.waitTestSuccess() -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]+' ]) +# 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]+' ]) 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 d020ebc52a4..c933f5303d6 100755 --- a/cpp/demo/IceStorm/replicated2/expect.py +++ b/cpp/demo/IceStorm/replicated2/expect.py @@ -73,9 +73,11 @@ sub.waitTestSuccess() pub.kill(signal.SIGINT) pub.waitTestSuccess() -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]+') +# 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]+') admin = demoscript.Util.spawn('iceboxadmin --Ice.Config=config.ib1 shutdown') admin.waitTestSuccess() diff --git a/demoscript/IceGrid/icebox.py b/demoscript/IceGrid/icebox.py index f4306717798..e089837901c 100755 --- a/demoscript/IceGrid/icebox.py +++ b/demoscript/IceGrid/icebox.py @@ -56,9 +56,9 @@ def run(clientStr, desc = 'application'): sys.stdout.flush() for s in [ "Homer", "Marge", "Bart", "Lisa", "Maggie" ]: - client = demoscript.Util.spawn(clientStr) - node.expect("Hello from %s" % s) - client.waitTestSuccess(timeout=1) + client = demoscript.Util.spawn(clientStr) + node.expect("Hello from %s" % s) + client.waitTestSuccess(timeout=1) print "ok" @@ -121,12 +121,16 @@ def run(clientStr, desc = 'application'): admin.expect('>>>') admin.sendline('exit') - admin = demoscript.Util.spawn('icegridadmin --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063"', language="C++") - admin.expect('user id:') - admin.sendline('foo') - admin.expect('password:') - admin.sendline('foo') - admin.expect('>>>') + # Cygwin seems to have problems with the password input. + if demoscript.Util.isCygwin(): + admin = demoscript.Util.spawn('icegridadmin --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063" -u foo -p foo', language="C++") + else: + admin = demoscript.Util.spawn('icegridadmin --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063"', language="C++") + admin.expect('user id:') + admin.sendline('foo') + admin.expect('password:') + admin.sendline('foo') + admin.expect('>>>', timeout=100) admin.sendline("service start IceBox Homer") admin.expect('>>>') diff --git a/demoscript/IceStorm/clock.py b/demoscript/IceStorm/clock.py index 1a102aa880b..dfee20f3c9c 100755 --- a/demoscript/IceStorm/clock.py +++ b/demoscript/IceStorm/clock.py @@ -10,6 +10,7 @@ import sys, time, signal, demoscript import demoscript.pexpect as pexpect +import demoscript.Util as Util def runtest(icestorm, subCmd, subargs, pubCmd, pubargs): print "testing pub%s/sub%s..." % (pubargs, subargs), @@ -30,10 +31,13 @@ def runtest(icestorm, subCmd, subargs, pubCmd, pubargs): sub.kill(signal.SIGINT) sub.waitTestSuccess() - try: - icestorm.expect('unsubscribe:') - except pexpect.TIMEOUT: - print "(Wait for Unsubscribe failed, expected for Mono)", + + # With Cygwin SIGINT isn't intercepted. + if not Util.isCygwin(): + try: + icestorm.expect('unsubscribe:') + except pexpect.TIMEOUT: + print "(Wait for Unsubscribe failed, expected for Mono)", print "ok" def run(subCmd, pubCmd): diff --git a/demoscript/Util.py b/demoscript/Util.py index af79438a32c..856c333ceaa 100644 --- a/demoscript/Util.py +++ b/demoscript/Util.py @@ -41,16 +41,17 @@ import getopt, os, signal import demoscript.pexpect as pexpect def usage(): - print "usage: " + sys.argv[0] + " --fast --trace --debug --host host --mode=[debug|release]" + print "usage: " + sys.argv[0] + " --fast --trace --debug --host host --mode=[debug|release] --python=<path>" sys.exit(2) try: - opts, args = getopt.getopt(sys.argv[1:], "", ["fast", "trace", "debug", "host=", "mode="]) + opts, args = getopt.getopt(sys.argv[1:], "", ["fast", "trace", "debug", "host=", "mode=", "python="]) except getopt.GetoptError: usage() fast = False trace = False mode = 'release' +pythonhome = "/c/python25" for o, a in opts: if o == "--debug": debug = True @@ -60,6 +61,8 @@ for o, a in opts: host = a if o == "--fast": fast = True + if o == "--python": + pythonhome = a if o == "--mode": mode = a if mode != 'debug' and mode != 'release': @@ -83,10 +86,20 @@ def isMono(): def python(): if isCygwin(): - return "python -u " + return "%s/python -u " % pythonhome else: return "python " +def cygpath(path): + if not isCygwin(): + return path + child = os.popen("cygpath -w %s" % path) + path = child.read().strip() + err = child.close() + if err: + raise "cygpath failed" + return path + def getIceBox(): if isCygwin(): if mode == 'release': @@ -159,17 +172,12 @@ class spawn(pexpect.spawn): else: self.expect(pexpect.EOF, timeout) status = self.wait() - if self.language == "C++" or self.language == "Python" or self.language == "Ruby" or self.language == "PHP" or self.language == "VB": - if isCygwin() and self.sentKill: - assert self.signalstatus == self.sentKill - else: - assert status == exitstatus - elif self.language == "C#": + if self.language != "Java": if isCygwin() and self.sentKill: assert self.signalstatus == self.sentKill else: assert status == exitstatus - elif self.language == "Java": + else: # self.language == "Java": if self.sentKill: if isCygwin(): assert self.signalstatus == self.sentKill @@ -180,13 +188,6 @@ class spawn(pexpect.spawn): assert False else: assert status == exitstatus - else: - # Unknown language - print "Warning: unknown language" - if not self.sentKill: - assert status == exitstatus - else: - assert status == exitstatus or status == 130 or self.signalstatus == self.sentKill def cleanDbDir(path): for filename in [ os.path.join(path, f) for f in os.listdir(path) if f != ".gitignore" and f != "DB_CONFIG"]: diff --git a/py/demo/IceGrid/simple/expect.py b/py/demo/IceGrid/simple/expect.py index ed728971eec..a68ed2349d8 100755 --- a/py/demo/IceGrid/simple/expect.py +++ b/py/demo/IceGrid/simple/expect.py @@ -30,6 +30,10 @@ def rewrite(namein, nameout): fi = open(namein, "r") fo = open(nameout, "w") for l in fi: + if demoscript.Util.isCygwin() and l.find('exe="python"') != -1: + l = l.replace('exe="python"', 'exe="%s"' % + demoscript.Util.cygpath( + os.path.join(demoscript.Util.pythonhome, "python"))) if l.find('option') != -1: fo.write('<option>-u</option>') fo.write(l) diff --git a/vb/demo/Glacier2/callback/Client.vb b/vb/demo/Glacier2/callback/Client.vb index 35e6792ecf2..39f9218ccad 100644 --- a/vb/demo/Glacier2/callback/Client.vb +++ b/vb/demo/Glacier2/callback/Client.vb @@ -114,7 +114,7 @@ Module Glacier2callbackC ElseIf line.Equals("o") Then Dim context As Dictionary(Of String, String) = New Dictionary(Of String, String)() context("_fwd") = "o" - If override Is Nothing Then + If Not override Is Nothing Then context("_ovrd") = override End If oneway.initiateCallback(onewayR, context) @@ -163,6 +163,7 @@ Module Glacier2callbackC Loop While Not line.Equals("x") Try + router.destroySession() Catch ex As Glacier2.SessionNotExistException Console.Error.WriteLine(ex) Catch ex As Ice.ConnectionLostException diff --git a/vb/demo/Ice/minimal/Client.vb b/vb/demo/Ice/minimal/Client.vb index 2d8429813dc..686ce4a2d81 100755 --- a/vb/demo/Ice/minimal/Client.vb +++ b/vb/demo/Ice/minimal/Client.vb @@ -13,16 +13,16 @@ Imports Demo Module MinimalC Public Sub Main(ByVal args() As String) - If args.Length > 0 Then - Console.Error.WriteLine("too many arguments") - System.Environment.Exit(1) - End If - Dim status As Integer = 0 Dim communicator As Ice.Communicator = Nothing Try communicator = Ice.Util.initialize(args) + If args.Length > 0 Then + Console.Error.WriteLine("too many arguments") + System.Environment.Exit(1) + End If + Dim hello As HelloPrx = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello:tcp -p 10000")) If hello Is Nothing Then Console.Error.WriteLine("invalid proxy") |