Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_reference_generate(self, trace_output_path, program, arguments, is_pyscript):
if is_pyscript:
script = os.path.abspath(os.path.join('..', *os.path.split(program)))
argv = [self.env['PYTHON'], script] + arguments
try:
retval = wutils.run_argv(argv, self.env, cwd=trace_output_path, force_no_valgrind=True)
except Utils.WafError, ex:
print >> sys.stderr, ex
return 1
else:
try:
retval = wutils.run_program(program, self.env,
command_template=wutils.get_command_template(self.env, arguments),
cwd=trace_output_path)
except Utils.WafError, ex:
print >> sys.stderr, ex
return 1
return retval
def run_reference_test(self, reference_traces_path, trace_output_path, program, arguments, is_pyscript):
if not os.path.exists(reference_traces_path):
print "Cannot locate reference traces in " + reference_traces_path
return 1
if is_pyscript:
script = os.path.abspath(os.path.join('..', *os.path.split(program)))
argv = [self.env['PYTHON'], script] + arguments
try:
wutils.run_argv(argv, self.env, cwd=trace_output_path, force_no_valgrind=True)
except Utils.WafError, ex:
print >> sys.stderr, ex
return 1
else:
try:
wutils.run_program(program, self.env,
command_template=wutils.get_command_template(self.env, arguments),
cwd=trace_output_path)
except Utils.WafError, ex:
print >> sys.stderr, ex
return 1
rc = diff(trace_output_path, reference_traces_path, Options.options.verbose)
if rc:
print "----------"
print "Traces differ in test: ", self.test_name
print "Reference traces in directory: " + reference_traces_path
print "Traces in directory: " + trace_output_path
print "Run the following command for details:"
print "\tdiff -u %s %s" % (reference_traces_path, trace_output_path)
if not Options.options.verbose:
print "Or re-run regression testing with option -v"