Commit ef6b70fd authored by Jim Fulton's avatar Jim Fulton

Provided more control over the way test servers are run to make

debugging easier.
parent ba8ee57f
...@@ -42,6 +42,7 @@ class ZEOConfig: ...@@ -42,6 +42,7 @@ class ZEOConfig:
self.authentication_protocol = None self.authentication_protocol = None
self.authentication_database = None self.authentication_database = None
self.authentication_realm = None self.authentication_realm = None
self.loglevel = 'INFO'
def dump(self, f): def dump(self, f):
print >> f, "<zeo>" print >> f, "<zeo>"
...@@ -66,12 +67,12 @@ class ZEOConfig: ...@@ -66,12 +67,12 @@ class ZEOConfig:
print >> f, """ print >> f, """
<eventlog> <eventlog>
level INFO level %s
<logfile> <logfile>
path server-%s.log path server-%s.log
</logfile> </logfile>
</eventlog> </eventlog>
""" % self.address[1] """ % (self.loglevel, self.address[1])
def __str__(self): def __str__(self):
f = StringIO.StringIO() f = StringIO.StringIO()
...@@ -90,7 +91,7 @@ def encode_format(fmt): ...@@ -90,7 +91,7 @@ def encode_format(fmt):
def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False, def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
path='Data.fs', protocol=None, blob_dir=None, path='Data.fs', protocol=None, blob_dir=None,
suicide=True): suicide=True, debug=False):
"""Start a ZEO server in a separate process. """Start a ZEO server in a separate process.
Takes two positional arguments a string containing the storage conf Takes two positional arguments a string containing the storage conf
...@@ -133,6 +134,8 @@ def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False, ...@@ -133,6 +134,8 @@ def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
args = [qa(sys.executable), qa(script), '-C', qa(tmpfile)] args = [qa(sys.executable), qa(script), '-C', qa(tmpfile)]
if keep: if keep:
args.append("-k") args.append("-k")
if debug:
args.append("-d")
if not suicide: if not suicide:
args.append("-S") args.append("-S")
if protocol: if protocol:
...@@ -288,7 +291,8 @@ def setUp(test): ...@@ -288,7 +291,8 @@ def setUp(test):
servers = {} servers = {}
def start_server(storage_conf=None, zeo_conf=None, port=None, keep=False, def start_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
addr=None, path='Data.fs', protocol=None, blob_dir=None): addr=None, path='Data.fs', protocol=None, blob_dir=None,
suicide=True, debug=False):
"""Start a ZEO server. """Start a ZEO server.
Return the server and admin addresses. Return the server and admin addresses.
...@@ -301,7 +305,8 @@ def setUp(test): ...@@ -301,7 +305,8 @@ def setUp(test):
elif addr is not None: elif addr is not None:
raise TypeError("Can't specify port and addr") raise TypeError("Can't specify port and addr")
addr, adminaddr, pid, config_path = start_zeo_server( addr, adminaddr, pid, config_path = start_zeo_server(
storage_conf, zeo_conf, port, keep, path, protocol, blob_dir) storage_conf, zeo_conf, port, keep, path, protocol, blob_dir,
suicide, debug)
os.remove(config_path) os.remove(config_path)
servers[adminaddr] = pid servers[adminaddr] = pid
return addr, adminaddr return addr, adminaddr
......
...@@ -153,10 +153,12 @@ def main(): ...@@ -153,10 +153,12 @@ def main():
configfile = None configfile = None
suicide = True suicide = True
# Parse the arguments and let getopt.error percolate # Parse the arguments and let getopt.error percolate
opts, args = getopt.getopt(sys.argv[1:], 'kSC:v:') opts, args = getopt.getopt(sys.argv[1:], 'dkSC:v:')
for opt, arg in opts: for opt, arg in opts:
if opt == '-k': if opt == '-k':
keep = 1 keep = 1
if opt == '-d':
ZEO.zrpc.connection.debug_zrpc = True
elif opt == '-C': elif opt == '-C':
configfile = arg configfile = arg
elif opt == '-S': elif opt == '-S':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment