diff --git a/tests/base.py b/tests/base.py index 4bcf14d..08a40c7 100644 --- a/tests/base.py +++ b/tests/base.py @@ -378,18 +378,25 @@ var.vhosts = var.vhosts + [ "default" => { vhost.map var.vhosts; """ Env.lighttpdconf = self.PrepareFile("conf/lighttpd.conf", self.config) + + valgrindconfig = "" + if Env.valgrind: + valgrindconfig = """ + env ( "G_SLICE=always-malloc", "G_DEBUG=gc-friendly,fatal-criticals" ); + wrapper ("/usr/bin/valgrind" ); +# wrapper ("/usr/bin/valgrind", "--leak-check=full", "--show-reachable=yes", "--leak-resolution=high" ); +""" + Env.angelconf = self.PrepareFile("conf/angel.conf", """ instance {{ binary "{Env.worker}"; config "{Env.lighttpdconf}"; modules "{Env.plugindir}"; - -# env ( "G_SLICE=always-malloc", "G_DEBUG=gc-friendly" ); -# wrapper ("/usr/bin/valgrind", "--leak-check=full", "--show-reachable=yes", "--leak-resolution=high" ); +{valgrindconfig} }} allow-listen {{ ip "127.0.0.1:{Env.port}"; }} -""".format(Env = Env)) +""".format(Env = Env, valgrindconfig = valgrindconfig)) print >> Env.log, "[Done] Preparing tests" diff --git a/tests/runtests.py b/tests/runtests.py index da07519..c84fb54 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -54,6 +54,7 @@ parser.add_option("--debug-requests", help = "Dump requests", action = "store_tr parser.add_option("--no-angel", help = "Spawn lighttpd worker directly", action = "store_true", default = False) parser.add_option("--debug", help = "Show service logs on console", action = "store_true", default = False) parser.add_option("--wait", help = "Wait for services to exit on first signal", action = "store_true", default = False) +parser.add_option("--valgrind", help = "Run worker with valgrind from angel", action = "store_true", default = False) (options, args) = parser.parse_args() @@ -77,6 +78,7 @@ Env.truss = options.truss Env.no_angel = options.no_angel Env.debug = options.debug Env.wait = options.wait +Env.valgrind = options.valgrind Env.color = sys.stdin.isatty() Env.COLOR_RESET = Env.color and "\033[0m" or ""