summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-02-22 17:21:13 +1030
committerAmitay Isaacs <amitay@samba.org>2012-03-07 04:57:21 +0100
commit8ad1986a9666670a0e979751795340820768a4b2 (patch)
treebde146a11358a70e3ed84a6d5b5701a76156cf02
parent74d522237e6fc63e1e9331c82c04a809b3df3a65 (diff)
downloadsamba-8ad1986a9666670a0e979751795340820768a4b2.tar.gz
samba-8ad1986a9666670a0e979751795340820768a4b2.tar.bz2
samba-8ad1986a9666670a0e979751795340820768a4b2.zip
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 <rusty@rustcorp.com.au> Autobuild-User: Amitay Isaacs <amitay@samba.org> Autobuild-Date: Wed Mar 7 04:57:21 CET 2012 on sn-devel-104
-rw-r--r--lib/tdb2/wscript14
1 files changed, 13 insertions, 1 deletions
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: