Ignore:
Timestamp:
May 16, 2005, 6:54:02 PM (21 years ago)
Author:
bird
Message:

Current make snaphot, 2005-05-16.

Location:
branches/GNU/src/gmake
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gmake

    • Property svn:ignore
      •  

        old new  
        3434README.DOS
        3535README.W32
         36README.OS2
        3637aclocal.m4
        3738autom4te.cache
  • branches/GNU/src/gmake/tests/scripts/features/conditionals

    r153 r280  
    44$details = "Attempt various different flavors of GNU make conditionals.";
    55
    6 open(MAKEFILE,"> $makefile");
    7 
    8 # The Contents of the MAKEFILE ...
    9 
    10 print MAKEFILE <<'EOMAKE';
    11 objects = foo.obj
     6run_make_test('
    127arg1 = first
    138arg2 = second
     
    2318endif
    2419
    25 ifeq '$(arg2)' "$(arg5)"
     20ifeq \'$(arg2)\' "$(arg5)"
    2621        @echo arg2 equals arg5
    2722else
     
    2924endif
    3025
    31 ifneq '$(arg3)' '$(arg4)'
     26ifneq \'$(arg3)\' \'$(arg4)\'
    3227        @echo arg3 NOT equal arg4
    3328else
     
    4439else
    4540        @echo arg4 is NOT defined
    46 endif
    47 
    48 EOMAKE
    49 
    50 close(MAKEFILE);
    51 
    52 &run_make_with_options($makefile,"",&get_logfile,0);
    53 
    54 $answer = "arg1 NOT equal arg2
     41endif',
     42              '',
     43              'arg1 NOT equal arg2
    5544arg2 equals arg5
    5645arg3 NOT equal arg4
    5746variable is undefined
    58 arg4 is defined
    59 ";
    60 
    61 &compare_output($answer,&get_logfile(1));
     47arg4 is defined');
    6248
    6349
    6450# Test expansion of variables inside ifdef.
    6551
    66 $makefile2 = &get_tmpfile;
    67 
    68 open(MAKEFILE, "> $makefile2");
    69 
    70 print MAKEFILE <<'EOF';
    71 
     52run_make_test('
    7253foo = 1
    7354
     
    9374endif
    9475
    95 all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)
     76all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)',
     77              '',
     78              'DEF=yes DEF2=yes DEF3=yes');
    9679
    97 EOF
    9880
    99 close(MAKEFILE)
     81# Test all the different "else if..." constructs
    10082
    101 &run_make_with_options($makefile2,"",&get_logfile,0);
    102 $answer = "DEF=yes DEF2=yes DEF3=yes\n";
    103 &compare_output($answer,&get_logfile(1));
     83run_make_test('
     84arg1 = first
     85arg2 = second
     86arg3 = third
     87arg4 = cc
     88arg5 = fifth
     89
     90result =
     91
     92ifeq ($(arg1),$(arg2))
     93  result += arg1 equals arg2
     94else ifeq \'$(arg2)\' "$(arg5)"
     95  result += arg2 equals arg5
     96else ifneq \'$(arg3)\' \'$(arg3)\'
     97  result += arg3 NOT equal arg4
     98else ifndef arg5
     99  result += variable is undefined
     100else ifdef undefined
     101  result += arg4 is defined
     102else
     103  result += success
     104endif
     105
     106
     107all: ; @echo $(result)',
     108              '',
     109              'success');
     110
     111
     112# Test some random "else if..." construct nesting
     113
     114run_make_test('
     115arg1 = first
     116arg2 = second
     117arg3 = third
     118arg4 = cc
     119arg5 = second
     120
     121ifeq ($(arg1),$(arg2))
     122  $(info failed 1)
     123else ifeq \'$(arg2)\' "$(arg2)"
     124  ifdef undefined
     125    $(info failed 2)
     126  else
     127    $(info success)
     128  endif
     129else ifneq \'$(arg3)\' \'$(arg3)\'
     130  $(info failed 3)
     131else ifdef arg5
     132  $(info failed 4)
     133else ifdef undefined
     134  $(info failed 5)
     135else
     136  $(info failed 6)
     137endif
     138
     139.PHONY: all
     140all: ; @:',
     141              '',
     142              'success');
    104143
    105144
  • branches/GNU/src/gmake/tests/scripts/features/echoing

    r53 r280  
    5555
    5656&run_make_with_options($makefile,"clean",&get_logfile,0);
    57 $answer = "";
    58 &compare_output($answer,&get_logfile(1));
    59 
    60 if (-f $example)
    61 {
    62    $test_passed = 0;
     57if (-f $example) {
     58  $test_passed = 0;
    6359}
     60&compare_output('',&get_logfile(1));
    6461
    6562# TEST #3
  • branches/GNU/src/gmake/tests/scripts/features/errors

    r53 r280  
    5353&run_make_with_options($makefile,"",&get_logfile);
    5454
     55# If make acted as planned, it should ignore the error from the first
     56# command in the target and execute the second which deletes the file "foo"
     57# This file, therefore, should not exist if the test PASSES.
     58if (-f "foo") {
     59  $test_passed = 0;
     60}
     61
    5562# The output for this on VOS is too hard to replicate, so we only check it
    5663# on unix.
     
    5865{
    5966   &compare_output($answer,&get_logfile(1));
    60 }
    61 
    62 # If make acted as planned, it should ignore the error from the first
    63 # command in the target and execute the second which deletes the file "foo"
    64 # This file, therefore, should not exist if the test PASSES.
    65 if (-f "foo")
    66 {
    67    $test_passed = 0;
    6867}
    6968
     
    8180&run_make_with_options($makefile,"clean2 -i",&get_logfile);
    8281
    83 if (!$vos)
    84 {
     82if (-f "foo") {
     83  $test_passed = 0;
     84}
     85
     86if (!$vos) {
    8587   &compare_output($answer,&get_logfile(1));
    8688}
    8789
    88 if (-f "foo")
    89 {
    90    $test_passed = 0;
    91 }
    92 
    93901;
  • branches/GNU/src/gmake/tests/scripts/test_template

    r53 r280  
    1 $description = "The following test creates a makefile to ...
    2                      <FILL IN DESCRIPTION HERE> ";
     1#                                                                    -*-perl-*-
    32
     3$description = "<FILL IN SHORT DESCRIPTION HERE>";
    44$details = "<FILL IN DETAILS OF HOW YOU TEST WHAT YOU SAY YOU ARE TESTING>";
    55
    6 # IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
    7 # THE NAME OF THE MAKEFILE.  THIS INSURES CONSISTENCY AND KEEPS TRACK OF
    8 # HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
    9 # EXAMPLE: $makefile2 = &get_tmpfile;
     6# Run a make test.  See the documentation of run_make_test() in
     7# run_make_tests.pl, but briefly the first argument is a string with the
     8# contents of a makefile to be tested, the second is a string containing the
     9# arguments to be passed to the make invocation, the third is a string
     10# containing the expected output.  The fourth is the expected exit code for
     11# make.  If not specified, it's assumed that the make program should succeed
     12# (exit with 0).
    1013
    11 open(MAKEFILE,"> $makefile");
     14run_make_test('Your test makefile goes here',
     15              'Arguments to pass to make go here',
     16              'Expected output from the invocation goes here');
    1217
    13 # The Contents of the MAKEFILE ...
     18# There are various special tokens, options, etc.  See the full documentation
     19# in run_make_tests.pl.
    1420
    15 print MAKEFILE " <FILL IN THE CONTENTS OF THE MAKEFILE HERE>  \n";
    16 
    17 # END of Contents of MAKEFILE
    18 
    19 close(MAKEFILE);
    20 
    21 
    22 # Run make.  You may specify a makefile, but if you don't want to, just
    23 # insert "" where $make_filename is now.  You may also specify specific
    24 # options to run make with, but you also don't have to. (Insert "" where it
    25 # says <FILL IN OPTIONS HERE>), The last field in this subroutine call
    26 # is the code which is returned from make.  If you think that make should
    27 # execute with no errors, you may OPTIONALLY put 0; Otherwise put the
    28 # error code that you expect back from make for this test.
    29 
    30 # Every time you run make, you just need to say &get_logfile and that
    31 # subroutine will get a new logfile name for you in incrementing order
    32 # according to how many times you call it within ONE test.  It is
    33 # reset to 0 at the beginning of every new test script.
    34 
    35 &run_make_with_options($makefile,
    36                        "<FILL IN OPTIONS HERE>",
    37                        &get_logfile,
    38                        0);
    39 
    40 
    41 # THE REST OF THIS FILE DEPENDS HIGHLY ON WHAT KIND OF TEST YOU ARE
    42 # CREATING, SO IT WILL VARY.  BASICALLY, YOU MAY INSERT ANYTHING YOU
    43 # WISH AT THIS POINT TO SEE IF THE TEST WORKED OK.  IF THERE ARE
    44 # ADDITIONAL TESTS BESIDES &compare_output, AND IT FAILES, YOU
    45 # MUST *** SET $test_passed = 0 !!! ***
    46 
    47 # Create the answer to what should be produced by this Makefile
    48 $answer = "<INSERT ANSWER HERE>";
    49 
    50 # COMPARE RESULTS
    51 
    52 # In this call to compare output, you should use the call &get_logfile(1)
    53 # to send the name of the last logfile created.  You may also use
    54 # the special call &get_logfile(1) which returns the same as &get_logfile(1).
    55 
    56 &compare_output($answer,&get_logfile(1));
    57 
    58 # If you wish to &error ("abort
    59 ") if the compare fails, then add a "|| &error ("abort
    60 ")" to the
    61 # end of the previous line.
    6221
    6322# This tells the test driver that the perl test script executed properly.
Note: See TracChangeset for help on using the changeset viewer.