summaryrefslogtreecommitdiff
path: root/tests/test_driver.pl
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2009-06-10 02:21:09 +0000
committerPaul Smith <psmith@gnu.org>2009-06-10 02:21:09 +0000
commit421c9c8c5b5c9be7728cbe6c1a1dfff999f9de44 (patch)
tree1e0ab35d58e13f763e42aa1171112ce0daf080f6 /tests/test_driver.pl
parente9114e1a9896c4ae27b938165bc1d7fa608a7a7a (diff)
downloadmake-421c9c8c5b5c9be7728cbe6c1a1dfff999f9de44.tar.gz
- Fix Savannah bug #19108
- Fix Savannah bug #17752 - Test suite: * When tests fail keep a "run" file containing the command invoked. * Support for the Valgrind "memcheck" and "massif" tools.
Diffstat (limited to 'tests/test_driver.pl')
-rw-r--r--tests/test_driver.pl19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index dd303206..d38868c7 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -6,7 +6,7 @@
# Modified 92-02-11 through 92-02-22 by Chris Arthur to further generalize.
#
# Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-# 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
@@ -435,16 +435,19 @@ sub run_each_test
$logext = 'l';
$diffext = 'd';
$baseext = 'b';
+ $runext = 'r';
$extext = '';
} else {
$logext = 'log';
$diffext = 'diff';
$baseext = 'base';
+ $runext = 'run';
$extext = '.';
}
$log_filename = "$testpath.$logext";
$diff_filename = "$testpath.$diffext";
$base_filename = "$testpath.$baseext";
+ $run_filename = "$testpath.$runext";
$tmp_filename = "$testpath.$tmpfilesuffix";
&setup_for_test; # suite-defined
@@ -691,6 +694,7 @@ sub compare_output
print "DIFFERENT OUTPUT\n" if $debug;
&create_file (&get_basefile, $answer);
+ &create_file (&get_runfile, $command_string);
print "\nCreating Difference File ...\n" if $debug;
@@ -698,6 +702,8 @@ sub compare_output
local($command) = "diff -c " . &get_basefile . " " . $logfile;
&run_command_with_output(&get_difffile,$command);
+ } else {
+ &rmfiles ();
}
$suite_passed = 0;
@@ -828,7 +834,7 @@ sub run_command_with_output
{
my $filename = shift;
- print "\nrun_command_with_output($filename): @_\n" if $debug;
+ print "\nrun_command_with_output($filename,$runname): @_\n" if $debug;
&attach_default_output ($filename);
my $code = _run_command(@_);
&detach_default_output;
@@ -1201,6 +1207,15 @@ sub get_difffile
return ($diff_filename . &num_suffix ($num_of_logfiles));
}
+# This subroutine returns a command filename with a number appended
+# to the end corresponding to how many logfiles (and thus command files)
+# have been created in the current running test.
+
+sub get_runfile
+{
+ return ($run_filename . &num_suffix ($num_of_logfiles));
+}
+
# just like logfile, only a generic tmp filename for use by the test.
# they are automatically cleaned up unless -keep was used, or the test fails.
# Pass an argument of 1 to return the same filename as the previous call.