--- a/regression.py Sat Jan 24 15:51:09 2009 +0000
+++ b/regression.py Sat Jan 24 18:09:29 2009 +0000
@@ -125,7 +125,7 @@
wutils.run_argv(argv, cwd=trace_output_path)
else:
wutils.run_program(program,
- command_template=wutils.get_command_template(*arguments),
+ command_template=wutils.get_command_template(self.env, arguments),
cwd=trace_output_path)
if Options.options.verbose:
@@ -157,7 +157,7 @@
retval = wutils.run_argv(argv, cwd=trace_output_path)
else:
retval = wutils.run_program(program,
- command_template=wutils.get_command_template(*arguments),
+ command_template=wutils.get_command_template(self.env, arguments),
cwd=trace_output_path)
return retval
--- a/wscript Sat Jan 24 15:51:09 2009 +0000
+++ b/wscript Sat Jan 24 18:09:29 2009 +0000
@@ -261,6 +261,8 @@
# we cannot pull regression traces without mercurial
conf.find_program('hg', var='MERCURIAL')
+ conf.find_program('valgrind', var='VALGRIND')
+
# Write a summary of optional features status
print "---- Summary of optional NS-3 features:"
for (name, caption, was_enabled, reason_not_enabled) in conf.env['NS3_OPTIONAL_FEATURES']:
@@ -426,7 +428,7 @@
if Options.options.run:
# Check that the requested program name is valid
- program_name, dummy_program_argv = wutils.get_run_program(Options.options.run, get_command_template())
+ program_name, dummy_program_argv = wutils.get_run_program(Options.options.run, wutils.get_command_template(env))
# When --run'ing a program, tell WAF to only build that program,
# nothing more; this greatly speeds up compilation when all you
@@ -445,18 +447,6 @@
regression.run_regression(bld, regression_traces)
-def get_command_template(*arguments):
- if Options.options.valgrind:
- if Options.options.command_template:
- raise Utils.WafError("Options --command-template and --valgrind are conflicting")
- cmd = "valgrind --leak-check=full --error-exitcode=1 %s"
- else:
- cmd = Options.options.command_template or '%s'
- for arg in arguments:
- cmd = cmd + " " + arg
- return cmd
-
-
def shutdown():
env = Build.bld.env
@@ -467,7 +457,7 @@
lcov_report()
if Options.options.run:
- wutils.run_program(Options.options.run, get_command_template())
+ wutils.run_program(Options.options.run, wutils.get_command_template(env))
raise SystemExit(0)
if Options.options.pyrun:
@@ -492,7 +482,7 @@
out.close()
print "-- Running NS-3 C++ core unit tests..."
- wutils.run_program('run-tests', get_command_template())
+ wutils.run_program('run-tests', wutils.get_command_template(env))
if env['ENABLE_PYTHON_BINDINGS']:
print "-- Running NS-3 Python bindings unit tests..."
--- a/wutils.py Sat Jan 24 15:51:09 2009 +0000
+++ b/wutils.py Sat Jan 24 18:09:29 2009 +0000
@@ -26,11 +26,13 @@
-def get_command_template(*arguments):
+def get_command_template(env, arguments=()):
if Options.options.valgrind:
if Options.options.command_template:
raise Utils.WafError("Options --command-template and --valgrind are conflicting")
- cmd = "valgrind --leak-check=full %s"
+ if not env['VALGRIND']:
+ raise Utils.WafError("valgrind is not installed")
+ cmd = env['VALGRIND'] + " --leak-check=full --error-exitcode=1 %s"
else:
cmd = Options.options.command_template or '%s'
for arg in arguments: