summaryrefslogtreecommitdiff
path: root/java/test/Ice/exceptions/run.py
blob: 233ea85eecea5a93d34ec927d32b70a7732ad04d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003
# ZeroC, Inc.
# Billerica, MA, USA
#
# All Rights Reserved.
#
# Ice is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# **********************************************************************

import os, sys

for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
    toplevel = os.path.normpath(toplevel)
    if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
        break
else:
    raise "can't find toplevel directory!"

sys.path.append(os.path.join(toplevel, "config"))
import TestUtil

name = os.path.join("Ice", "exceptions")
testdir = os.path.join(toplevel, "test", name)
nameAMD = os.path.join("Ice", "exceptionsAMD")
testdirAMD = os.path.join(toplevel, "test", nameAMD)

print "tests with regular server."
classpath = os.getenv("CLASSPATH", "")
os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + TestUtil.sep + classpath
TestUtil.clientServerTest()

print "tests with AMD server."
server = "java -ea Server --Ice.ProgramName=Server "
client = "java -ea Client --Ice.ProgramName=Client "
print "starting server...",
classpath = os.getenv("CLASSPATH", "")
os.environ["CLASSPATH"] = os.path.join(testdirAMD, "classes") + TestUtil.sep + classpath
serverPipe = os.popen(server + TestUtil.serverOptions)
TestUtil.getAdapterReady(serverPipe)
print "ok"
print "starting client...",
classpath = os.getenv("CLASSPATH", "")
os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + TestUtil.sep + classpath
clientPipe = os.popen(client + TestUtil.clientOptions)
print "ok"
for output in clientPipe.xreadlines():
    print output,
clientStatus = clientPipe.close()
serverStatus = serverPipe.close()
if clientStatus or serverStatus:
    TestUtil.killServers()
    sys.exit(1)

print "tests with collocated server."
TestUtil.collocatedTest()
sys.exit(0)