From 21cf8c64441103bf875a56b39f39397ecd51424e Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Thu, 11 Jul 2002 06:38:57 +0000 Subject: 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. --- tests/run_make_tests.pl | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests/run_make_tests.pl') diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl index baf55f8..0ada574 100755 --- a/tests/run_make_tests.pl +++ b/tests/run_make_tests.pl @@ -11,11 +11,16 @@ # [-make ] # (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 -- cgit v1.2.3