Changeset 503 for trunk/src/gmake/tests


Ignore:
Timestamp:
Sep 15, 2006, 7:09:38 AM (19 years ago)
Author:
bird
Message:

Untested merge with GNU Make v3.81 (vendor/gnumake/2005-05-16 -> vendor/gnumake/current).

Location:
trunk/src/gmake/tests
Files:
1 deleted
43 edited
9 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/tests/ChangeLog

    r281 r503  
     12006-04-01  Paul D. Smith  <psmith@gnu.org>
     2
     3        * scripts/functions/realpath: Don't run tests with multiple
     4        initial slashes on Windows: those paths mean something different.
     5
     62006-03-19  Paul D. Smith  <psmith@gnu.org>
     7
     8        * scripts/features/parallelism: Test that the jobserver is
     9        properly managed when we have to re-exec the master instance of
     10        make.
     11
     122006-03-17  Boris Kolpackov  <boris@kolpackov.net>
     13
     14        * scripts/features/statipattrules: Add tests for bug #16053.
     15
     162006-03-09  Paul Smith  <psmith@gnu.org>
     17
     18        * scripts/features/escape: Use "pre:" not "p:" to avoid conflicts
     19        with DOS drive letters.  Fixes Savannah bug #15947.
     20
     21        * test_driver.pl (run_each_test): Set the status properly even
     22        when a test fails to execute.  Fixes Savannah bug #15942.
     23
     24        * scripts/functions/foreach: Use a different environment variable
     25        other than PATH to avoid differences with Windows platforms.
     26        Fixes Savannah bug #15938.
     27
     282006-03-05  Paul D. Smith  <psmith@gnu.org>
     29
     30        * run_make_tests.pl (set_more_defaults): Add CYGWIN_NT as a port
     31        type W32.  Fixed Savannah bug #15937.
     32
     33        * scripts/features/default_names: Don't call error() when the test
     34        fails.  Fixes Savannah bug #15941.
     35
     362006-02-17  Paul D. Smith  <psmith@gnu.org>
     37
     38        * scripts/features/targetvars: Test a complex construction which
     39        guarantees that we have to merge variable lists of different
     40        sizes.  Tests for Savannah bug #15757.
     41
     422006-02-15  Paul D. Smith  <psmith@gnu.org>
     43
     44        * scripts/functions/error: Make sure filename/lineno information
     45        is related to where the error is expanded, not where it's set.
     46        * scripts/functions/warning: Ditto.
     47        * scripts/functions/foreach: Check for different error conditions.
     48        * scripts/functions/word: Ditto.
     49        * scripts/variables/negative: Test some variable reference failure
     50        conditions.
     51        * scripts/options/warn-undefined-variables: Test the
     52        --warn-undefined-variables flag.
     53
     542006-02-09  Paul D. Smith  <psmith@gnu.org>
     55
     56        * run_make_tests.pl (set_more_defaults): Update valgrind support
     57        for newer versions.
     58        * test_driver.pl (toplevel): Skip all hidden files/directories (ones
     59        beginning with ".").
     60
     61        * scripts/functions/andor: Tests for $(and ..) and $(or ...)
     62        functions.
     63
     642006-02-08  Boris Kolpackov  <boris@kolpackov.net>
     65
     66        * scripts/features/parallelism: Add a test for bug #15641.
     67
     682006-02-06  Paul D. Smith  <psmith@gnu.org>
     69
     70        * scripts/options/dash-W: Add a test for bug #15341.
     71
     722006-01-03  Paul D. Smith  <psmith@gnu.org>
     73
     74        * scripts/variables/automatic: Add a test for bug #8154.
     75
     76        * README: Update to reflect the current state of the test suite.
     77
     782005-12-12  Paul D. Smith  <psmith@gnu.org>
     79
     80        * scripts/features/parallelism, scripts/functions/wildcard,
     81        scripts/targets/FORCE, scripts/targets/PHONY,
     82        scripts/targets/SILENT: Use the default setting for
     83        $delete_command.  Fixes bug #15085.
     84
     85        * run_make_tests.pl (get_this_pwd) [VMS]: Use -no_ask with delete_file.
     86
     872005-12-11  Paul D. Smith  <psmith@gnu.org>
     88
     89        * scripts/misc/general4: Test implicit rules with '$' in the
     90        prereq list & prereq patterns.
     91        * scripts/features/se_implicit: Add in .SECONDEXPANSION settings.
     92
     932005-12-09  Boris Kolpackov  <boris@kolpackov.net>
     94
     95        * scripts/features/patternrules: Add a test for bug #13022.
     96
     972005-12-07  Boris Kolpackov  <boris@kolpackov.net>
     98
     99        * scripts/features/double_colon: Add a test for bug #14334.
     100
     1012005-11-17  Boris Kolpackov  <boris@kolpackov.net>
     102
     103        * scripts/functions/flavor: Add a test for the flavor function.
     104
     1052005-11-14  Boris Kolpackov  <boris@kolpackov.net>
     106
     107        * scripts/variables/INCLUDE_DIRS: Add a test for the .INCLUDE_DIRS
     108        special variable.
     109
     1102005-10-24  Paul D. Smith  <psmith@gnu.org>
     111
     112        * scripts/misc/general4: Test '$$' in prerequisites list.
     113        * scripts/features/statipattrules: Rewrite to use run_make_test().
     114        Add various static pattern info.
     115        * scripts/features/se_statpat: Enable .SECONDEXPANSION target.
     116        * scripts/features/se_explicit: Add tests for handling '$$' in
     117        prerequisite lists with and without setting .SECONDEXPANSION.
     118        * scripts/features/order_only: Convert to run_make_test().
     119        * run_make_tests.pl (set_more_defaults): If we can't get the value
     120        of $(MAKE) from make, then fatal immediately.
     121
     1222005-08-31  Paul D. Smith  <psmith@gnu.org>
     123
     124        * run_make_tests.pl (get_this_pwd): Require the POSIX module (in
     125        an eval to trap errors) and if it exists, use POSIX::getcwd to
     126        find the working directory.  If it doesn't exist, go back to the
     127        previous methods.  This tries to be more accurate on Windows
     128        systems.
     129
     1302005-08-29  Paul D. Smith  <psmith@gnu.org>
     131
     132        * scripts/functions/abspath: Add some text to the error messages
     133        to get a better idea of what's wrong.  Make warnings instead of
     134        errors.
     135
     136        * scripts/features/patspecific_vars: Don't use "test", which is
     137        UNIX specific.  Print the values and let the test script match
     138        them.
     139
     1402005-08-25  Paul Smith  <psmith@gnu.org>
     141
     142        * scripts/variables/SHELL: Use a /./ prefix instead of //: the
     143        former works better with non-UNIX environments.  Fixes Savannah
     144        bug #14129.
     145
     1462005-08-13  Boris Kolpackov  <boris@kolpackov.net>
     147
     148        * scripts/functions/wildcard: Wrap calls to $(wildcard ) with
     149        $(sort) so that the resulting order is no longer filesystem-
     150        dependant.
     151
     1522005-08-10  Boris Kolpackov  <boris@kolpackov.net>
     153
     154        * scripts/features/statipattrules: Add a test for Savannah bug #13881.
     155
     1562005-08-07  Paul D. Smith  <psmith@gnu.org>
     157
     158        * scripts/features/parallelism: Add a test for a bug reported by
     159        Michael Matz (matz@suse.de) in which make exits without waiting
     160        for all its children in some situations during parallel builds.
     161
     1622005-07-08  Paul D. Smith  <psmith@gnu.org>
     163
     164        * test_driver.pl: Reset the environment to a clean value every
     165        time before we invoke make.  I'm suspicious that the environment
     166        isn't handled the same way in Windows as it is in UNIX, and some
     167        variables are leaking out beyond the tests they are intended for.
     168        Create an %extraENV hash tests can set to add more env. vars.
     169        * tests/scripts/features/export: Change to use %extraENV.
     170        * tests/scripts/functions/eval: Ditto.
     171        * tests/scripts/functions/origin: Ditto.
     172        * tests/scripts/options/dash-e: Ditto.
     173        * tests/scripts/variables/SHELL: Ditto.
     174
     1752005-06-27  Paul D. Smith  <psmith@gnu.org>
     176
     177        * scripts/options/dash-W: Use 'echo >>' instead of touch to update
     178        files.
     179        * scripts/features/reinvoke: Rewrite to be safer on systems with
     180        subsecond timestamps.
     181        * scripts/features/patternrules: False exits with different error
     182        codes on different systems (for example, Linux => 1, Solaris => 255).
     183
     184        * scripts/options/dash-W: Set the timestamp to foo.x in the future,
     185        to be sure it will be considered updated when it's remade.
     186
     1872005-06-26  Paul D. Smith  <psmith@gnu.org>
     188
     189        * scripts/functions/shell: New test suite for the shell function.
     190
     1912005-06-25  Paul D. Smith  <psmith@gnu.org>
     192
     193        * scripts/features/include: Test include/-include/sinclude with no
     194        arguments.  Tests fix for Savannah bug #1761.
     195
     196        * scripts/misc/general3: Implement comprehensive testing of
     197        backslash-newline behavior in command scripts: various types of
     198        quoting, fast path / slow path, etc.
     199        Tests fix for Savannah bug #1332.
     200
     201        * scripts/options/symlinks: Test symlinks to non-existent files.
     202        Tests fix for Savannah bug #13280.
     203
     204        * scripts/misc/general3: Test semicolons in variable references.
     205        Tests fix for Savannah bug #1454.
     206
     207        * scripts/variables/MAKE_RESTARTS: New file: test the
     208        MAKE_RESTARTS variable.
     209        * scripts/options/dash-B: Test re-exec doesn't loop infinitely.
     210        Tests fix for Savannah bug #7566.
     211        * scripts/options/dash-W: New file: test the -W flag, including
     212        re-exec infinite looping.
     213
     2142005-06-12  Paul D. Smith  <psmith@gnu.org>
     215
     216        * scripts/misc/close_stdout: Add a test for Savannah bug #1328.
     217        This test only works on systems that have /dev/full (e.g., Linux).
     218
     2192005-06-09  Paul D. Smith  <psmith@gnu.org>
     220
     221        * scripts/functions/foreach: Add a test for Savannah bug #11913.
     222
     2232005-05-31  Boris Kolpackov  <boris@kolpackov.net>
     224
     225        * scripts/features/include: Add a test for Savannah bug #13216.
     226        * scripts/features/patternrules: Add a test for Savannah bug #13218.
     227
    12282005-05-13  Paul D. Smith  <psmith@gnu.org>
    2229
     
    3085352002-07-11  Paul D. Smith  <psmith@gnu.org>
    309536
    310         * run_make_tests.pl (valid_option): Add support for Valgrind
    311         <http://developer.kde.org/~sewardj/>.  Use -valgrind option to the
    312         test suite.
     537        * run_make_tests.pl (valid_option): Add support for Valgrind.  Use
     538        -valgrind option to the test suite.
    313539        (set_more_defaults): Set up the file descriptor to capture
    314540        Valgrind output.  We have to unset its close-on-exec flag; we
     
    594820
    595821        ChangeLog file for the test suite created.
     822
     823
     824
     825Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
     8262002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
     827This file is part of GNU Make.
     828
     829GNU Make is free software; you can redistribute it and/or modify it under the
     830terms of the GNU General Public License as published by the Free Software
     831Foundation; either version 2, or (at your option) any later version.
     832
     833GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     834WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     835A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     836
     837You should have received a copy of the GNU General Public License along with
     838GNU Make; see the file COPYING.  If not, write to the Free Software
     839Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  • trunk/src/gmake/tests/NEWS

    r53 r503  
    160160
    161161    Some new tests were added.
     162
     163
     164
     165-------------------------------------------------------------------------------
     166Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
     1672002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
     168This file is part of GNU Make.
     169
     170GNU Make is free software; you can redistribute it and/or modify it under the
     171terms of the GNU General Public License as published by the Free Software
     172Foundation; either version 2, or (at your option) any later version.
     173
     174GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     175WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     176A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     177
     178You should have received a copy of the GNU General Public License along with
     179GNU Make; see the file COPYING.  If not, write to the Free Software
     180Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  • trunk/src/gmake/tests/README

    r53 r503  
    1 This is release 3.78 (September 6, 1999) of the GNU make test
    2 suite.  See the file NEWS for some of the changes since the last
    3 release.
     1The test suite was originally written by Steve McGee and Chris Arthur.
     2It is covered by the GNU General Public License (Version 2), described
     3in the file COPYING.  It has been maintained as part of GNU make proper
     4since GNU make 3.78.
    45
    5 This release is made by psmith@gnu.org to correspond to GNU make 3.78.
    6 It won't work correctly for versions before that.  In addition to some
    7 infrastructure changes I've added a number of new tests.
     6This entire test suite, including all test files, are copyright and
     7distributed under the following terms:
    88
    9 Rob Tulloh has contributed changes to get the suite running on NT.
     9 -----------------------------------------------------------------------------
     10 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
     11 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
     12 This file is part of GNU Make.
    1013
    11 Eli Zaretskii and Esa A E Peuha <peuha@cc.helsinki.fi> have contributed
    12 changes to get the suite running on DJGPP/DOS.
     14 GNU Make is free software; you can redistribute it and/or modify it under the
     15 terms of the GNU General Public License as published by the Free Software
     16 Foundation; either version 2, or (at your option) any later version.
    1317
    14 This package has a number of problems which preclude me from
    15 distributing it with make as a default "make check" test suite.  The
    16 most serious of these is that it's not parallelizable: it scribbles all
    17 over its installation directory and so can only test one make at a
    18 time.  I simply don't have time to do more with this than I am so far;
    19 I'm very actively interested in finding someone willing to overhaul the
    20 test suite infrastructure.  If you're interested, contact me (see below)!
     18 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     19 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     20 A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
    2121
    22 The test suite thus far has been written by Steve McGee, Chris Arthur,
    23 and Paul D. Smith.  It is covered by the GNU General Public License
    24 (Version 2), described in the file COPYING.
     22 You should have received a copy of the GNU General Public License along with
     23 GNU Make; see the file COPYING.  If not, write to the Free Software
     24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     25 -----------------------------------------------------------------------------
    2526
    26 The test suite requires Perl and is known to work with Perl 4.036 and
    27 Perl 5.004 (available from ftp.gnu.org, and portable to many machines).
    28 Earlier or later versions may work; I don't know.  It assumes that the
    29 first "diff" it finds is GNU diff, but that only matters if a test
    30 fails.
     27The test suite requires Perl.  These days, you should have at least Perl
     285.004 (available from ftp.gnu.org, and portable to many machines).  It
     29used to work with Perl 4.036 but official support for Perl 4.x was
     30abandoned a long time ago, due to lack of testbeds, as well as interest.
     31
     32The test suite assumes that the first "diff" it finds on your PATH is
     33GNU diff, but that only matters if a test fails.
    3134
    3235To run the test suite on a UNIX system, use "perl ./run_make_tests"
     
    4447
    4548Tests cannot end with a "~" character, as the test suite will ignore any
    46 that do (I was tired of having it run my Emacs backup files as test :)
    47 
    48 If you want to run the tests in parallel, you should use the mkshadow
    49 script included here to create temporary "copies" (via symbolic links)
    50 of the test suite, one for each parallel job.  This is a pain and one
    51 day maybe the test suite will be rewritten so it's no longer
    52 necessary--volunteers welcome!
     49that do (I was tired of having it run my Emacs backup files as tests :))
    5350
    5451Also, sometimes the tests may behave strangely on networked
    5552filesystems.  You can use mkshadow to create a copy of the test suite in
    5653/tmp or similar, and try again.  If the error disappears, it's an issue
    57 with your network or file server, not GNU make (I believe).
     54with your network or file server, not GNU make (I believe).  This
     55shouldn't happen very often anymore: I've done a lot of work on the
     56tests to reduce the impacts of this situation.
    5857
    5958The options/dash-l test will not really test anything if the copy of
     
    7372other possible options for the test suite.
    7473
     74
     75Open Issues
     76-----------
     77
     78The test suite has a number of problems which should be addressed.  One
     79VERY serious one is that there is no real documentation.  You just have
     80to see the existing tests.  Use the newer tests: many of the tests
     81haven't been updated to use the latest/greatest test methods.  See the
     82ChangeLog in the tests directory for pointers.
     83
     84The second serious problem is that it's not parallelizable: it scribbles
     85all over its installation directory and so can only test one make at a
     86time.  The third serious problem is that it's not relocatable: the only
     87way it works when you build out of the source tree is to create
     88symlinks, which doesn't work on every system and is bogus to boot.  The
     89fourth serious problem is that it doesn't create its own sandbox when
     90running tests, so that if a test forgets to clean up after itself that
     91can impact future tests.
     92
     93
     94Bugs
     95----
     96
    7597Any complaints/suggestions/bugs/etc. for the test suite itself (as
    76 opposed to problems in make that the suite finds) should be sent to
    77 psmith@gnu.org.  Enjoy!
     98opposed to problems in make that the suite finds) should be handled the
     99same way as normal GNU make bugs/problems (see the README for GNU make).
     100
     101
    78102                                                Paul D. Smith
    79103                                                Chris Arthur
  • trunk/src/gmake/tests/mkshadow

    • Property svn:executable set to *
    r53 r503  
    44# Typically you'd put the shadow in /tmp or another local disk
    55#
     6# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
     7# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
     8# This file is part of GNU Make.
     9#
     10# GNU Make is free software; you can redistribute it and/or modify it under the
     11# terms of the GNU General Public License as published by the Free Software
     12# Foundation; either version 2, or (at your option) any later version.
     13#
     14# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     15# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     16# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     17#
     18# You should have received a copy of the GNU General Public License along with
     19# GNU Make; see the file COPYING.  If not, write to the Free Software
     20# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    621
    722case "$1" in
  • trunk/src/gmake/tests/run_make_tests

    • Property svn:executable set to *
  • trunk/src/gmake/tests/run_make_tests.pl

    • Property svn:executable set to *
    r281 r503  
    1212#                        (and others)
    1313
     14# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
     15# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
     16# This file is part of GNU Make.
     17#
     18# GNU Make is free software; you can redistribute it and/or modify it under the
     19# terms of the GNU General Public License as published by the Free Software
     20# Foundation; either version 2, or (at your option) any later version.
     21#
     22# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     23# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     24# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     25#
     26# You should have received a copy of the GNU General Public License along with
     27# GNU Make; see the file COPYING.  If not, write to the Free Software
     28# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     29
    1430$valgrind = 0;              # invoke make with valgrind
     31$valgrind_args = '--num-callers=15 --tool=memcheck --leak-check=full';
    1532$pure_log = undef;
    1633
    1734require "test_driver.pl";
     35
     36# Some target systems might not have the POSIX module...
     37$has_POSIX = eval { require "POSIX.pm" };
    1838
    1939#$SIG{INT} = sub { print STDERR "Caught a signal!\n"; die @_; };
     
    181201
    182202sub get_this_pwd {
    183   if ($vos) {
    184     $delete_command = "delete_file";
     203  $delete_command = 'rm -f';
     204  if ($has_POSIX) {
     205    $__pwd = POSIX::getcwd();
     206  } elsif ($vos) {
     207    $delete_command = "delete_file -no_ask";
    185208    $__pwd = `++(current_dir)`;
    186   }
    187   else {
    188     $delete_command = "rm";
     209  } else {
     210    # No idea... just try using pwd as a last resort.
    189211    chop ($__pwd = `pwd`);
    190212  }
     
    217239   # This is probably not specific enough.
    218240   #
    219    if ($osname =~ /Windows/i || $osname =~ /MINGW32/i) {
     241   if ($osname =~ /Windows/i || $osname =~ /MINGW32/i || $osname =~ /CYGWIN_NT/i) {
    220242     $port_type = 'W32';
    221243   }
     
    249271   # Find the full pathname of Make.  For DOS systems this is more
    250272   # complicated, so we ask make itself.
    251    $make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
    252    chop $make_path;
     273   my $mk = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
     274   chop $mk;
     275   $mk or die "FATAL ERROR: Cannot determine the value of \$(MAKE):\n
     276'echo \"all:;\@echo \\\$(MAKE)\" | $make_path -f-' failed!\n";
     277   $make_path = $mk;
    253278   print "Make\t= `$make_path'\n" if $debug;
    254279
     
    304329
    305330   if ($valgrind) {
    306 #     use POSIX qw(:fcntl_h);
    307 #     require Fcntl;
    308331     open(VALGRIND, "> valgrind.out")
    309332       || die "Cannot open valgrind.out: $!\n";
    310333     #  -q --leak-check=yes
    311      $make_path = "valgrind --num-callers=15 --logfile-fd=".fileno(VALGRIND)." $make_path";
     334     exists $ENV{VALGRIND_ARGS} and $valgrind_args = $ENV{VALGRIND_ARGS};
     335     $make_path = "valgrind --log-fd=".fileno(VALGRIND)." $valgrind_args $make_path";
    312336     # F_SETFD is 2
    313337     fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n";
  • trunk/src/gmake/tests/scripts/features/default_names

    r53 r503  
    88
    99open(MAKEFILE,"> $makefile");
    10 
    1110print MAKEFILE "FIRST: ; \@echo It chose GNUmakefile\n";
    12 
    1311close(MAKEFILE);
    1412
    1513# DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile.
    1614# Just test what we can here (avoid Makefile versus makefile test).
    17 #
    18 if ($port_type eq 'UNIX')
    19 {
     15
     16if ($port_type eq 'UNIX') {
    2017  # Create another makefile called "makefile"
    2118  open(MAKEFILE,"> makefile");
    22 
    2319  print MAKEFILE "SECOND: ; \@echo It chose makefile\n";
    24 
    2520  close(MAKEFILE);
    2621}
    2722
    28 
    2923# Create another makefile called "Makefile"
    3024open(MAKEFILE,"> Makefile");
    31 
    3225print MAKEFILE "THIRD: ; \@echo It chose Makefile\n";
    33 
    3426close(MAKEFILE);
    3527
    3628
    3729&run_make_with_options("","",&get_logfile);
    38 
    39 # Create the answer to what should be produced by this Makefile
    40 $answer = "It chose GNUmakefile\n";
    41 
    42 # COMPARE RESULTS
    43 
    44 &compare_output($answer,&get_logfile(1)) || &error("abort");
     30&compare_output("It chose GNUmakefile\n",&get_logfile(1));
    4531unlink $makefile;
    4632
    47 # DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile.
    48 # Just test what we can here (avoid Makefile versus makefile test).
    49 #
    50 if ($port_type eq 'UNIX')
    51 {
    52   $answer = "It chose makefile\n";
    53 
     33if ($port_type eq 'UNIX') {
    5434  &run_make_with_options("","",&get_logfile);
    55 
    56   &compare_output($answer,&get_logfile(1)) || &error("abort");
     35  &compare_output("It chose makefile\n",&get_logfile(1));
    5736  unlink "makefile";
    5837}
    5938
    60 $answer = "It chose Makefile\n";
    61 
    6239&run_make_with_options("","",&get_logfile);
    63 
    64 &compare_output($answer,&get_logfile(1)) || &error("abort");
     40&compare_output("It chose Makefile\n",&get_logfile(1));
    6541unlink "Makefile";
  • trunk/src/gmake/tests/scripts/features/double_colon

    r53 r503  
    125125unlink('foo','f1.h','f2.h');
    126126
     127
     128# TEST 9: make sure all rules in s double colon family get executed
     129#         (Savannah bug #14334).
     130#
     131
     132&touch('one');
     133&touch('two');
     134
     135run_make_test('
     136.PHONY: all
     137all: result
     138
     139result:: one
     140        @echo $^ >>$@
     141        @echo $^
     142
     143result:: two
     144        @echo $^ >>$@
     145        @echo $^
     146
     147',
     148'',
     149'one
     150two');
     151
     152unlink('result','one','two');
     153
     154# This tells the test driver that the perl test script executed properly.
    1271551;
  • trunk/src/gmake/tests/scripts/features/errors

    r281 r503  
     1#                                                                    -*-perl-*-
     2
    13$description = "The following tests the -i option and the '-' in front of \n"
    24              ."commands to test that make ignores errors in these commands\n"
     
    1517if ($vos)
    1618{
    17    $delete_command = "delete_file";
     19   $rm_command = "delete_file";
    1820}
    1921else
    2022{
    21    $delete_command = "rm";
     23   $rm_command = "rm";
    2224}
    2325
     
    2729
    2830print MAKEFILE "clean:\n"
    29               ."\t-$delete_command cleanit\n"
    30               ."\t$delete_command foo\n"
     31              ."\t-$rm_command cleanit\n"
     32              ."\t$rm_command foo\n"
    3133              ."clean2: \n"
    32               ."\t$delete_command cleanit\n"
    33               ."\t$delete_command foo\n";
     34              ."\t$rm_command cleanit\n"
     35              ."\t$rm_command foo\n";
    3436
    3537# END of Contents of MAKEFILE
     
    4042
    4143unlink("cleanit");
    42 $cleanit_error = `sh -c "$delete_command cleanit 2>&1"`;
     44$cleanit_error = `sh -c "$rm_command cleanit 2>&1"`;
    4345$delete_error_code = $? >> 8;
    4446
     
    4648# -------
    4749
    48 $answer = "$delete_command cleanit\n"
     50$answer = "$rm_command cleanit\n"
    4951         . $cleanit_error
    5052         ."$make_name: [clean] Error $delete_error_code (ignored)\n"
    51          ."$delete_command foo\n";
     53         ."$rm_command foo\n";
    5254
    5355&run_make_with_options($makefile,"",&get_logfile);
     
    7375# -------
    7476
    75 $answer = "$delete_command cleanit\n"
     77$answer = "$rm_command cleanit\n"
    7678         . $cleanit_error
    7779         ."$make_name: [clean2] Error $delete_error_code (ignored)\n"
    78          ."$delete_command foo\n";
     80         ."$rm_command foo\n";
    7981
    8082&run_make_with_options($makefile,"clean2 -i",&get_logfile);
  • trunk/src/gmake/tests/scripts/features/escape

    r53 r503  
    77Make sure that escaping of '#' works.";
    88
    9 open(MAKEFILE,"> $makefile");
    10 
    11 print MAKEFILE <<'EOF';
    12 $(path)foo : ; @echo cp $^ $@
    13 
    14 foo\ bar: ; @echo 'touch "$@"'
    15 
    16 sharp: foo\#bar.ext
    17 foo\#bar.ext: ; @echo foo\#bar.ext = '$@'
    18 EOF
    199
    2010close(MAKEFILE);
     
    2313# TEST 1
    2414
    25 &run_make_with_options($makefile, "", &get_logfile);
    26 $answer = "cp foo\n";
    27 &compare_output($answer,&get_logfile(1));
     15run_make_test('
     16$(path)foo : ; @echo "touch ($@)"
     17
     18foo\ bar: ; @echo "touch ($@)"
     19
     20sharp: foo\#bar.ext
     21foo\#bar.ext: ; @echo "foo#bar.ext = ($@)"',
     22              '',
     23              'touch (foo)');
    2824
    2925# TEST 2: This one should fail, since the ":" is unquoted.
    3026
    31 &run_make_with_options($makefile, "path=p:", &get_logfile, 512);
    32 $answer = "$makefile:1: *** target pattern contains no `%'.  Stop.\n";
    33 &compare_output($answer,&get_logfile(1));
     27run_make_test(undef,
     28              'path=pre:',
     29              "#MAKEFILE#:2: *** target pattern contains no `%'.  Stop.",
     30              512);
    3431
    3532# TEST 3: This one should work, since we escape the ":".
    3633
    37 &run_make_with_options($makefile, "'path=p\\:'", &get_logfile, 0);
    38 $answer = "cp p:foo\n";
    39 &compare_output($answer,&get_logfile(1));
     34run_make_test(undef,
     35              "'path=pre\\:'",
     36              'touch (pre:foo)');
    4037
    4138# TEST 4: This one should fail, since the escape char is escaped.
    4239
    43 &run_make_with_options($makefile, "'path=p\\\\:'", &get_logfile, 512);
    44 $answer = "$makefile:1: *** target pattern contains no `%'.  Stop.\n";
    45 &compare_output($answer,&get_logfile(1));
     40run_make_test(undef,
     41              "'path=pre\\\\:'",
     42              "#MAKEFILE#:2: *** target pattern contains no `%'.  Stop.",
     43              512);
    4644
    4745# TEST 5: This one should work
    4846
    49 &run_make_with_options($makefile, "'foo bar'", &get_logfile, 0);
    50 $answer = "touch \"foo bar\"\n";
    51 &compare_output($answer,&get_logfile(1));
     47run_make_test(undef,
     48              "'foo bar'",
     49              'touch (foo bar)');
    5250
    5351# TEST 6: Test escaped comments
    5452
    55 &run_make_with_options($makefile, "sharp", &get_logfile, 0);
    56 $answer = "foo#bar.ext = foo#bar.ext\n";
    57 &compare_output($answer,&get_logfile(1));
     53run_make_test(undef,
     54              'sharp',
     55              'foo#bar.ext = (foo#bar.ext)');
    5856
    5957# This tells the test driver that the perl test script executed properly.
  • trunk/src/gmake/tests/scripts/features/export

    r53 r503  
    5757# TEST 1: make sure vars inherited from the parent are exported
    5858
    59 $ENV{FOO} = 1;
     59$extraENV{FOO} = 1;
    6060
    6161&run_make_with_options($makefile,"",&get_logfile,0);
     
    6565
    6666&compare_output($answer,&get_logfile(1));
    67 
    68 delete $ENV{FOO};
    6967
    7068# TEST 2: global export.  Explicit unexport takes precedence.
     
    238236close(MAKEFILE);
    239237
    240 @ENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10);
     238@extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10);
    241239
    242240&run_make_with_options($makefile5,"",&get_logfile,0);
     
    244242&compare_output($answer,&get_logfile(1));
    245243
    246 delete @ENV{qw(A B C D E F G H I J)};
    247 
    248244
    249245# This tells the test driver that the perl test script executed properly.
  • trunk/src/gmake/tests/scripts/features/include

    r285 r503  
    7979  );
    8080
     81
    8182# Test inheritance of dontcare flag when rebuilding makefiles.
    8283#
     
    9192
    92931;
     94
     95
     96# Make sure that we don't die when the command fails but we dontcare.
     97# (Savannah bug #13216).
     98#
     99run_make_test('
     100.PHONY: all
     101all:; @:
     102
     103-include foo
     104
     105foo: bar; @:
     106
     107bar:; @exit 1
     108', '', '');
     109
     110# Check include, sinclude, -include with no filenames.
     111# (Savannah bug #1761).
     112
     113run_make_test('
     114.PHONY: all
     115all:; @:
     116include
     117-include
     118sinclude', '', '');
     119
     1201;
  • trunk/src/gmake/tests/scripts/features/order_only

    r285 r503  
    66prerequisites and ensure they behave properly.  Test the \$| variable.";
    77
    8 open(MAKEFILE,"> $makefile");
     8# TEST #0 -- Basics
    99
    10 print MAKEFILE <<'EOF';
     10run_make_test('
     11%r: | baz ; @echo $< $^ $|
     12bar: foo
     13foo:;@:
     14baz:;@:',
     15              '', "foo foo baz\n");
     16
     17# TEST #1 -- First try: the order-only prereqs need to be built.
     18
     19run_make_test(q!
    1120foo: bar | baz
    1221        @echo '$$^ = $^'
     
    1726
    1827bar baz:
    19         touch $@
    20 EOF
    21 
    22 close(MAKEFILE);
    23 
    24 
    25 # TEST #1 -- just the syntax
    26 
    27 &run_make_with_options($makefile, "", &get_logfile);
    28 $answer = "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n";
    29 &compare_output($answer,&get_logfile(1));
     28        touch $@!,
     29              '', "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n");
    3030
    3131
    3232# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated
    3333
    34 &run_make_with_options($makefile, "", &get_logfile);
    35 $answer = "touch baz\n";
    36 &compare_output($answer,&get_logfile(1));
     34run_make_test(undef, '', "touch baz\n");
    3735
    3836unlink(qw(foo bar baz));
    3937
    40 # Test prereqs that are both order and non-order
     38# TEST #3 -- Make sure the order-only prereq was promoted to normal.
    4139
    42 $makefile2 = &get_tmpfile;
    43 
    44 open(MAKEFILE,"> $makefile2");
    45 
    46 print MAKEFILE <<'EOF';
     40run_make_test(q!
    4741foo: bar | baz
    4842        @echo '$$^ = $^'
     
    5549
    5650bar baz:
    57         touch $@
    58 EOF
    59 
    60 close(MAKEFILE);
    61 
    62 # TEST #3 -- Make sure the order-only prereq was promoted to normal.
    63 
    64 &run_make_with_options($makefile2, "", &get_logfile);
    65 $answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";
    66 &compare_output($answer,&get_logfile(1));
     51        touch $@!,
     52              '', "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n");
    6753
    6854
    6955# TEST #4 -- now we do it again
    7056
    71 &run_make_with_options($makefile2, "", &get_logfile);
    72 $answer = "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";
    73 &compare_output($answer,&get_logfile(1));
     57run_make_test(undef, '', "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n");
    7458
    7559unlink(qw(foo bar baz));
     
    7761# Test empty normal prereqs
    7862
    79 $makefile3 = &get_tmpfile;
     63# TEST #5 -- make sure the parser was correct.
    8064
    81 open(MAKEFILE,"> $makefile3");
    82 
    83 print MAKEFILE <<'EOF';
     65run_make_test(q!
    8466foo:| baz
    8567        @echo '$$^ = $^'
     
    9072
    9173baz:
    92         touch $@
    93 EOF
    94 
    95 close(MAKEFILE);
    96 
    97 # TEST #5 -- make sure the parser was correct.
    98 
    99 &run_make_with_options($makefile3, "", &get_logfile);
    100 $answer = "touch baz\n\$^ = \n\$| = baz\ntouch foo\n";
    101 &compare_output($answer,&get_logfile(1));
    102 
     74        touch $@!,
     75              '', "touch baz\n\$^ = \n\$| = baz\ntouch foo\n");
    10376
    10477# TEST #6 -- now we do it again: this time foo won't be built
    10578
    106 &run_make_with_options($makefile3, "", &get_logfile);
    107 $answer = "touch baz\n";
    108 &compare_output($answer,&get_logfile(1));
     79run_make_test(undef, '', "touch baz\n");
    10980
    11081unlink(qw(foo baz));
     
    11283# Test order-only in pattern rules
    11384
    114 $makefile4 = &get_tmpfile;
     85# TEST #7 -- make sure the parser was correct.
    11586
    116 open(MAKEFILE,"> $makefile4");
    117 
    118 print MAKEFILE <<'EOF';
     87run_make_test(q!
    11988%.w : %.x | baz
    12089        @echo '$$^ = $^'
     
    12695.PHONY: baz
    12796foo.x baz:
    128         touch $@
    129 EOF
    130 
    131 close(MAKEFILE);
    132 
    133 # TEST #7 -- make sure the parser was correct.
    134 
    135 &run_make_with_options($makefile4, "", &get_logfile);
    136 $answer = "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n";
    137 &compare_output($answer,&get_logfile(1));
     97        touch $@!,
     98              '',
     99              "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n");
    138100
    139101# TEST #8 -- now we do it again: this time foo.w won't be built
    140102
    141 &run_make_with_options($makefile4, "", &get_logfile);
    142 $answer = "touch baz\n";
    143 &compare_output($answer,&get_logfile(1));
     103run_make_test(undef, '', "touch baz\n");
    144104
    145105unlink(qw(foo.w foo.x baz));
     
    152112bar: foo
    153113foo:;@:
    154 baz:;@:
    155 ', '', "foo foo baz\n");
     114baz:;@:',
     115              '', "foo foo baz\n");
    156116
    157117
  • trunk/src/gmake/tests/scripts/features/parallelism

    r285 r503  
    1919
    2020if ($vos) {
    21   $delete_command = "delete_file -no_ask";
    2221  $sleep_command = "sleep -seconds";
    2322}
    2423else {
    25   $delete_command = "rm -f";
    2624  $sleep_command = "sleep";
    2725}
     
    8482              '-j2', "first\nfirst\nsecond\nsecond");
    8583
     84# Michael Matz <matz@suse.de> reported a bug where if make is running in
     85# parallel without -k and two jobs die in a row, but not too close to each
     86# other, then make will quit without waiting for the rest of the jobs to die.
     87
     88run_make_test("
     89.PHONY: all fail.1 fail.2 fail.3 ok
     90all: fail.1 ok fail.2 fail.3
     91
     92fail.1 fail.2 fail.3:
     93        \@sleep \$(patsubst fail.%,%,\$\@)
     94        \@echo Fail
     95        \@exit 1
     96
     97ok:
     98        \@sleep 4
     99        \@echo Ok done",
     100              '-rR -j5', 'Fail
     101#MAKE#: *** [fail.1] Error 1
     102#MAKE#: *** Waiting for unfinished jobs....
     103Fail
     104#MAKE#: *** [fail.2] Error 1
     105Fail
     106#MAKE#: *** [fail.3] Error 1
     107Ok done',
     108             512);
     109
     110
     111# Test for Savannah bug #15641.
     112#
     113run_make_test('
     114.PHONY: all
     115all:; @:
     116
     117-include foo.d
     118
     119foo.d: comp
     120        @echo building $@
     121
     122comp: mod_a.o mod_b.o; @:
     123
     124mod_a.o mod_b.o:
     125        @exit 1
     126', '-j2', '');
     127
     128
     129# Make sure that all jobserver FDs are closed if we need to re-exec the
     130# master copy.
     131#
     132# First, find the "default" file descriptors we normally use
     133# Then make sure they're still used.
     134#
     135# Right now we don't have a way to run a makefile and capture the output
     136# without checking it, so we can't really write this test.
     137
     138# run_make_test('
     139# submake: ; @$(MAKE) --no-print-directory -f #MAKEFILE# fdprint 5>output
     140
     141# dependfile: ; @echo FOO=bar > $@
     142
     143# INCL := true
     144
     145# FOO=foo
     146# ifeq ($(INCL),true)
     147# -include dependfile
     148# endif
     149
     150# fdprint: ; @echo $(filter --jobserver%,$(MAKEFLAGS))
     151
     152# recurse: ; @$(MAKE) --no-print-directory -f #MAKEFILE# submake INCL=true',
     153#               '-j2 INCL=false fdprint',
     154#               'bar');
     155
     156# unlink('dependfile', 'output');
     157
     158
     159# # Do it again, this time where the include is done by the non-master make.
     160# run_make_test(undef, '-j2 recurse INCL=false', 'bar');
     161
     162# unlink('dependfile', 'output');
     163
    861641;
  • trunk/src/gmake/tests/scripts/features/patspecific_vars

    r285 r503  
    6868
    6969/bar:
    70         @test "$(foo)" = "$$foo"
    71 ', '', '');
     70        @echo $(foo) $$foo
     71', '', 'foo foo');
    7272
    7373
  • trunk/src/gmake/tests/scripts/features/patternrules

    r282 r503  
    2424# 1 - existing file
    2525%.1: void
    26         @false
     26        @exit 1
    2727%.1: #MAKEFILE#
    28         @true
     28        @exit 0
    2929
    3030# 2 - phony
    3131%.2: void
    32         @false
     32        @exit 1
    3333%.2: 2.phony
    34         @true
     34        @exit 0
    3535.PHONY: 2.phony
    3636
    3737# 3 - implicit-phony
    3838%.3: void
    39         @false
     39        @exit 1
    4040%.3: 3.implicit-phony
    41         @true
     41        @exit 0
    4242
    43433.implicit-phony:
     
    9696unlink("$dir/foo.c");
    9797
     98
     99# TEST #4: make sure precious flag is set properly for targets
     100#          that are built via implicit rules (Savannah bug #13218).
     101#
     102run_make_test('
     103.DELETE_ON_ERROR:
     104
     105.PRECIOUS: %.bar
     106
     107%.bar:; @touch $@ && exit 1
     108
     109$(dir)/foo.bar:
     110
     111',
     112"dir=$dir",
     113"#MAKE#: *** [$dir/foo.bar] Error 1",
     114512);
     115
     116unlink("$dir/foo.bar");
     117
     118
     119# TEST #5: make sure targets of a macthed implicit pattern rule never
     120#          never considered intermediate (Savannah bug #13022).
     121#
     122run_make_test('
     123.PHONY: all
     124all: foo.c foo.o
     125
     126%.h %.c: %.in
     127        touch $*.h
     128        touch $*.c
     129
     130%.o: %.c %.h
     131        echo $+ >$@
     132
     133%.o: %.c
     134        @echo wrong rule
     135
     136foo.in:
     137        touch $@
     138
     139',
     140'',
     141'touch foo.in
     142touch foo.h
     143touch foo.c
     144echo foo.c foo.h >foo.o');
     145
     146unlink('foo.in', 'foo.h', 'foo.c', 'foo.o');
     147
    98148# This tells the test driver that the perl test script executed properly.
    991491;
  • trunk/src/gmake/tests/scripts/features/reinvoke

    r53 r503  
    88file, then touch the temp file to make it newer than the makefile.";
    99
    10 $makefile2 = &get_tmpfile;
    11 $makefile_orig = &get_tmpfile;
     10$omkfile = $makefile;
    1211
    13 open(MAKEFILE,"> $makefile");
     12&utouch(-600, 'incl.mk');
     13# For some reason if we don't do this then the test fails for systems
     14# with sub-second timestamps, maybe + NFS?  Not sure.
     15&utouch(-1, 'incl-1.mk');
    1416
    15 print MAKEFILE <<EOM;
     17run_make_test('
     18all: ; @echo running rules.
    1619
    17 all: ; \@echo 'running rules.'
     20#MAKEFILE# incl.mk: incl-1.mk
     21        @echo rebuilding $@
     22        @echo >> $@
    1823
    19 $makefile $makefile2: $makefile_orig
    20         \@echo 'rebuilding \$\@.'
    21         \@echo >> \$\@
     24include incl.mk',
     25              '', "rebuilding incl.mk\nrunning rules.\n");
    2226
    23 include $makefile2
     27# Make sure updating the makefile itself also works
    2428
    25 EOM
     29&utouch(-600, $omkfile);
    2630
    27 close(MAKEFILE);
     31run_make_test(undef, '', "rebuilding #MAKEFILE#\nrunning rules.\n");
    2832
    29 &utouch(-10, $makefile, $makefile2);
    30 &touch($makefile_orig);
     33&rmfiles('incl.mk', 'incl-1.mk');
    3134
    32 &run_make_with_options($makefile, "", &get_logfile, 0);
    33 
    34 # Create the answer to what should be produced by this Makefile
    35 
    36 $answer = "rebuilding $makefile2.\nrebuilding $makefile.\nrunning rules.\n";
    37 
    38 &compare_output($answer,&get_logfile(1))
    39   && unlink "$makefile_orig";
    4035
    4136# In this test we create an included file that's out-of-date, but then
    4237# the rule doesn't update it.  Make shouldn't re-exec.
    4338
    44 $makefile3 = &get_tmpfile;
     39&utouch(-600, 'b','a');
     40#&utouch(-10, 'a');
     41&touch('c');
    4542
    46 open(MAKEFILE, "> $makefile3");
    47 print MAKEFILE <<'EOM';
     43run_make_test('
    4844SHELL = /bin/sh
    4945
     
    5652c: ; echo >> $@
    5753
    58 include $(F)
    59 EOM
    60 
    61 close(MAKEFILE);
    62 
    63 &utouch(-20, 'b','a');
    64 #&utouch(-10, 'a');
    65 &touch('c');
    66 
    67 # First try with the file that's not updated "once removed" from the
    68 # file we're including.
    69 
    70 &run_make_with_options($makefile3, "F=a", &get_logfile, 0);
    71 
    72 $answer = "[ -f b ] || echo >> b\nhello\n";
    73 &compare_output($answer,&get_logfile(1));
     54include $(F)',
     55              'F=a', "[ -f b ] || echo >> b\nhello\n");
    7456
    7557# Now try with the file we're not updating being the actual file we're
    7658# including: this and the previous one test different parts of the code.
    7759
    78 &run_make_with_options($makefile3, "F=b", &get_logfile, 0);
     60run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n")
    7961
    80 $answer = "[ -f b ] || echo >> b\nhello\n";
    81 &compare_output($answer,&get_logfile(1));
    82 
    83 unlink('a','b','c');
     62&rmfiles('a','b','c');
    8463
    8564# This tells the test driver that the perl test script executed properly.
  • trunk/src/gmake/tests/scripts/features/se_explicit

    r282 r503  
    44$details = "";
    55
    6 # Test #1: automatic variables.
     6# TEST #0: Test handing of '$' in prerequisites with and without second
     7# expansion.
     8
     9run_make_test(q!
     10ifdef SE
     11  .SECONDEXPANSION:
     12endif
     13foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^'
     14PRE = one two
     15bar$$baz: $$(PRE)
     16baraz: $$(PRE)
     17PRE = three four
     18.DEFAULT: ; @echo '$@'
     19!,
     20              '',
     21              "\$\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz");
     22
     23run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz");
     24
     25# TEST #1: automatic variables.
    726#
    827run_make_test('
     28.SECONDEXPANSION:
    929.DEFAULT: ; @echo $@
    1030
     
    4262#
    4363run_make_test('
     64.SECONDEXPANSION:
    4465.DEFAULT: ; @echo $@
    4566
     
    6081#
    6182run_make_test('
     83.SECONDEXPANSION:
    6284.DEFAULT: ; @echo $@
    6385
  • trunk/src/gmake/tests/scripts/features/se_implicit

    r282 r503  
    1313#
    1414run_make_test('
     15.SECONDEXPANSION:
    1516.DEFAULT: ; @echo $@
    1617
     
    6162#
    6263run_make_test('
     64.SECONDEXPANSION:
    6365foo.x:
    6466
     
    8284#
    8385run_make_test('
     86.SECONDEXPANSION:
    8487.DEFAULT: ; @echo $@
    8588
     
    133136#
    134137run_make_test('
     138.SECONDEXPANSION:
    135139$(dir)/tmp/bar.o:
    136140
     
    154158#
    155159run_make_test('
     160.SECONDEXPANSION:
    156161$(dir)/tmp/foo.o: $(dir)/tmp/foo.c
    157162$(dir)/tmp/foo.c: ; @echo $@
     
    172177#
    173178run_make_test('
     179.SECONDEXPANSION:
    174180foo.o: foo.c
    175181foo.c: ; @echo $@
     
    187193#
    188194run_make_test('
     195.SECONDEXPANSION:
    189196foobarbaz:
    190197
     
    205212#
    206213run_make_test('
     214.SECONDEXPANSION:
    207215foo$$bar:
    208216
  • trunk/src/gmake/tests/scripts/features/se_statpat

    r282 r503  
    77#
    88run_make_test('
     9.SECONDEXPANSION:
    910.DEFAULT: ; @echo $@
    1011
     
    4243#
    4344run_make_test('
     45.SECONDEXPANSION:
    4446.DEFAULT: ; @echo $@
    4547
     
    6163#
    6264run_make_test('
     65.SECONDEXPANSION:
    6366.DEFAULT: ; @echo $@
    6467
     
    107110#
    108111run_make_test('
     112.SECONDEXPANSION:
    109113foo$$bar: f%r: % $$*.1
    110114        @echo \'$*\'
  • trunk/src/gmake/tests/scripts/features/statipattrules

    r285 r503  
    1010to emacs a .el file";
    1111
    12 open(MAKEFILE,"> $makefile");
    13 print MAKEFILE <<'EOF';
     12&touch('bar.c', 'lose.c');
     13
     14#   TEST #0
     15#   -------
     16
     17run_make_test('
    1418files = foo.elc bar.o lose.o
    1519
     
    1721
    1822$(filter %.elc,$(files)): %.elc: %.el ; @echo emacs $<
    19 EOF
    20 close(MAKEFILE);
     23',
     24              '',
     25              'CC -c bar.c -o bar.o');
     26
     27#  TEST #1
     28#  -------
     29
     30run_make_test(undef, 'lose.o', 'CC -c lose.c -o lose.o');
    2131
    2232
    23 &touch('bar.c', 'lose.c');
    24 
    25 #   TEST #1
    26 #   -------
    27 
    28 &run_make_with_options($makefile, '', &get_logfile);
    29 $answer = "CC -c bar.c -o bar.o\n";
    30 &compare_output($answer, &get_logfile(1));
    31 
    32 
    33 #  TEST #2
    34 #  -------
    35 
    36 &run_make_with_options($makefile, 'lose.o', &get_logfile);
    37 $answer = "CC -c lose.c -o lose.o\n";
    38 &compare_output($answer, &get_logfile(1));
    39 
    40 
    41 #   TEST #3
     33#   TEST #2
    4234#   -------
    4335&touch("foo.el");
    4436
    45 &run_make_with_options($makefile, 'foo.elc', &get_logfile);
    46 $answer = "emacs foo.el\n";
    47 &compare_output($answer, &get_logfile(1));
     37run_make_test(undef, 'foo.elc', 'emacs foo.el');
    4838
    49 
     39# Clean up after the first tests.
    5040unlink('foo.el', 'bar.c', 'lose.c');
    5141
    5242
    53 # TEST #4 -- PR/1670: don't core dump on invalid static pattern rules
     43# TEST #3 -- PR/1670: don't core dump on invalid static pattern rules
    5444# -------
    5545
    56 $makefile2 = &get_tmpfile;
    57 open(MAKEFILE, "> $makefile2");
    58 print MAKEFILE "foo: foo%: % ; \@echo \$@\n";
    59 close(MAKEFILE);
     46run_make_test('
     47.DEFAULT: ; @echo $@
     48foo: foo%: % %.x % % % y.% % ; @echo $@
     49',
     50              '', ".x\ny.\nfoo");
    6051
    61 &run_make_with_options($makefile2, '', &get_logfile);
    62 $answer = "foo\n";
    63 &compare_output($answer, &get_logfile(1));
    6452
    65 # TEST #5 -- bug #12180: core dump on a stat pattern rule with an empty
     53# TEST #4 -- bug #12180: core dump on a stat pattern rule with an empty
    6654#                        prerequisite list.
    67 #
    6855run_make_test('
    6956foo.x bar.x: %.x : ; @echo $@
    7057
    7158',
     59              '', 'foo.x');
     60
     61
     62# TEST #5 -- bug #13881: double colon static pattern rule does not
     63#                        substitute %.
     64run_make_test('
     65foo.bar:: %.bar: %.baz
     66foo.baz: ;@:
     67',
     68              '', '');
     69
     70
     71# TEST #6: make sure the second stem does not overwrite the first
     72#          perprerequisite's stem (Savannah bug #16053).
     73#
     74run_make_test('
     75all.foo.bar: %.foo.bar: %.one
     76
     77all.foo.bar: %.bar: %.two
     78
     79all.foo.bar:
     80        @echo $*
     81        @echo $^
     82
     83.DEFAULT:;@:
     84',
    7285'',
    73 'foo.x
    74 ');
     86'all.foo
     87all.one all.foo.two');
     88
     89
     90# TEST #7: make sure the second stem does not overwrite the first
     91#          perprerequisite's stem when second expansion is enabled
     92#          (Savannah bug #16053).
     93#
     94run_make_test('
     95.SECONDEXPANSION:
     96
     97all.foo.bar: %.foo.bar: %.one $$*-one
     98
     99all.foo.bar: %.bar: %.two $$*-two
     100
     101all.foo.bar:
     102        @echo $*
     103        @echo $^
     104
     105.DEFAULT:;@:
     106',
     107'',
     108'all.foo
     109all.one all-one all.foo.two all.foo-two');
    75110
    761111;
  • trunk/src/gmake/tests/scripts/features/targetvars

    r53 r503  
    268268&compare_output($answer, &get_logfile(1));
    269269
     270# TEST #17
     271
     272# Test a merge of set_lists for files, where one list is much longer
     273# than the other.  See Savannah bug #15757.
     274
     275mkdir('t1', 0777);
     276touch('t1/rules.mk');
     277
     278run_make_test('
     279VPATH = t1
     280include rules.mk
     281.PHONY: all
     282all: foo.x
     283foo.x : rules.mk ; @echo MYVAR=$(MYVAR) FOOVAR=$(FOOVAR) ALLVAR=$(ALLVAR)
     284all: ALLVAR = xxx
     285foo.x: FOOVAR = bar
     286rules.mk : MYVAR = foo
     287.INTERMEDIATE: foo.x rules.mk
     288',
     289              '-I t1',
     290              'MYVAR= FOOVAR=bar ALLVAR=xxx');
     291
     292rmfiles('t1/rules.mk');
     293rmdir('t1');
     294
     295# TEST #18
     296
     297# Test appending to a simple variable containing a "$": avoid a
     298# double-expansion.  See Savannah bug #15913.
     299
     300run_make_test("
     301VAR := \$\$FOO
     302foo: VAR += BAR
     303foo: ; \@echo '\$(VAR)'",
     304              '',
     305              '$FOO BAR');
     306
    2703071;
  • trunk/src/gmake/tests/scripts/functions/abspath

    r282 r503  
    66run_make_test('
    77ifneq ($(realpath $(abspath .)),$(CURDIR))
    8   $(error )
     8  $(warning .: abs="$(abspath .)" real="$(realpath $(abspath .))" curdir="$(CURDIR)")
    99endif
    1010
    1111ifneq ($(realpath $(abspath ./)),$(CURDIR))
    12   $(error )
     12  $(warning ./: abs="$(abspath ./)" real="$(realpath $(abspath ./))" curdir="$(CURDIR)")
    1313endif
    1414
    1515ifneq ($(realpath $(abspath .///)),$(CURDIR))
    16   $(error )
     16  $(warning .///: abs="$(abspath .///)" real="$(realpath $(abspath .///))" curdir="$(CURDIR)")
    1717endif
    1818
    1919ifneq ($(abspath /),/)
    20   $(error )
     20  $(warning /: abspath="$(abspath /)")
    2121endif
    2222
    2323ifneq ($(abspath ///),/)
    24   $(error )
     24  $(warning ///: abspath="$(abspath ///)")
    2525endif
    2626
    2727ifneq ($(abspath /.),/)
    28   $(error )
     28  $(warning /.: abspath="$(abspath /.)")
    2929endif
    3030
    3131ifneq ($(abspath ///.),/)
    32   $(error )
     32  $(warning ///.: abspath="$(abspath ///.)")
    3333endif
    3434
    3535ifneq ($(abspath /./),/)
    36   $(error )
     36  $(warning /./: abspath="$(abspath /./)")
    3737endif
    3838
    3939ifneq ($(abspath /.///),/)
    40   $(error )
     40  $(warning /.///: abspath="$(abspath /.///)")
    4141endif
    4242
    4343ifneq ($(abspath /..),/)
    44   $(error )
     44  $(warning /..: abspath="$(abspath /..)")
    4545endif
    4646
    4747ifneq ($(abspath ///..),/)
    48   $(error )
     48  $(warning ///..: abspath="$(abspath ///..)")
    4949endif
    5050
    5151ifneq ($(abspath /../),/)
    52   $(error )
     52  $(warning /../: abspath="$(abspath /../)")
    5353endif
    5454
    5555ifneq ($(abspath /..///),/)
    56   $(error )
     56  $(warning /..///: abspath="$(abspath /..///)")
    5757endif
    5858
    5959
    6060ifneq ($(abspath /foo/bar/..),/foo)
    61   $(error )
     61  $(warning /foo/bar/..: abspath="$(abspath /foo/bar/..)")
    6262endif
    6363
    6464ifneq ($(abspath /foo/bar/../../../baz),/baz)
    65   $(error )
     65  $(warning /foo/bar/../../../baz: abspath="$(abspath /foo/bar/../../../baz)")
    6666endif
    6767
    6868ifneq ($(abspath /foo/bar/../ /..),/foo /)
    69   $(error )
     69  $(warning /foo/bar/../ /..: abspath="$(abspath /foo/bar/../ /..)")
    7070endif
    7171
  • trunk/src/gmake/tests/scripts/functions/error

    r53 r503  
     1#                                                                    -*-Perl-*-
     2
    13$description = "\
    24The following test creates a makefile to test the error function.";
     
    68open(MAKEFILE,"> $makefile");
    79
    8 print MAKEFILE <<'EOF';
     10print MAKEFILE 'err = $(error Error found!)
     11
    912ifdef ERROR1
    1013$(error error is $(ERROR1))
     
    2629some: ; @echo Some stuff
    2730
    28 EOF
     31testvar: ; @: $(err)
     32';
    2933
    3034close(MAKEFILE);
     
    3337
    3438&run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512);
    35 $answer = "$makefile:2: *** error is yes.  Stop.\n";
     39$answer = "$makefile:4: *** error is yes.  Stop.\n";
    3640&compare_output($answer,&get_logfile(1));
    3741
     
    3943
    4044&run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512);
    41 $answer = "$makefile:6: *** error is no.  Stop.\n";
     45$answer = "$makefile:8: *** error is no.  Stop.\n";
    4246&compare_output($answer,&get_logfile(1));
    4347
     
    4549
    4650&run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512);
    47 $answer = "Some stuff\n$makefile:10: *** error is maybe.  Stop.\n";
     51$answer = "Some stuff\n$makefile:12: *** error is maybe.  Stop.\n";
    4852&compare_output($answer,&get_logfile(1));
    4953
     
    5155
    5256&run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512);
    53 $answer = "Some stuff\n$makefile:14: *** error is definitely.  Stop.\n";
     57$answer = "Some stuff\n$makefile:16: *** error is definitely.  Stop.\n";
     58&compare_output($answer,&get_logfile(1));
     59
     60# Test #5
     61
     62&run_make_with_options($makefile, "testvar", &get_logfile, 512);
     63$answer = "$makefile:22: *** Error found!.  Stop.\n";
    5464&compare_output($answer,&get_logfile(1));
    5565
  • trunk/src/gmake/tests/scripts/functions/eval

    r285 r503  
    128128close(MAKEFILE);
    129129
    130 $ENV{EVAR} = '1';
     130$extraENV{EVAR} = '1';
    131131&run_make_with_options($makefile4, "", &get_logfile);
    132132$answer = "OK\n";
    133133&compare_output($answer,&get_logfile(1));
    134 
    135 delete $ENV{EVAR};
    136134
    137135
     
    152150run_make_test('
    153151define FOO
    154 all: ; @echo he\llo
     152all: ; @echo '."'".'he\llo'."'".'
    155153        @echo world
    156154endef
    157155$(eval $(FOO))
    158 ', '', 'hello
     156', '', 'he\llo
    159157world');
    160158
  • trunk/src/gmake/tests/scripts/functions/foreach

    r53 r503  
    11#                                                                    -*-perl-*-
     2# $Id: foreach,v 1.5 2006/03/10 02:20:46 psmith Exp $
    23
    3 # Updated 6.16.93  variable "MAKE" is default was environment override
    4 # For make 3.63 and above
    5 
    6 $description = "The following test creates a makefile to verify
    7 test the foreach function.";
     4$description = "Test the foreach function.";
    85
    96$details = "This is a test of the foreach function in gnu make.
     
    1512
    1613
    17 open(MAKEFILE,"> $makefile");
     14# TEST 0
    1815
    19 # The Contents of the MAKEFILE ...
     16# Set an environment variable that we can test in the makefile.
     17$extraENV{FOOFOO} = 'foo foo';
    2018
    21 # On WIN32 systems, the user's path is found in %Path% ($Path)
    22 #
    23 $pathvar = (($port_type eq 'Windows') ? "Path" : "PATH");
     19run_make_test("space = ' '".'
     20null :=
     21auto_var = udef space CC null FOOFOO MAKE foo CFLAGS WHITE @ <
     22foo = bletch null @ garf
     23av = $(foreach var, $(auto_var), $(origin $(var)) )
     24override WHITE := BLACK
     25for_var = $(addsuffix .c,foo $(null) $(foo) $(space) $(av) )
     26fe = $(foreach var2, $(for_var),$(subst .c,.o, $(var2) ) )
     27all: auto for2
     28auto : ; @echo $(av)
     29for2: ; @echo $(fe)',
     30              '-e WHITE=WHITE CFLAGS=',
     31              "undefined file default file environment default file command line override automatic automatic
     32foo.o bletch.o null.o @.o garf.o .o    .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o");
    2433
    25 print MAKEFILE <<EOF;
    26 foo = bletch null \@ garf
    27 null :=
    28 space = ' '
    29 auto_var = udef space CC null $pathvar MAKE foo CFLAGS WHITE \@ <
    30 av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
    31 override WHITE := BLACK
    32 for_var = \$(addsuffix .c,foo \$(null) \$(foo) \$(space) \$(av) )
    33 fe = \$(foreach var2, \$(for_var),\$(subst .c,.o, \$(var2) ) )
    34 all: auto for2
    35 auto :
    36 \t\@echo \$(av)
    37 for2:
    38 \t\@echo \$(fe)
    39 EOF
     34delete $extraENV{FOOFOO};
    4035
    41 close(MAKEFILE);
     36# TEST 1: Test that foreach variables take precedence over global
     37# variables in a global scope (like inside an eval).  Tests bug #11913
    4238
    43 &run_make_with_options($makefile,
    44                       "-e WHITE=WHITE CFLAGS=",
    45                       &get_logfile);
     39run_make_test('
     40.PHONY: all target
     41all: target
    4642
    47 # Create the answer to what should be produced by this Makefile
    48 $answer = "undefined file default file environment default file command line override automatic automatic
    49 foo.o bletch.o null.o @.o garf.o .o    .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o\n";
     43x := BAD
    5044
    51 &compare_output($answer,&get_logfile(1));
     45define mktarget
     46target: x := $(x)
     47target: ; @echo "$(x)"
     48endef
     49
     50x := GLOBAL
     51
     52$(foreach x,FOREACH,$(eval $(value mktarget)))',
     53              '',
     54              'FOREACH');
     55
     56
     57# TEST 2: Check some error conditions.
     58
     59run_make_test('
     60x = $(foreach )
     61y = $x
     62
     63all: ; @echo $y',
     64              '',
     65              "#MAKEFILE#:2: *** insufficient number of arguments (1) to function `foreach'.  Stop.",
     66              512);
     67
     68run_make_test('
     69x = $(foreach )
     70y := $x
     71
     72all: ; @echo $y',
     73              '',
     74              "#MAKEFILE#:2: *** insufficient number of arguments (1) to function `foreach'.  Stop.",
     75              512);
    5276
    53771;
  • trunk/src/gmake/tests/scripts/functions/origin

    r154 r503  
    1717
    1818# Set an environment variable
    19 $ENV{MAKETEST} = 1;
     19$extraENV{MAKETEST} = 1;
    2020
    21 open(MAKEFILE,"> $makefile");
    22 
    23 print MAKEFILE <<EOF;
     21run_make_test('
    2422foo := bletch garf
    25 auto_var = udef CC MAKETEST MAKE foo CFLAGS WHITE \@
    26 av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
     23auto_var = undefined CC MAKETEST MAKE foo CFLAGS WHITE @
     24av = $(foreach var, $(auto_var), $(origin $(var)) )
    2725override WHITE := BLACK
    2826all: auto
    29 \t\@echo \$(origin undefined)
    30 \t\@echo \$(origin CC)
    31 \t\@echo \$(origin MAKETEST)
    32 \t\@echo \$(origin MAKE)
    33 \t\@echo \$(origin foo)
    34 \t\@echo \$(origin CFLAGS)
    35 \t\@echo \$(origin WHITE)
    36 \t\@echo \$(origin \@)
     27        @echo $(origin undefined)
     28        @echo $(origin CC)
     29        @echo $(origin MAKETEST)
     30        @echo $(origin MAKE)
     31        @echo $(origin foo)
     32        @echo $(origin CFLAGS)
     33        @echo $(origin WHITE)
     34        @echo $(origin @)
    3735auto :
    38 \t\@echo \$(av)
    39 EOF
    40 
    41 close(MAKEFILE);
    42 
    43 &run_make_with_options($makefile,
    44                       "-e WHITE=WHITE CFLAGS=",
    45                       &get_logfile);
    46 
    47 # Create the answer to what should be produced by this Makefile
    48 $answer = "undefined default environment default file command line override automatic
     36        @echo $(av)',
     37              '-e WHITE=WHITE CFLAGS=',
     38              'undefined default environment default file command line override automatic
    4939undefined
    5040default
     
    5444command line
    5545override
    56 automatic\n";
     46automatic');
    5747
    58 
    59 &compare_output($answer,&get_logfile(1));
     48# Reset an environment variable
     49delete $extraENV{MAKETEST};
    6050
    61511;
  • trunk/src/gmake/tests/scripts/functions/realpath

    r282 r503  
    2121endif
    2222
    23 ifneq ($(realpath ///),/)
    24   $(error )
    25 endif
    26 
    2723ifneq ($(realpath /.),/)
    28   $(error )
    29 endif
    30 
    31 ifneq ($(realpath ///.),/)
    3224  $(error )
    3325endif
     
    4234
    4335ifneq ($(realpath /..),/)
    44   $(error )
    45 endif
    46 
    47 ifneq ($(realpath ///..),/)
    4836  $(error )
    4937endif
     
    6452all: ; @:
    6553',
    66 '',
    67 '');
     54              '',
     55              '');
     56
     57# On Windows platforms, "//" means something special.  So, don't do these
     58# tests there.
     59
     60if ($port_type ne 'W32') {
     61  run_make_test('
     62ifneq ($(realpath ///),/)
     63  $(error )
     64endif
     65
     66ifneq ($(realpath ///.),/)
     67  $(error )
     68endif
     69
     70ifneq ($(realpath ///..),/)
     71  $(error )
     72endif
     73
     74.PHONY: all
     75all: ; @:',
     76                '',
     77                '');
     78}
    6879
    6980
  • trunk/src/gmake/tests/scripts/functions/warning

    r53 r503  
     1#                                                                    -*-Perl-*-
     2
    13$description = "\
    24The following test creates a makefile to test the warning function.";
  • trunk/src/gmake/tests/scripts/functions/wildcard

    r285 r503  
    1414the '*' wildcard as in the first test";
    1515
    16 if ($vos)
    17 {
    18    $delete_command = "delete_file -no_ask";
    19 }
    20 else
    21 {
    22    $delete_command = "rm";
    23 }
    24 
    25 
    2616open(MAKEFILE,"> $makefile");
    2717
     
    3020print MAKEFILE <<EOM;
    3121.PHONY: print1 print2 clean
    32 print1: ;\@echo \$(wildcard example.*)
     22print1: ;\@echo \$(sort \$(wildcard example.*))
    3323print2:
    34 \t\@echo \$(wildcard example.?)
    35 \t\@echo \$(wildcard example.[a-z0-9])
    36 \t\@echo \$(wildcard example.[!A-Za-z_\\!])
     24\t\@echo \$(sort \$(wildcard example.?))
     25\t\@echo \$(sort \$(wildcard example.[a-z0-9]))
     26\t\@echo \$(sort \$(wildcard example.[!A-Za-z_\\!]))
    3727clean:
    38 \t$delete_command \$(wildcard example.*)
     28\t$delete_command \$(sort \$(wildcard example.*))
    3929EOM
    4030
  • trunk/src/gmake/tests/scripts/functions/word

    r285 r503  
    4747# Test error conditions
    4848
    49 $makefile2 = &get_tmpfile;
    50 
    51 open(MAKEFILE, "> $makefile2");
    52 print MAKEFILE <<'EOF';
    53 FOO = foo bar biz baz
     49run_make_test('FOO = foo bar biz baz
    5450
    5551word-e1: ; @echo $(word ,$(FOO))
     
    5955wordlist-e1: ; @echo $(wordlist ,,$(FOO))
    6056wordlist-e2: ; @echo $(wordlist abc ,,$(FOO))
    61 wordlist-e3: ; @echo $(wordlist 1, 12a ,$(FOO))
     57wordlist-e3: ; @echo $(wordlist 1, 12a ,$(FOO))',
     58              'word-e1',
     59              "#MAKEFILE#:3: *** non-numeric first argument to `word' function: ''.  Stop.",
     60              512);
    6261
    63 EOF
     62run_make_test(undef,
     63              'word-e2',
     64              "#MAKEFILE#:4: *** non-numeric first argument to `word' function: 'abc '.  Stop.",
     65              512);
    6466
    65 close(MAKEFILE);
     67run_make_test(undef,
     68              'word-e3',
     69              "#MAKEFILE#:5: *** non-numeric first argument to `word' function: '1a'.  Stop.",
     70              512);
    6671
    67 &run_make_with_options($makefile2, 'word-e1', &get_logfile, 512);
    68 $answer = "$makefile2:3: *** non-numeric first argument to `word' function: ''.  Stop.\n";
    69 &compare_output($answer, &get_logfile(1));
     72run_make_test(undef,
     73              'wordlist-e1',
     74              "#MAKEFILE#:7: *** non-numeric first argument to `wordlist' function: ''.  Stop.",
     75              512);
    7076
    71 &run_make_with_options($makefile2, 'word-e2', &get_logfile, 512);
    72 $answer = "$makefile2:4: *** non-numeric first argument to `word' function: 'abc '.  Stop.\n";
    73 &compare_output($answer, &get_logfile(1));
     77run_make_test(undef,
     78              'wordlist-e2',
     79              "#MAKEFILE#:8: *** non-numeric first argument to `wordlist' function: 'abc '.  Stop.",
     80              512);
    7481
    75 &run_make_with_options($makefile2, 'word-e3', &get_logfile, 512);
    76 $answer = "$makefile2:5: *** non-numeric first argument to `word' function: '1a'.  Stop.\n";
    77 &compare_output($answer, &get_logfile(1));
     82run_make_test(undef,
     83              'wordlist-e3',
     84              "#MAKEFILE#:9: *** non-numeric second argument to `wordlist' function: ' 12a '.  Stop.",
     85              512);
    7886
    79 &run_make_with_options($makefile2, 'wordlist-e1', &get_logfile, 512);
    80 $answer = "$makefile2:7: *** non-numeric first argument to `wordlist' function: ''.  Stop.\n";
    81 &compare_output($answer, &get_logfile(1));
     87# Test error conditions again, but this time in a variable reference
    8288
    83 &run_make_with_options($makefile2, 'wordlist-e2', &get_logfile, 512);
    84 $answer = "$makefile2:8: *** non-numeric first argument to `wordlist' function: 'abc '.  Stop.\n";
    85 &compare_output($answer, &get_logfile(1));
     89run_make_test('FOO = foo bar biz baz
    8690
    87 &run_make_with_options($makefile2, 'wordlist-e3', &get_logfile, 512);
    88 $answer = "$makefile2:9: *** non-numeric second argument to `wordlist' function: ' 12a '.  Stop.\n";
    89 &compare_output($answer, &get_logfile(1));
     91W = $(word $x,$(FOO))
     92WL = $(wordlist $s,$e,$(FOO))
     93
     94word-e: ; @echo $(W)
     95wordlist-e: ; @echo $(WL)',
     96              'word-e x=',
     97              "#MAKEFILE#:3: *** non-numeric first argument to `word' function: ''.  Stop.",
     98              512);
     99
     100run_make_test(undef,
     101              'word-e x=abc',
     102              "#MAKEFILE#:3: *** non-numeric first argument to `word' function: 'abc'.  Stop.",
     103              512);
     104
     105run_make_test(undef,
     106              'word-e x=0',
     107              "#MAKEFILE#:3: *** first argument to `word' function must be greater than 0.  Stop.",
     108              512);
     109
     110run_make_test(undef,
     111              'wordlist-e s= e=',
     112              "#MAKEFILE#:4: *** non-numeric first argument to `wordlist' function: ''.  Stop.",
     113              512);
     114
     115run_make_test(undef,
     116              'wordlist-e s=abc e=',
     117              "#MAKEFILE#:4: *** non-numeric first argument to `wordlist' function: 'abc'.  Stop.",
     118              512);
     119
     120run_make_test(undef,
     121              'wordlist-e s=4 e=12a',
     122              "#MAKEFILE#:4: *** non-numeric second argument to `wordlist' function: '12a'.  Stop.",
     123              512);
     124
     125run_make_test(undef,
     126              'wordlist-e s=0 e=12',
     127              "#MAKEFILE#:4: *** invalid first argument to `wordlist' function: `0'.  Stop.",
     128              512);
    90129
    91130
  • trunk/src/gmake/tests/scripts/misc/general3

    r53 r503  
    66break.";
    77
    8 $makefile2 = &get_tmpfile;
    9 
    10 open(MAKEFILE,"> $makefile");
    11 
    12 # The contents of the Makefile ...
    13 
    14 print MAKEFILE <<EOF;
     8run_make_test("
    159# We want to allow both empty commands _and_ commands that resolve to empty.
    1610EMPTY =
     
    3226\$(STR)
    3327
    34 \$(STR) \$(TAB)
    35 
    36 EOF
    37 
    38 close(MAKEFILE);
    39 
    40 &run_make_with_options($makefile,"",&get_logfile);
    41 $answer = "$make_name: Nothing to be done for `all'.\n";
    42 &compare_output($answer,&get_logfile(1));
    43 
     28\$(STR) \$(TAB)",
     29              '', "#MAKE#: Nothing to be done for `all'.");
    4430
    4531# TEST 2
    4632
    4733# Make sure files without trailing newlines are handled properly.
     34# Have to use the old style invocation to test this.
     35
     36$makefile2 = &get_tmpfile;
    4837
    4938open(MAKEFILE, "> $makefile2");
     
    5544&compare_output($answer,&get_logfile(1));
    5645
     46# TEST 3
     47
     48# Check semicolons in variable references
     49
     50run_make_test('
     51$(if true,$(info true; true))
     52all: ; @:
     53',
     54              '', 'true; true');
     55
     56# TEST 4
     57
     58# Check that backslashes in command scripts are handled according to POSIX.
     59# Checks Savannah bug # 1332.
     60
     61# Test the fastpath / no quotes
     62run_make_test('
     63all:
     64        @echo foo\
     65bar
     66        @echo foo\
     67        bar
     68        @echo foo\
     69    bar
     70        @echo foo\
     71            bar
     72        @echo foo \
     73bar
     74        @echo foo \
     75        bar
     76        @echo foo \
     77    bar
     78        @echo foo \
     79            bar
     80',
     81              '', 'foobar
     82foobar
     83foo bar
     84foo bar
     85foo bar
     86foo bar
     87foo bar
     88foo bar');
     89
     90# Test the fastpath / single quotes
     91run_make_test("
     92all:
     93        \@echo 'foo\\
     94bar'
     95        \@echo 'foo\\
     96        bar'
     97        \@echo 'foo\\
     98    bar'
     99        \@echo 'foo\\
     100            bar'
     101        \@echo 'foo \\
     102bar'
     103        \@echo 'foo \\
     104        bar'
     105        \@echo 'foo \\
     106    bar'
     107        \@echo 'foo \\
     108            bar'
     109",
     110              '', 'foo\
     111bar
     112foo\
     113bar
     114foo\
     115    bar
     116foo\
     117    bar
     118foo \
     119bar
     120foo \
     121bar
     122foo \
     123    bar
     124foo \
     125    bar');
     126
     127# Test the fastpath / double quotes
     128run_make_test('
     129all:
     130        @echo "foo\
     131bar"
     132        @echo "foo\
     133        bar"
     134        @echo "foo\
     135    bar"
     136        @echo "foo\
     137            bar"
     138        @echo "foo \
     139bar"
     140        @echo "foo \
     141        bar"
     142        @echo "foo \
     143    bar"
     144        @echo "foo \
     145            bar"
     146',
     147              '', 'foobar
     148foobar
     149foo    bar
     150foo    bar
     151foo bar
     152foo bar
     153foo     bar
     154foo     bar');
     155
     156# Test the slow path / no quotes
     157run_make_test('
     158all:
     159        @echo hi; echo foo\
     160bar
     161        @echo hi; echo foo\
     162        bar
     163        @echo hi; echo foo\
     164 bar
     165        @echo hi; echo foo\
     166         bar
     167        @echo hi; echo foo \
     168bar
     169        @echo hi; echo foo \
     170        bar
     171        @echo hi; echo foo \
     172 bar
     173        @echo hi; echo foo \
     174         bar
     175',
     176              '', 'hi
     177foobar
     178hi
     179foobar
     180hi
     181foo bar
     182hi
     183foo bar
     184hi
     185foo bar
     186hi
     187foo bar
     188hi
     189foo bar
     190hi
     191foo bar');
     192
     193# Test the slow path / no quotes.  This time we put the slow path
     194# determination _after_ the backslash-newline handling.
     195run_make_test('
     196all:
     197        @echo foo\
     198bar; echo hi
     199        @echo foo\
     200        bar; echo hi
     201        @echo foo\
     202 bar; echo hi
     203        @echo foo\
     204         bar; echo hi
     205        @echo foo \
     206bar; echo hi
     207        @echo foo \
     208        bar; echo hi
     209        @echo foo \
     210 bar; echo hi
     211        @echo foo \
     212         bar; echo hi
     213',
     214              '', 'foobar
     215hi
     216foobar
     217hi
     218foo bar
     219hi
     220foo bar
     221hi
     222foo bar
     223hi
     224foo bar
     225hi
     226foo bar
     227hi
     228foo bar
     229hi');
     230
     231# Test the slow path / single quotes
     232run_make_test("
     233all:
     234        \@echo hi; echo 'foo\\
     235bar'
     236        \@echo hi; echo 'foo\\
     237        bar'
     238        \@echo hi; echo 'foo\\
     239    bar'
     240        \@echo hi; echo 'foo\\
     241            bar'
     242        \@echo hi; echo 'foo \\
     243bar'
     244        \@echo hi; echo 'foo \\
     245        bar'
     246        \@echo hi; echo 'foo \\
     247    bar'
     248        \@echo hi; echo 'foo \\
     249            bar'
     250",
     251              '', 'hi
     252foo\
     253bar
     254hi
     255foo\
     256bar
     257hi
     258foo\
     259    bar
     260hi
     261foo\
     262    bar
     263hi
     264foo \
     265bar
     266hi
     267foo \
     268bar
     269hi
     270foo \
     271    bar
     272hi
     273foo \
     274    bar');
     275
     276# Test the slow path / double quotes
     277run_make_test('
     278all:
     279        @echo hi; echo "foo\
     280bar"
     281        @echo hi; echo "foo\
     282        bar"
     283        @echo hi; echo "foo\
     284    bar"
     285        @echo hi; echo "foo\
     286            bar"
     287        @echo hi; echo "foo \
     288bar"
     289        @echo hi; echo "foo \
     290        bar"
     291        @echo hi; echo "foo \
     292    bar"
     293        @echo hi; echo "foo \
     294            bar"
     295',
     296              '', 'hi
     297foobar
     298hi
     299foobar
     300hi
     301foo    bar
     302hi
     303foo    bar
     304hi
     305foo bar
     306hi
     307foo bar
     308hi
     309foo     bar
     310hi
     311foo     bar');
    57312
    583131;
  • trunk/src/gmake/tests/scripts/misc/general4

    r285 r503  
    66break.";
    77
    8 open(MAKEFILE,"> $makefile");
    9 print MAKEFILE <<'EOF';
     8run_make_test('
    109# Make sure that subdirectories built as prerequisites are actually handled
    1110# properly.
     
    1716dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b
    1817
    19 dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@
    20 EOF
    21 close(MAKEFILE);
    22 
    23 &run_make_with_options($makefile,"",&get_logfile);
    24 $answer = "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n";
    25 &compare_output($answer,&get_logfile(1));
     18dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@',
     19              '', "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n");
    2620
    2721# Test implicit rules
     
    4842unlink('bar');
    4943
     44
     45# Test implicit rules with '$' in the name (see se_implicit)
     46
     47run_make_test(q!
     48%.foo : baz$$bar ; @echo 'done $<'
     49%.foo : bar$$baz ; @echo 'done $<'
     50test.foo:
     51baz$$bar bar$$baz: ; @echo '$@'
     52!,
     53              '',
     54              "baz\$bar\ndone baz\$bar");
     55
     56
     57# Test implicit rules with '$' in the name (see se_implicit)
     58# Use the '$' in the pattern.
     59
     60run_make_test(q!
     61%.foo : %$$bar ; @echo 'done $<'
     62test.foo:
     63test$$bar: ; @echo '$@'
     64!,
     65              '',
     66              "test\$bar\ndone test\$bar");
     67
     68# Make sure that subdirectories built as prerequisites are actually handled
     69# properly... this time with '$'
     70
     71run_make_test(q!
     72
     73all: dir/subdir/file.$$a
     74
     75dir/subdir: ; @echo mkdir -p '$@'
     76
     77dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'
     78
     79dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@'
     80!,
     81              '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");
     82
    50831;
  • trunk/src/gmake/tests/scripts/options/dash-B

    r285 r503  
    3232run_make_test(undef, '-B', 'cp bar.x foo');
    3333
    34 
    3534# Clean up
    3635
    3736rmfiles('bar.x', 'foo');
    3837
     38# Test -B with the re-exec feature: we don't want to re-exec forever
     39# Savannah bug # 7566
     40
     41run_make_test('
     42all: ; @:
     43$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
     44include foo.x
     45foo.x: ; @touch $@
     46',
     47              '-B', 'MAKE_RESTARTS=
     48#MAKEFILE#:4: foo.x: No such file or directory
     49MAKE_RESTARTS=1');
     50
     51rmfiles('foo.x');
     52
     53# Test -B with the re-exec feature: we DO want -B in the "normal" part of the
     54# makefile.
     55
     56&touch('blah.x');
     57
     58run_make_test('
     59all: blah.x ; @echo $@
     60$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
     61include foo.x
     62foo.x: ; @touch $@
     63blah.x: ; @echo $@
     64',
     65              '-B', 'MAKE_RESTARTS=
     66#MAKEFILE#:4: foo.x: No such file or directory
     67MAKE_RESTARTS=1
     68blah.x
     69all');
     70
     71rmfiles('foo.x', 'blah.x');
     72
    39731;
  • trunk/src/gmake/tests/scripts/options/dash-I

    r53 r503  
     1#                                                                    -*-perl-*-
     2
    13$description ="The following test creates a makefile to test the -I option.";
    24
  • trunk/src/gmake/tests/scripts/options/dash-e

    r53 r503  
    55$details = "";
    66
    7 $ENV{GOOGLE} = 'boggle';
     7$extraENV{GOOGLE} = 'boggle';
    88
    99open(MAKEFILE,"> $makefile");
  • trunk/src/gmake/tests/scripts/options/symlinks

    r282 r503  
    66
    77# Only run these tests if the system sypports symlinks
    8 if (eval { symlink("",""); 1 }) {
     8
     9# Apparently the Windows port of Perl reports that it does support symlinks
     10# (in that the symlink() function doesn't fail) but it really doesn't, so
     11# check for it explicitly.
     12
     13if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) {
     14  # This test is N/A
     15  -1;
     16} else {
    917
    1018  # Set up a symlink sym -> dep
     
    4351
    4452  rmfiles('targ', 'dep', 'sym', 'dep1');
     53
     54  # Check handling when symlinks point to non-existent files.  Without -L we
     55  # should get an error: with -L we should use the timestamp of the symlink.
     56
     57  symlink("../$dirname/dep", 'sym');
     58  run_make_test('targ: sym ; @echo make $@ from $<', '',
     59                "#MAKE#: *** No rule to make target `sym', needed by `targ'.  Stop.", 512);
     60
     61  run_make_test('targ: sym ; @echo make $@ from $<', '-L',
     62                'make targ from sym');
     63
     64
     65  rmfiles('targ', 'sym');
     66
     67  1;
    4568}
    46 
    47 1;
  • trunk/src/gmake/tests/scripts/targets/FORCE

    r285 r503  
     1#                                                                    -*-perl-*-
     2
    13$description = "The following tests rules without Commands or Dependencies.";
    24
    35$details = "If the rule ...\n";
    4 
    5 if ($vos)
    6 {
    7    $delete_command = "delete_file";
    8 }
    9 else
    10 {
    11    $delete_command = "rm";
    12 }
    136
    147open(MAKEFILE,"> $makefile");
  • trunk/src/gmake/tests/scripts/targets/PHONY

    r285 r503  
     1#                                                                    -*-perl-*-
     2
    13$description = "The following tests the use of a PHONY target.  It makes\n"
    24              ."sure that the rules under a target get executed even if\n"
     
    810          ."directory.  Although this file exists, the rule under the target\n"
    911          ."clean should still execute because of it's phony status.";
    10 
    11 if ($vos)
    12 {
    13    $delete_command = "delete_file";
    14 }
    15 else
    16 {
    17    $delete_command = "rm";
    18 }
    1912
    2013$example = "EXAMPLE_FILE";
  • trunk/src/gmake/tests/scripts/targets/SILENT

    r285 r503  
     1#                                                                    -*-perl-*-
     2
    13$description = "The following tests the special target .SILENT.  By simply\n"
    24              ."mentioning this as a target, it tells make not to print\n"
     
    57$details = "This test is the same as the clean test except that it should\n"
    68          ."not echo its command before deleting the specified file.\n";
    7 
    8 if ($vos)
    9 {
    10    $delete_command = "delete_file";
    11 }
    12 else
    13 {
    14    $delete_command = "rm";
    15 }
    169
    1710$example = "EXAMPLE_FILE";
  • trunk/src/gmake/tests/scripts/variables/SHELL

    r282 r503  
    55# Find the default value when SHELL is not set.  On UNIX it will be /bin/sh,
    66# but on other platforms who knows?
    7 $oshell = $ENV{SHELL};
     7resetENV();
    88delete $ENV{SHELL};
    9 $mshell = `echo 'all:;\@echo \$(SHELL)' | $make_name -f-`;
     9$mshell = `echo 'all:;\@echo \$(SHELL)' | $make_path -f-`;
    1010chop $mshell;
    1111
    1212# According to POSIX, the value of SHELL in the environment has no impact on
    1313# the value in the makefile.
     14# Note %extraENV takes precedence over the default value for the shell.
    1415
    15 $ENV{SHELL} = '/dev/null';
     16$extraENV{SHELL} = '/dev/null';
    1617run_make_test('all:;@echo "$(SHELL)"', '', $mshell);
    1718
     
    1920# exported to the subshell!  I wanted to set SHELL to be $^X (perl) in the
    2021# makefile, but make runs $(SHELL) -c 'commandline' and that doesn't work at
    21 # all when $(SHELL) is perl :-/.  So, we just add an extra initial / and hope
    22 # for the best on non-UNIX platforms :-/.
     22# all when $(SHELL) is perl :-/.  So, we just add an extra initial /./ which
     23# works well on UNIX and seems to work OK on at least some non-UNIX systems.
    2324
    24 $ENV{SHELL} = $mshell;
     25$extraENV{SHELL} = $mshell;
    2526
    26 run_make_test("SHELL := /$mshell\n".'
     27run_make_test("SHELL := /./$mshell\n".'
    2728all:;@echo "$(SHELL) $$SHELL"
    28 ', '', "/$mshell $mshell");
     29', '', "/./$mshell $mshell");
    2930
    3031# As a GNU make extension, if make's SHELL variable is explicitly exported,
    3132# then we really _DO_ export it.
    3233
    33 run_make_test("export SHELL := /$mshell\n".'
     34$extraENV{SHELL} = $mshell;
     35
     36run_make_test("export SHELL := /./$mshell\n".'
    3437all:;@echo "$(SHELL) $$SHELL"
    35 ', '', "/$mshell /$mshell");
     38', '', "/./$mshell /./$mshell");
    3639
    3740
     
    3942# variable.
    4043
    41 run_make_test("all: SHELL := /$mshell\n".'
     44$extraENV{SHELL} = $mshell;
     45
     46run_make_test("all: SHELL := /./$mshell\n".'
    4247all:;@echo "$(SHELL) $$SHELL"
    43 ', '', "/$mshell $mshell");
     48', '', "/./$mshell $mshell");
    4449
    45 run_make_test("all: export SHELL := /$mshell\n".'
     50$extraENV{SHELL} = $mshell;
     51
     52run_make_test("all: export SHELL := /./$mshell\n".'
    4653all:;@echo "$(SHELL) $$SHELL"
    47 ', '', "/$mshell $mshell");
     54', '', "/./$mshell $mshell");
    4855
    49561;
  • trunk/src/gmake/tests/scripts/variables/automatic

    r285 r503  
    2828close(MAKEFILE);
    2929
    30 # TEST #1 -- simple test
     30# TEST #0 -- simple test
    3131# -------
    3232
     
    4747unlink(qw(foo.x bar.y baz.z));
    4848
    49 # TEST #2 -- test the SysV emulation of $$@ etc.
     49# TEST #1 -- test the SysV emulation of $$@ etc.
    5050# -------
    5151
     
    5555print MAKEFILE "dir = $dir\n";
    5656print MAKEFILE <<'EOF';
     57.SECONDEXPANSION:
    5758.SUFFIXES:
    5859.DEFAULT: ; @echo '$@'
     
    7980&compare_output($answer, &get_logfile(1));
    8081
    81 # TEST #3 -- test for Savannah bug #12320.
     82# TEST #2 -- test for Savannah bug #12320.
    8283#
    8384run_make_test('
     
    8788        @echo $*
    8889
    89 mbr.src: ; @:
     90mbr.src: ; @:',
     91              '',
     92              'mbr');
    9093
    91 ',
    92 '',
    93 'mbr
    94 ');
     94# TEST #3 -- test for Savannah bug #8154
     95# Make sure that nonexistent prerequisites are listed in $?, since they are
     96# considered reasons for the target to be rebuilt.
     97#
     98# This was undone due to Savannah bug #16002.  We'll re-do it in the next
     99# release.  See Savannah bug #16051.
     100
     101#touch('foo');
     102#
     103#run_make_test('
     104#foo: bar ; @echo "\$$? = $?"
     105#bar: ;',
     106#              '',
     107#              '$? = bar');
     108#
     109#unlink('foo');
    95110
    961111;
  • trunk/src/gmake/tests/test_driver.pl

    r281 r503  
    11#!/usr/bin/perl
    22# -*-perl-*-
    3 
     3#
    44# Modification history:
    55# Written 91-12-02 through 92-01-01 by Stephen McGee.
    66# Modified 92-02-11 through 92-02-22 by Chris Arthur to further generalize.
    7 # End of modification history
     7#
     8# Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
     9# 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
     10# This file is part of GNU Make.
     11#
     12# GNU Make is free software; you can redistribute it and/or modify it under the
     13# terms of the GNU General Public License as published by the Free Software
     14# Foundation; either version 2, or (at your option) any later version.
     15#
     16# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     17# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     18# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License along with
     21# GNU Make; see the file COPYING.  If not, write to the Free Software
     22# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     23
    824
    925# Test driver routines used by a number of test suites, including
    1026# those for SCS, make, roll_dir, and scan_deps (?).
    11 
     27#
    1228# this routine controls the whole mess; each test suite sets up a few
    1329# variables and then calls &toplevel, which does all the real work.
    1430
    15 # $Id: test_driver.pl,v 1.14 2005/02/28 07:48:23 psmith Exp $
     31# $Id: test_driver.pl,v 1.19 2006/03/10 02:20:45 psmith Exp $
    1632
    1733
     
    3349$test_passed = 1;
    3450
     51
     52# %makeENV is the cleaned-out environment.
     53%makeENV = ();
     54
     55# %extraENV are any extra environment variables the tests might want to set.
     56# These are RESET AFTER EVERY TEST!
     57%extraENV = ();
     58
     59# %origENV is the caller's original environment
     60%origENV = %ENV;
     61
     62sub resetENV
     63{
     64  # We used to say "%ENV = ();" but this doesn't work in Perl 5.000
     65  # through Perl 5.004.  It was fixed in Perl 5.004_01, but we don't
     66  # want to require that here, so just delete each one individually.
     67  foreach $v (keys %ENV) {
     68    delete $ENV{$v};
     69  }
     70
     71  %ENV = %makeENV;
     72  foreach $v (keys %extraENV) {
     73    $ENV{$v} = $extraENV{$v};
     74    delete $extraENV{$v};
     75  }
     76}
     77
    3578sub toplevel
    3679{
    37   # Get a clean environment
    38 
    39   %makeENV = ();
    40 
    4180  # Pull in benign variables from the user's environment
    4281  #
     
    5897  %origENV = %ENV;
    5998
    60   # We used to say "%ENV = ();" but this doesn't work in Perl 5.000
    61   # through Perl 5.004.  It was fixed in Perl 5.004_01, but we don't
    62   # want to require that here, so just delete each one individually.
    63 
    64   foreach $v (keys %ENV) {
    65     delete $ENV{$v};
    66   }
    67 
    68   %ENV = %makeENV;
     99  resetENV();
    69100
    70101  $| = 1;                     # unbuffered output
     
    134165    opendir (SCRIPTDIR, $scriptpath)
    135166        || &error ("Couldn't opendir $scriptpath: $!\n");
    136     @dirs = grep (!/^(\.\.?|CVS|RCS)$/, readdir (SCRIPTDIR) );
     167    @dirs = grep (!/^(\..*|CVS|RCS)$/, readdir (SCRIPTDIR) );
    137168    closedir (SCRIPTDIR);
    138169    foreach $dir (@dirs)
    139170    {
    140       next if ($dir =~ /^\.\.?$/ || $dir eq 'CVS' || $dir eq 'RCS'
    141                || ! -d "$scriptpath/$dir");
     171      next if ($dir =~ /^(\..*|CVS|RCS)$/ || ! -d "$scriptpath/$dir");
    142172      push (@rmdirs, $dir);
    143173      mkdir ("$workpath/$dir", 0777)
     
    145175      opendir (SCRIPTDIR, "$scriptpath/$dir")
    146176          || &error ("Couldn't opendir $scriptpath/$dir: $!\n");
    147       @files = grep (!/^(\.\.?|CVS|RCS)$/, readdir (SCRIPTDIR) );
     177      @files = grep (!/^(\..*|CVS|RCS|.*~)$/, readdir (SCRIPTDIR) );
    148178      closedir (SCRIPTDIR);
    149179      foreach $test (@files)
    150180      {
    151         next if $test =~ /~$/ || -d $test;
     181        -d $test and next;
    152182        push (@TESTS, "$dir/$test");
    153183      }
     
    398428      $baseext = 'b';
    399429      $extext = '';
    400    }
    401     else {
     430    } else {
    402431      $logext = 'log';
    403432      $diffext = 'diff';
     
    430459    {
    431460      $suite_passed = 0;
    432       if (length ($@))
    433       {
     461      if (length ($@)) {
    434462        warn "\n*** Test died ($testname): $@\n";
    435       }
    436       else
    437       {
     463      } else {
    438464        warn "\n*** Couldn't run $perl_testname\n";
    439465      }
     
    461487      }
    462488    }
    463     elsif ($code > 0) {
     489    elsif (!defined $code || $code > 0) {
    464490      $status = "FAILED ($tests_passed/$tests_run passed)";
    465491    }
     
    745771  local ($code);
    746772
     773  # We reset this before every invocation.  On Windows I think there is only
     774  # one environment, not one per process, so I think that variables set in
     775  # test scripts might leak into subsequent tests if this isn't reset--???
     776  resetENV();
     777
    747778  print "\nrun_command: @_\n" if $debug;
    748779  $code = system @_;
     
    761792  local ($filename) = shift;
    762793  local ($code);
     794
     795  # We reset this before every invocation.  On Windows I think there is only
     796  # one environment, not one per process, so I think that variables set in
     797  # test scripts might leak into subsequent tests if this isn't reset--???
     798  resetENV();
    763799
    764800  &attach_default_output ($filename);
Note: See TracChangeset for help on using the changeset viewer.