[tests] Add --truss option

personal/stbuehler/wip
Stefan Bühler 12 years ago
parent 6516d55c1f
commit 77ad4a63d4
  1. 4
      tests/runtests.py
  2. 5
      tests/service.py

@ -31,7 +31,8 @@ parser.add_option("-k", "--no-cleanup", help = "Keep temporary files, no cleanup
parser.add_option("-p", "--port", help = "Use [port,port+7] as tcp ports on 127.0.0.1 (default: 8088; use 0 for random port)", default = 8088, type = "int")
parser.add_option("-t", "--test", help = "Run specific test", action = "append", dest = "tests", default = [])
parser.add_option("-c", "--force-cleanup", help = "Keep no temporary files (overwrites -k)", action = "store_true", default = False)
parser.add_option("-s", "--strace", help = "Strace services", action = "store_true", default = False)
parser.add_option("--strace", help = "Strace services", action = "store_true", default = False)
parser.add_option("--truss", help = "Truss services", action = "store_true", default = False)
parser.add_option("--debug-requests", help = "Dump requests", action = "store_true", default = False)
parser.add_option("--no-angel", help = "Spawn lighttpd worker directly", action = "store_true", default = False)
@ -53,6 +54,7 @@ Env.sourcedir = os.path.abspath(os.path.dirname(__file__))
Env.luadir = os.path.join(os.path.dirname(Env.sourcedir), "doc")
Env.debugRequests = options.debug_requests
Env.strace = options.strace
Env.truss = options.truss
Env.color = sys.stdin.isatty()
Env.no_angel = options.no_angel

@ -24,6 +24,7 @@ def devnull():
straceargs = [ 'strace', '-tt', '-f', '-s', '4096', '-o' ]
trussargs = [ 'truss', '-d', '-f', '-s', '4096', '-o' ]
def preexec():
os.setsid()
@ -48,6 +49,9 @@ class Service(object):
if base.Env.strace:
slog = self.tests.PrepareFile("log/strace-%s.log" % self.name, "")
args = straceargs + [ slog ] + list(args)
elif base.Env.truss:
tlog = self.tests.PrepareFile("log/truss-%s.log" % self.name, "")
args = trussargs + [ tlog ] + list(args)
print >> base.Env.log, "Spawning '%s': %s" % (self.name, ' '.join(args))
proc = subprocess.Popen(args, stdin = inp, stdout = logfile, stderr = logfile, close_fds = True, preexec_fn = preexec)
@ -112,6 +116,7 @@ class Service(object):
return
self.tests.CleanupFile("log/service-%s.log" % self.name)
self.tests.CleanupFile("log/strace-%s.log" % self.name)
self.tests.CleanupFile("log/truss-%s.log" % self.name)
self.Cleanup()
def _stop(self):

Loading…
Cancel
Save