Commit 750f3f56 authored by Jim Fulton's avatar Jim Fulton

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

debugging easier.
parent 00027fae
......@@ -42,6 +42,7 @@ class ZEOConfig:
self.authentication_protocol = None
self.authentication_database = None
self.authentication_realm = None
self.loglevel = 'INFO'
def dump(self, f):
print >> f, "<zeo>"
......@@ -66,12 +67,12 @@ class ZEOConfig:
print >> f, """
<eventlog>
level INFO
level %s
<logfile>
path server-%s.log
</logfile>
</eventlog>
""" % self.address[1]
""" % (self.loglevel, self.address[1])
def __str__(self):
f = StringIO.StringIO()
......@@ -90,7 +91,7 @@ def encode_format(fmt):
def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
path='Data.fs', protocol=None, blob_dir=None,
suicide=True):
suicide=True, debug=False):
"""Start a ZEO server in a separate process.
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,
args = [qa(sys.executable), qa(script), '-C', qa(tmpfile)]
if keep:
args.append("-k")
if debug:
args.append("-d")
if not suicide:
args.append("-S")
if protocol:
......@@ -288,7 +291,8 @@ def setUp(test):
servers = {}
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.
Return the server and admin addresses.
......@@ -301,7 +305,8 @@ def setUp(test):
elif addr is not None:
raise TypeError("Can't specify port and addr")
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)
servers[adminaddr] = pid
return addr, adminaddr
......
......@@ -153,10 +153,12 @@ def main():
configfile = None
suicide = True
# 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:
if opt == '-k':
keep = 1
if opt == '-d':
ZEO.zrpc.connection.debug_zrpc = True
elif opt == '-C':
configfile = arg
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