From 8ad1986a9666670a0e979751795340820768a4b2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 22 Feb 2012 17:21:13 +1030 Subject: lib/tdb2: add --valgrind, --valgrind-log options. Not used by default, since it slows down testing (on my laptop) from 22 seconds to 2 minutes 30 seconds. Signed-off-by: Rusty Russell Autobuild-User: Amitay Isaacs Autobuild-Date: Wed Mar 7 04:57:21 CET 2012 on sn-devel-104 --- lib/tdb2/wscript | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/tdb2/wscript b/lib/tdb2/wscript index 00b6b57631..63d27fecc8 100644 --- a/lib/tdb2/wscript +++ b/lib/tdb2/wscript @@ -27,6 +27,12 @@ def set_options(opt): opt.add_option('--disable-tdb2', help=("Use old tdb1 API instead of tdb2"), action="store_false", dest='BUILD_TDB2') + opt.add_option('--valgrind', + help=("use valgrind on tests programs"), + action="store_true", dest='VALGRIND', default=False) + opt.add_option('--valgrind-log', + help=("where to put the valgrind log"), + action="store", dest='VALGRINDLOG', default=None) if opt.IN_LAUNCH_DIR(): opt.add_option('--disable-python', help=("disable the pytdb module"), @@ -183,9 +189,15 @@ def testonly(ctx): link = os.path.join(testdir, 'test') if not os.path.exists(link): os.symlink(os.path.abspath(os.path.join(env.cwd, 'test')), link) + + if Options.options.VALGRIND: + os.environ['VALGRIND'] = 'valgrind -q --num-callers=30' + if Options.options.VALGRINDLOG is not None: + os.environ['VALGRIND'] += ' --log-file=%s' % Options.options.VALGRINDLOG + for f in env.tdb2_test['run'] + env.tdb2_test['api']: name = "tdb2-" + os.path.splitext(os.path.basename(f))[0] - cmd = "cd " + testdir + " && " + os.path.abspath(os.path.join(Utils.g_module.blddir, name)) + " > test-output 2>&1" + cmd = "cd " + testdir + " && $VALGRIND " + os.path.abspath(os.path.join(Utils.g_module.blddir, name)) + " > test-output 2>&1" print("..." + f) ret = samba_utils.RUN_COMMAND(cmd) if ret != 0: -- cgit