summaryrefslogtreecommitdiff
path: root/tests/run_make_tests.pl
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-07-11 06:38:57 +0000
committerPaul Smith <psmith@gnu.org>2002-07-11 06:38:57 +0000
commit6c3dcbbf88e3ea6505d8f9d7015ca0fbcb3dc410 (patch)
tree24ff4cecaa8603feffa1ecf5ed82a4199a51d673 /tests/run_make_tests.pl
parent111503264cc0605b90f489ba83e59e4593daaa1a (diff)
downloadmake-6c3dcbbf88e3ea6505d8f9d7015ca0fbcb3dc410.tar.gz
Install Greg McGary's patches to port the id-utils hashing functions to
GNU make. Also he provides some other performance fixups after doing some profiling of make on large makefiles. Modify the test suite to allow the use of Valgrind to find memory problems.
Diffstat (limited to 'tests/run_make_tests.pl')
-rwxr-xr-xtests/run_make_tests.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index baf55f8f..0ada574f 100755
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -11,11 +11,16 @@
# [-make <make prog>]
# (and others)
+$valgrind = 0; # invoke make with valgrind
+
require "test_driver.pl";
+#$SIG{INT} = sub { print STDERR "Caught a signal!\n"; die @_; };
+
sub valid_option
{
local($option) = @_;
+
if ($option =~ /^-make([-_]?path)?$/)
{
$make_path = shift @argv;
@@ -27,6 +32,11 @@ sub valid_option
return 1;
}
+ if ($option =~ /^-valgrind$/i) {
+ $valgrind = 1;
+ return 1;
+ }
+
# This doesn't work--it _should_! Someone needs to fix this badly.
#
# elsif ($option =~ /^-work([-_]?dir)?$/)
@@ -56,6 +66,10 @@ sub run_make_with_options
$command .= " $options";
}
+ if ($valgrind) {
+ print VALGRIND "\n\nExecuting: $command\n";
+ }
+
$code = &run_command_with_output($logname,$command);
# Check to see if we have Purify errors. If so, keep the logfile.
@@ -81,6 +95,11 @@ sub run_make_with_options
{
print "Error running $make_path ($code): $command\n";
$test_passed = 0;
+ # If it's a SIGINT, stop here
+ if ($code & 127) {
+ print STDERR "\nCaught signal ".($code & 127)."!\n";
+ exit($code);
+ }
return 0;
}
@@ -215,6 +234,21 @@ sub set_more_defaults
else {
$parallel_jobs = 1;
}
+
+ # Set up for valgrind, if requested.
+
+ if ($valgrind) {
+# use POSIX qw(:fcntl_h);
+# require Fcntl;
+ open(VALGRIND, "> valgrind.out")
+ || die "Cannot open valgrind.out: $!\n";
+ # -q --leak-check=yes
+ $make_path = "valgrind --num-callers=15 --logfile-fd=".fileno(VALGRIND)." $make_path";
+ # F_SETFD is 2
+ fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n";
+ system("echo Starting on `date` 1>&".fileno(VALGRIND));
+ print "Enabled valgrind support.\n";
+ }
}
sub setup_for_test