VirtualBox

Ignore:
Timestamp:
Sep 15, 2006 5:09:38 AM (18 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/scripts/functions
Files:
9 edited
3 copied

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.

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