VirtualBox

Changeset 501 in kBuild for vendor/gnumake/current/tests/scripts


Ignore:
Timestamp:
Sep 15, 2006 2:30:32 AM (19 years ago)
Author:
bird
Message:

Load make-3.81/ into vendor/gnumake/current.

Location:
vendor/gnumake/current/tests/scripts
Files:
9 added
1 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/tests/scripts/features/default_names

    r53 r501  
    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";
  • vendor/gnumake/current/tests/scripts/features/double_colon

    r53 r501  
    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;
  • vendor/gnumake/current/tests/scripts/features/errors

    r280 r501  
     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);
  • vendor/gnumake/current/tests/scripts/features/escape

    r53 r501  
    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.
  • vendor/gnumake/current/tests/scripts/features/export

    r53 r501  
    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.
  • vendor/gnumake/current/tests/scripts/features/include

    r284 r501  
    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;
  • vendor/gnumake/current/tests/scripts/features/order_only

    r284 r501  
    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
  • vendor/gnumake/current/tests/scripts/features/parallelism

    r284 r501  
    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 <[email protected]> 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;
  • vendor/gnumake/current/tests/scripts/features/patspecific_vars

    r284 r501  
    6868
    6969/bar:
    70         @test "$(foo)" = "$$foo"
    71 ', '', '');
     70        @echo $(foo) $$foo
     71', '', 'foo foo');
    7272
    7373
  • vendor/gnumake/current/tests/scripts/features/patternrules

    r283 r501  
    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;
  • vendor/gnumake/current/tests/scripts/features/reinvoke

    r53 r501  
    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.
  • vendor/gnumake/current/tests/scripts/features/se_explicit

    r283 r501  
    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
  • vendor/gnumake/current/tests/scripts/features/se_implicit

    r283 r501  
    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
  • vendor/gnumake/current/tests/scripts/features/se_statpat

    r283 r501  
    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 \'$*\'
  • vendor/gnumake/current/tests/scripts/features/statipattrules

    r284 r501  
    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;
  • vendor/gnumake/current/tests/scripts/features/targetvars

    r53 r501  
    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;
  • vendor/gnumake/current/tests/scripts/functions/abspath

    r283 r501  
    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
  • vendor/gnumake/current/tests/scripts/functions/error

    r53 r501  
     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
  • vendor/gnumake/current/tests/scripts/functions/eval

    r284 r501  
    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
  • vendor/gnumake/current/tests/scripts/functions/foreach

    r53 r501  
    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;
  • vendor/gnumake/current/tests/scripts/functions/origin

    r153 r501  
    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;
  • vendor/gnumake/current/tests/scripts/functions/realpath

    r283 r501  
    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
  • vendor/gnumake/current/tests/scripts/functions/warning

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

    r284 r501  
    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
  • vendor/gnumake/current/tests/scripts/functions/word

    r284 r501  
    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
  • vendor/gnumake/current/tests/scripts/misc/general3

    r53 r501  
    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;
  • vendor/gnumake/current/tests/scripts/misc/general4

    r284 r501  
    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;
  • vendor/gnumake/current/tests/scripts/options/dash-B

    r284 r501  
    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;
  • vendor/gnumake/current/tests/scripts/options/dash-I

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

    r53 r501  
    55$details = "";
    66
    7 $ENV{GOOGLE} = 'boggle';
     7$extraENV{GOOGLE} = 'boggle';
    88
    99open(MAKEFILE,"> $makefile");
  • vendor/gnumake/current/tests/scripts/options/symlinks

    r283 r501  
    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;
  • vendor/gnumake/current/tests/scripts/targets/FORCE

    r284 r501  
     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");
  • vendor/gnumake/current/tests/scripts/targets/PHONY

    r284 r501  
     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";
  • vendor/gnumake/current/tests/scripts/targets/SILENT

    r284 r501  
     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";
  • vendor/gnumake/current/tests/scripts/variables/SHELL

    r283 r501  
    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;
  • vendor/gnumake/current/tests/scripts/variables/automatic

    r284 r501  
    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;
Note: See TracChangeset for help on using the changeset viewer.

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