1.1 --- a/wscript Wed Jan 02 13:39:56 2008 +0100
1.2 +++ b/wscript Thu Jan 03 14:14:17 2008 +0000
1.3 @@ -74,7 +74,10 @@
1.4 ' It should be a shell command string containing %s inside,'
1.5 ' which will be replaced by the actual program.'),
1.6 type="string", default=None, dest='command_template')
1.7 -
1.8 + opt.add_option('--valgrind',
1.9 + help=('Change the default command template to run programs and unit tests with valgrind'),
1.10 + action="store_true", default=False,
1.11 + dest='valgrind')
1.12 opt.add_option('--shell',
1.13 help=('Run a shell with an environment suitably modified to run locally built programs'),
1.14 action="store_true", default=False,
1.15 @@ -233,6 +236,13 @@
1.16 lib.add_objects = list(env['NS3_MODULES'])
1.17
1.18
1.19 +def get_command_template():
1.20 + if Params.g_options.valgrind:
1.21 + if Params.g_options.command_template:
1.22 + Params.fatal("Options --command-template and --valgrind are conflicting")
1.23 + return "valgrind %s"
1.24 + else:
1.25 + return (Params.g_options.command_template or '%s')
1.26
1.27
1.28 def shutdown():
1.29 @@ -251,7 +261,7 @@
1.30 lcov_report()
1.31
1.32 if Params.g_options.run:
1.33 - run_program(Params.g_options.run, Params.g_options.command_template)
1.34 + run_program(Params.g_options.run, get_command_template())
1.35 raise SystemExit(0)
1.36
1.37 if Params.g_options.command_template:
1.38 @@ -273,7 +283,7 @@
1.39 raise SystemExit(1)
1.40 out.close()
1.41
1.42 - run_program('run-tests')
1.43 + run_program('run-tests', get_command_template())
1.44
1.45
1.46 def _find_program(program_name, env):