VirtualBox

Ignore:
Timestamp:
Mar 12, 2018 7:32:29 PM (7 years ago)
Author:
bird
Message:

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/tests/run_make_tests.pl

    r2596 r3138  
    1212#                        (and others)
    1313
    14 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
    15 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
    16 # Foundation, Inc.
     14# Copyright (C) 1992-2016 Free Software Foundation, Inc.
    1715# This file is part of GNU Make.
    1816#
     
    3028# this program.  If not, see <http://www.gnu.org/licenses/>.
    3129
     30%FEATURES = ();
    3231
    3332$valgrind = 0;              # invoke make with valgrind
    3433$valgrind_args = '';
    35 $memcheck_args = '--num-callers=15 --tool=memcheck --leak-check=full';
     34$memcheck_args = '--num-callers=15 --tool=memcheck --leak-check=full --suppressions=guile.supp';
    3635$massif_args = '--num-callers=15 --tool=massif --alloc-fn=xmalloc --alloc-fn=xcalloc --alloc-fn=xrealloc --alloc-fn=xstrdup --alloc-fn=xstrndup';
    3736$pure_log = undef;
    3837
     38# The location of the GNU make source directory
     39$srcdir = '';
     40
    3941$command_string = '';
    4042
    4143$all_tests = 0;
    4244
     45# rmdir broken in some Perls on VMS.
     46if ($^O eq 'VMS')
     47{
     48  require VMS::Filespec;
     49  VMS::Filespec->import();
     50
     51  sub vms_rmdir {
     52    my $vms_file = vmspath($_[0]);
     53    $vms_file = fileify($vms_file);
     54    my $ret = unlink(vmsify($vms_file));
     55    return $ret
     56  };
     57
     58  *CORE::GLOBAL::rmdir = \&vms_rmdir;
     59}
     60
    4361require "test_driver.pl";
     62require "config-flags.pm";
    4463
    4564# Some target systems might not have the POSIX module...
     
    6180   }
    6281
     82   if ($option =~ /^-srcdir$/i) {
     83       $srcdir = shift @argv;
     84       if (! -f "$srcdir/gnumake.h") {
     85           print "$option $srcdir: Not a valid GNU make source directory.\n";
     86           exit 0;
     87       }
     88       return 1;
     89   }
     90
    6391   if ($option =~ /^-all([-_]?tests)?$/i) {
    6492       $all_tests = 1;
     
    99127$old_makefile = undef;
    100128
     129sub subst_make_string
     130{
     131    local $_ = shift;
     132    $makefile and s/#MAKEFILE#/$makefile/g;
     133    s/#MAKEPATH#/$mkpath/g;
     134    s/#MAKE#/$make_name/g;
     135    s/#PERL#/$perl_name/g;
     136    s/#PWD#/$pwd/g;
     137    return $_;
     138}
     139
    101140sub run_make_test
    102141{
    103142  local ($makestring, $options, $answer, $err_code, $timeout) = @_;
     143  my @call = caller;
    104144
    105145  # If the user specified a makefile string, create a new makefile to contain
     
    116156    }
    117157
    118     # Make sure it ends in a newline.
     158    # Make sure it ends in a newline and substitute any special tokens.
    119159    $makestring && $makestring !~ /\n$/s and $makestring .= "\n";
    120 
    121     # Replace @MAKEFILE@ with the makefile name and @MAKE@ with the path to
    122     # make
    123     $makestring =~ s/#MAKEFILE#/$makefile/g;
    124     $makestring =~ s/#MAKEPATH#/$mkpath/g;
    125     $makestring =~ s/#MAKE#/$make_name/g;
    126     $makestring =~ s/#PERL#/$perl_name/g;
    127     $makestring =~ s/#PWD#/$pwd/g;
     160    $makestring = subst_make_string($makestring);
    128161
    129162    # Populate the makefile!
     
    134167
    135168  # Do the same processing on $answer as we did on $makestring.
    136 
    137   $answer && $answer !~ /\n$/s and $answer .= "\n";
    138   $answer =~ s/#MAKEFILE#/$makefile/g;
    139   $answer =~ s/#MAKEPATH#/$mkpath/g;
    140   $answer =~ s/#MAKE#/$make_name/g;
    141   $answer =~ s/#PERL#/$perl_name/g;
    142   $answer =~ s/#PWD#/$pwd/g;
     169  if (defined $answer) {
     170      $answer && $answer !~ /\n$/s and $answer .= "\n";
     171      $answer = subst_make_string($answer);
     172  }
    143173
    144174  run_make_with_options($makefile, $options, &get_logfile(0),
    145                         $err_code, $timeout);
     175                        $err_code, $timeout, @call);
    146176  &compare_output($answer, &get_logfile(1));
    147177
     
    152182# The old-fashioned way...
    153183sub run_make_with_options {
    154   local ($filename,$options,$logname,$expected_code,$timeout) = @_;
     184  my ($filename,$options,$logname,$expected_code,$timeout,@call) = @_;
     185  @call = caller unless @call;
    155186  local($code);
    156187  local($command) = $make_path;
     
    166197
    167198  if ($options) {
     199    if ($^O eq 'VMS') {
     200      # Try to make sure arguments are properly quoted.
     201      # This does not handle all cases.
     202
     203      # VMS uses double quotes instead of single quotes.
     204      $options =~ s/\'/\"/g;
     205
     206      # If the leading quote is inside non-whitespace, then the
     207      # quote must be doubled, because it will be enclosed in another
     208      # set of quotes.
     209      $options =~ s/(\S)(\".*\")/$1\"$2\"/g;
     210
     211      # Options must be quoted to preserve case if not already quoted.
     212      $options =~ s/(\S+)/\"$1\"/g;
     213
     214      # Special fixup for embedded quotes.
     215      $options =~ s/(\"\".+)\"(\s+)\"(.+\"\")/$1$2$3/g;
     216
     217      $options =~ s/(\A)(?:\"\")(.+)(?:\"\")/$1\"$2\"/g;
     218
     219      # Special fixup for misc/general4 test.
     220      $options =~ s/""\@echo" "cc""/\@echo cc"/;
     221      $options =~ s/"\@echo link"""/\@echo link"/;
     222
     223      # Remove shell escapes expected to be removed by bash
     224      if ($options !~ /path=pre/) {
     225        $options =~ s/\\//g;
     226      }
     227
     228      # special fixup for options/eval
     229      $options =~ s/"--eval=\$\(info" "eval/"--eval=\$\(info eval/;
     230
     231      print ("Options fixup = -$options-\n") if $debug;
     232    }
    168233    $command .= " $options";
    169234  }
    170235
    171   $command_string = "$command\n";
     236  $command_string = "";
     237  if (@call) {
     238      $command_string = "#$call[1]:$call[2]\n";
     239  }
     240  $command_string .= "$command\n";
    172241
    173242  if ($valgrind) {
     
    184253
    185254      $code = &run_command_with_output($logname,$command);
    186 
    187255      $test_timeout = $old_timeout;
    188256  }
     
    229297{
    230298   &print_standard_usage ("run_make_tests",
    231                           "[-make_path make_pathname] [-memcheck] [-massif]",);
     299                          "[-make MAKE_PATHNAME] [-srcdir SRCDIR] [-memcheck] [-massif]",);
    232300}
    233301
     
    235303{
    236304   &print_standard_help (
    237         "-make_path",
     305        "-make",
    238306        "\tYou may specify the pathname of the copy of make to run.",
     307        "-srcdir",
     308        "\tSpecify the make source directory.",
    239309        "-valgrind",
    240310        "-memcheck",
     
    296366     $port_type = 'OS/2';
    297367   }
     368
     369   # VMS has a GNV Unix mode or a DCL mode.
     370   # The SHELL environment variable should not be defined in VMS-DCL mode.
     371   elsif ($osname eq 'VMS' && !defined $ENV{"SHELL"}) {
     372     $port_type = 'VMS-DCL';
     373   }
    298374   # Everything else, right now, is UNIX.  Note that we should integrate
    299375   # the VOS support into this as well and get rid of $vos; we'll do
     
    313389   # Find the full pathname of Make.  For DOS systems this is more
    314390   # complicated, so we ask make itself.
    315    my $mk = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
    316    chop $mk;
    317    $mk or die "FATAL ERROR: Cannot determine the value of \$(MAKE):\n
     391   if ($osname eq 'VMS') {
     392     $port_type = 'VMS-DCL' unless defined $ENV{"SHELL"};
     393     # On VMS pre-setup make to be found with simply 'make'.
     394     $make_path = 'make';
     395   } else {
     396     my $mk = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
     397     chop $mk;
     398     $mk or die "FATAL ERROR: Cannot determine the value of \$(MAKE):\n
    318399'echo \"all:;\@echo \\\$(MAKE)\" | $make_path -f-' failed!\n";
    319    $make_path = $mk;
    320    print "Make\t= `$make_path'\n" if $debug;
    321 
    322    $string = `$make_path -v -f /dev/null 2> /dev/null`;
     400     $make_path = $mk;
     401   }
     402   print "Make\t= '$make_path'\n" if $debug;
     403
     404   my $redir2 = '2> /dev/null';
     405   $redir2 = '' if os_name eq 'VMS';
     406   $string = `$make_path -v -f /dev/null $redir2`;
    323407
    324408   $string =~ /^(GNU Make [^,\n]*)/;
    325409   $testee_version = "$1\n";
    326410
    327    $string = `sh -c "$make_path -f /dev/null 2>&1"`;
     411   my $redir = '2>&1';
     412   $redir = '' if os_name eq 'VMS';
     413   $string = `sh -c "$make_path -f /dev/null $redir"`;
    328414   if ($string =~ /(.*): \*\*\* No targets\.  Stop\./) {
    329415     $make_name = $1;
    330416   }
    331417   else {
    332      if ($make_path =~ /$pathsep([^\n$pathsep]*)$/) {
    333        $make_name = $1;
    334      }
    335      else {
    336        $make_name = $make_path;
    337      }
     418     $make_path =~ /^(?:.*$pathsep)?(.+)$/;
     419     $make_name = $1;
    338420   }
    339421
     
    349431   {
    350432      $mkpath = $make_path;
     433   }
     434
     435   # If srcdir wasn't provided on the command line, see if the
     436   # location of the make program gives us a clue.  Don't fail if not;
     437   # we'll assume it's been installed into /usr/include or wherever.
     438   if (! $srcdir) {
     439       $make_path =~ /^(.*$pathsep)?/;
     440       my $d = $1 || '../';
     441       -f "${d}gnumake.h" and $srcdir = $d;
     442   }
     443
     444   # Not with the make program, so see if we can get it out of the makefile
     445   if (! $srcdir && open(MF, "< ../Makefile")) {
     446       local $/ = undef;
     447       $_ = <MF>;
     448       close(MF);
     449       /^abs_srcdir\s*=\s*(.*?)\s*$/m;
     450       -f "$1/gnumake.h" and $srcdir = $1;
    351451   }
    352452
     
    360460   }
    361461
    362    $string = `sh -c "$make_path -j 2 -f /dev/null 2>&1"`;
     462   $string = `sh -c "$make_path -j 2 -f /dev/null $redir"`;
    363463   if ($string =~ /not supported/) {
    364464     $parallel_jobs = 0;
     
    368468   }
    369469
     470   %FEATURES = map { $_ => 1 } split /\s+/, `sh -c "echo '\\\$(info \\\$(.FEATURES))' | $make_path -f- 2>/dev/null"`;
     471
    370472   # Set up for valgrind, if requested.
     473
     474   $make_command = $make_path;
    371475
    372476   if ($valgrind) {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette