]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* tests/run_make_test.pl: Fix support for valgrind.
authorPaul Smith <psmith@gnu.org>
Sat, 21 Sep 2019 16:39:51 +0000 (12:39 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 21 Sep 2019 19:13:24 +0000 (15:13 -0400)
Change the variable holding the make command to be a list that can
hold extra commands and options, not just a string.

tests/run_make_tests.pl
tests/scripts/options/dash-n

index 1c2cb069ad09daee5ef2fbc42c5059680532b0be..cd50ad8dd6af6d84c0ecbe1cf61d7edec7c6ba37 100644 (file)
@@ -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";
   }
 }
 
index 02ae4a9956c550637df74ed631b04e8747b7d878..ca3b43d67c6da4a2094dee63c7f759ce6b3d8bb9 100644 (file)
@@ -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');