mirror of
https://github.com/mirror/make.git
synced 2025-04-24 12:00:35 +08:00
* tests/run_make_test.pl: Fix support for valgrind.
Change the variable holding the make command to be a list that can hold extra commands and options, not just a string.
This commit is contained in:
parent
00fa3ca3a5
commit
4a7a8278e8
tests
@ -58,6 +58,9 @@ $srcvol = undef;
|
||||
$blddir = undef;
|
||||
$bldvol = undef;
|
||||
|
||||
$make_path = undef;
|
||||
@make_command = ();
|
||||
|
||||
$command_string = '';
|
||||
|
||||
$all_tests = 0;
|
||||
@ -283,7 +286,7 @@ sub add_options {
|
||||
}
|
||||
|
||||
sub create_command {
|
||||
return !$_[0] || ref($_[0]) ? [$make_path] : $make_path;
|
||||
return !$_[0] || ref($_[0]) ? [@make_command] : join(' ', @make_command);
|
||||
}
|
||||
|
||||
# The old-fashioned way...
|
||||
@ -392,7 +395,7 @@ sub run_make_with_options {
|
||||
}
|
||||
|
||||
if ($code != $expected_code) {
|
||||
print "Error running $make_path (expected $expected_code; got $code): $cmdstr\n";
|
||||
print "Error running @make_command (expected $expected_code; got $code): $cmdstr\n";
|
||||
$test_passed = 0;
|
||||
$runf = &get_runfile;
|
||||
&create_file (&get_runfile, $command_string);
|
||||
@ -405,7 +408,7 @@ sub run_make_with_options {
|
||||
}
|
||||
|
||||
if ($profile & $vos) {
|
||||
system "add_profile $make_path";
|
||||
system "add_profile @make_command";
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -627,14 +630,16 @@ sub set_more_defaults
|
||||
|
||||
# Set up for valgrind, if requested.
|
||||
|
||||
$make_command = $make_path;
|
||||
@make_command = ($make_path);
|
||||
|
||||
if ($valgrind) {
|
||||
my $args = $valgrind_args;
|
||||
open(VALGRIND, "> valgrind.out") or die "Cannot open valgrind.out: $!\n";
|
||||
# -q --leak-check=yes
|
||||
exists $ENV{VALGRIND_ARGS} and $args = $ENV{VALGRIND_ARGS};
|
||||
$make_path = "valgrind --log-fd=".fileno(VALGRIND)." $args $make_path";
|
||||
@make_command = ('valgrind', '--log-fd='.fileno(VALGRIND));
|
||||
push(@make_command, split(' ', $args));
|
||||
push(@make_command, $make_path);
|
||||
# F_SETFD is 2
|
||||
fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n";
|
||||
system("echo Starting on `date` 1>&".fileno(VALGRIND));
|
||||
@ -642,13 +647,13 @@ sub set_more_defaults
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
print "Port type: $port_type\n";
|
||||
print "Make path: $make_path\n";
|
||||
print "Shell path: $sh_name".($is_posix_sh ? ' (POSIX)' : '')."\n";
|
||||
print "#PWD#: $cwdpath\n";
|
||||
print "#PERL#: $perl_name\n";
|
||||
print "#MAKEPATH#: $mkpath\n";
|
||||
print "#MAKE#: $make_name\n";
|
||||
print "Port type: $port_type\n";
|
||||
print "Make command: @make_command\n";
|
||||
print "Shell path: $sh_name".($is_posix_sh ? ' (POSIX)' : '')."\n";
|
||||
print "#PWD#: $cwdpath\n";
|
||||
print "#PERL#: $perl_name\n";
|
||||
print "#MAKEPATH#: $mkpath\n";
|
||||
print "#MAKE#: $make_name\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ EOF
|
||||
close(MAKEFILE);
|
||||
|
||||
&run_make_with_options($topmake, '-n --no-print-directory', &get_logfile);
|
||||
$answer = "$make_command -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n";
|
||||
$answer = subst_make_string("#MAKEPATH# -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n");
|
||||
&compare_output($answer, &get_logfile(1));
|
||||
|
||||
unlink('inc');
|
||||
|
Loading…
Reference in New Issue
Block a user