VirtualBox

Ignore:
Timestamp:
May 16, 2005 4:54:08 PM (19 years ago)
Author:
bird
Message:

Current make snaphot, 2005-05-16.

Location:
branches/GNU/src/gmake/tests/scripts/features
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gmake/tests/scripts/features/include

    r53 r284  
    33$description = "Test various forms of the GNU make `include' command.";
    44
    5 $details = "Test include, -include, sinclude and various regressions involving them.
     5$details = "\
     6Test include, -include, sinclude and various regressions involving them.
    67Test extra whitespace at the end of the include, multiple -includes and
    78sincludes (should not give an error) and make sure that errors are reported
     
    1617print MAKEFILE <<EOF;
    1718\#Extra space at the end of the following file name
    18 include $makefile2                 
     19include $makefile2
    1920all: ; \@echo There should be no errors for this makefile.
    2021
     
    4748&compare_output($answer, &get_logfile(1));
    4849
     50$makefile = undef;
     51
    4952# Try to build the "error" target; this will fail since we don't know
    5053# how to create makeit.mk, but we should also get a message (even though
     
    5255# see one during the makefile run phase).
    5356
    54 # The fix to this caused more problems than the error, so I removed it.
    55 # pds -- 22 Jan 2000
     57run_make_test
     58  ('
     59-include foo.mk
     60error: foo.mk ; @echo $@
     61',
     62   '',
     63   "#MAKE#: *** No rule to make target `foo.mk', needed by `error'.  Stop.\n",
     64   512
     65  );
    5666
    57 #&run_make_with_options($makefile, "error", &get_logfile, 512);
    58 #$answer = "$make_name: *** No rule to make target `makeit.mk', needed by `error'.\n";
    59 #&compare_output($answer, &get_logfile(1));
     67# Make sure that target-specific variables don't impact things.  This could
     68# happen because a file record is created when a target-specific variable is
     69# set.
     70
     71run_make_test
     72  ('
     73bar.mk: foo := baz
     74-include bar.mk
     75hello: ; @echo hello
     76',
     77   '',
     78   "hello\n"
     79  );
     80
     81# Test inheritance of dontcare flag when rebuilding makefiles.
     82#
     83run_make_test('
     84.PHONY: all
     85all: ; @:
     86
     87-include foo
     88
     89foo: bar; @:
     90', '', '');
    6091
    61921;
  • branches/GNU/src/gmake/tests/scripts/features/order_only

    r153 r284  
    145145unlink(qw(foo.w foo.x baz));
    146146
     147# TEST #9 -- make sure that $< is set correctly in the face of order-only
     148# prerequisites in pattern rules.
     149
     150run_make_test('
     151%r: | baz ; @echo $< $^ $|
     152bar: foo
     153foo:;@:
     154baz:;@:
     155', '', "foo foo baz\n");
     156
     157
    1471581;
  • branches/GNU/src/gmake/tests/scripts/features/parallelism

    r53 r284  
    2727}
    2828
    29 open(MAKEFILE,"> $makefile");
    3029
    31 print MAKEFILE <<"EOF";
     30run_make_test("
    3231all : def_1 def_2 def_3
    3332def_1 : ; \@echo ONE; $sleep_command 3 ; echo TWO
    3433def_2 : ; \@$sleep_command 2 ; echo THREE
    35 def_3 : ; \@$sleep_command 1 ; echo FOUR
    36 EOF
    37 
    38 close(MAKEFILE);
    39 
    40 &run_make_with_options($makefile, "-j 4", &get_logfile);
    41 $answer = "ONE\nFOUR\nTHREE\nTWO\n";
    42 &compare_output($answer, &get_logfile(1));
    43 
     34def_3 : ; \@$sleep_command 1 ; echo FOUR",
     35              '-j4', "ONE\nFOUR\nTHREE\nTWO");
    4436
    4537# Test parallelism with included files.  Here we sleep/echo while
    4638# building the included files, to test that they are being built in
    4739# parallel.
    48 
    49 $makefile2 = &get_tmpfile;
    50 
    51 open(MAKEFILE,"> $makefile2");
    52 
    53 print MAKEFILE <<"EOF";
     40run_make_test("
    5441all: 1 2; \@echo success
    55 
    5642-include 1.inc 2.inc
    57 
    58 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo "1: ; \@echo ONE; $sleep_command 2; echo TWO" > \$\@
    59 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@
    60 EOF
    61 
    62 close(MAKEFILE);
    63 
    64 &run_make_with_options("$makefile2", "-j 4", &get_logfile);
    65 $answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n";
    66 &compare_output($answer, &get_logfile(1));
     431.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
     442.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
     45              "-j4",
     46              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
    6747
    6848unlink('1.inc', '2.inc');
     
    7151# Test parallelism with included files--this time recurse first and make
    7252# sure the jobserver works.
    73 
    74 $makefile3 = &get_tmpfile;
    75 
    76 open(MAKEFILE,"> $makefile3");
    77 
    78 print MAKEFILE <<"EOF";
    79 recurse: ; \@\$(MAKE) --no-print-directory -f $makefile3 INC=yes all
    80 
     53run_make_test("
     54recurse: ; \@\$(MAKE) --no-print-directory -f #MAKEFILE# INC=yes all
    8155all: 1 2; \@echo success
    8256
     
    8660endif
    8761
    88 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo "1: ; \@echo ONE; $sleep_command 2; echo TWO" > \$\@
    89 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@
    90 EOF
    91 
    92 close(MAKEFILE);
    93 
    94 &run_make_with_options("$makefile3", "-j 4", &get_logfile);
    95 $answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n";
    96 &compare_output($answer, &get_logfile(1));
     621.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
     632.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
     64              "-j4",
     65              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
    9766
    9867unlink('1.inc', '2.inc');
    9968
     69# Grant Taylor reports a problem where tokens can be lost (not written back
     70# to the pipe when they should be): this happened when there is a $(shell ...)
     71# function in an exported recursive variable.  I added some code to check
     72# for this situation and print a message if it occurred.  This test used
     73# to trigger this code when I added it but no longer does after the fix.
     74
     75run_make_test("
     76export HI = \$(shell \$(\$\@.CMD))
     77first.CMD = echo hi
     78second.CMD = $sleep_command 4; echo hi
     79
     80.PHONY: all first second
     81all: first second
     82
     83first second: ; \@echo \$\@; $sleep_command 1; echo \$\@",
     84              '-j2', "first\nfirst\nsecond\nsecond");
     85
    100861;
  • branches/GNU/src/gmake/tests/scripts/features/patspecific_vars

    r53 r284  
    6262&compare_output($answer,&get_logfile(1));
    6363
     64# TEST #5 -- test pattern-specific exported variables
     65#
     66run_make_test('
     67/%: export foo := foo
     68
     69/bar:
     70        @test "$(foo)" = "$$foo"
     71', '', '');
     72
     73
     74# TEST #6 -- test expansion of pattern-specific simple variables
     75#
     76run_make_test('
     77.PHONY: all
     78
     79all: inherit := good $$t
     80all: bar baz
     81
     82b%: pattern := good $$t
     83
     84global := orginal $$t
     85
     86
     87# normal target
     88#
     89ifdef rec
     90bar: a = global: $(global) pattern: $(pattern) inherit: $(inherit)
     91else
     92bar: a := global: $(global) pattern: $(pattern) inherit: $(inherit)
     93endif
     94
     95bar: ; @echo \'normal: $a;\'
     96
     97
     98# pattern target
     99#
     100ifdef rec
     101%z: a = global: $(global) pattern: $(pattern) inherit: $(inherit)
     102else
     103%z: a := global: $(global) pattern: $(pattern) inherit: $(inherit)
     104endif
     105
     106%z: ; @echo \'pattrn: $a;\'
     107
     108
     109global := new $$t
     110',
     111'',
     112'normal: global: orginal $t pattern:  inherit: ;
     113pattrn: global: orginal $t pattern:  inherit: ;');
     114
     115
     116# TEST #7 -- test expansion of pattern-specific recursive variables
     117#
     118run_make_test(undef, # reuse previous makefile
     119'rec=1',
     120'normal: global: new $t pattern: good $t inherit: good $t;
     121pattrn: global: new $t pattern: good $t inherit: good $t;');
     122
     123
    641241;
  • branches/GNU/src/gmake/tests/scripts/features/recursion

    r53 r284  
    11#                                                                    -*-perl-*-
    2 $description = "The following test creates a makefile to ...\n";
     2$description = "Test recursion.";
    33
    44$details = "DETAILS";
    55
    6 open(MAKEFILE,"> $makefile");
     6# Test some basic recursion.
     7run_make_test('
     8all:
     9        $(MAKE) -f #MAKEFILE# foo
     10foo:
     11        @echo $(MAKE)
     12        @echo MAKELEVEL = $(MAKELEVEL)
     13        $(MAKE) -f #MAKEFILE# last
     14last:
     15        @echo $(MAKE)
     16        @echo MAKELEVEL = $(MAKELEVEL)
     17        @echo THE END
     18',
     19              ('CFLAGS=-O -w' . ($parallel_jobs ? '-j 2' : '')),
     20              ($vos
     21               ? "#MAKE#: Entering directory `#PWD#'
     22make 'CFLAGS=-O' -f #MAKEFILE# foo
     23make CFLAGS=-O
     24MAKELEVEL = 0
     25make 'CFLAGS=-O' -f #MAKEFILE# last
     26make CFLAGS=-O
     27MAKELEVEL = 0
     28THE END
     29#MAKE#: Leaving directory `#PWD#'"
     30               : "#MAKE#: Entering directory `#PWD#'
     31#MAKEPATH# -f #MAKEFILE# foo
     32#MAKE#[1]: Entering directory `#PWD#'
     33#MAKEPATH#
     34MAKELEVEL = 1
     35#MAKEPATH# -f #MAKEFILE# last
     36#MAKE#[2]: Entering directory `#PWD#'
     37#MAKEPATH#
     38MAKELEVEL = 2
     39THE END
     40#MAKE#[2]: Leaving directory `#PWD#'
     41#MAKE#[1]: Leaving directory `#PWD#'
     42#MAKE#: Leaving directory `#PWD#'"));
    743
    8 # The Contents of the MAKEFILE ...
    944
    10 print MAKEFILE "all: \n"
    11               ."\t\$(MAKE) -f $makefile foo \n"
    12               ."foo: \n"
    13               ."\t\@echo \$(MAKE) \n"
    14               ."\t\@echo MAKELEVEL = \$(MAKELEVEL)\n"
    15               ."\t\$(MAKE) -f $makefile last \n"
    16               ."last: \n"
    17               ."\t\@echo \$(MAKE) \n"
    18               ."\t\@echo MAKELEVEL = \$(MAKELEVEL) \n"
    19               ."\t\@echo THE END\n";
    20 
    21 # END of Contents of MAKEFILE
    22 
    23 close(MAKEFILE);
    24 
    25 if ($vos)
    26 {
    27    $answer = "$make_name: Entering directory \`$pwd\'\n"
    28             ."make 'CFLAGS=-O' -f $makefile foo \n"
    29             ."make CFLAGS=-O\n"
    30             ."MAKELEVEL = 0\n"
    31             ."make 'CFLAGS=-O' -f $makefile last \n"
    32             ."make CFLAGS=-O\n"
    33             ."MAKELEVEL = 0\n"
    34             ."THE END\n"
    35             ."$make_name: Leaving directory `$pwd'\n";
    36 }
    37 else
    38 {
    39    $answer = "$make_name: Entering directory `$pwd'\n"
    40             ."$mkpath -f $makefile foo \n"
    41             ."${make_name}[1]: Entering directory `$pwd'\n"
    42             ."$mkpath\n"
    43             ."MAKELEVEL = 1\n"
    44             ."$mkpath -f $makefile last \n"
    45             ."${make_name}[2]: Entering directory `$pwd'\n"
    46             ."$mkpath\n"
    47             ."MAKELEVEL = 2\n"
    48             ."THE END\n"
    49             ."${make_name}[2]: Leaving directory `$pwd'\n"
    50             ."${make_name}[1]: Leaving directory `$pwd'\n"
    51             ."$make_name: Leaving directory `$pwd'\n";
    52 }
    53 
    54 $mkoptions = "CFLAGS=-O -w";
    55 $mkoptions .= " -j 2" if ($parallel_jobs);
    56 
    57 &run_make_with_options($makefile,$mkoptions,&get_logfile,0);
    58 
    59 &compare_output($answer,&get_logfile(1));
     45# Test command line overrides.
     46run_make_test('
     47recur: all ; @$(MAKE) --no-print-directory -f #MAKEFILE# a=AA all
     48all: ; @echo "MAKEOVERRIDES = $(MAKEOVERRIDES)"
     49',
     50              'a=ZZ',
     51              'MAKEOVERRIDES = a=ZZ
     52MAKEOVERRIDES = a=AA
     53');
    6054
    61551;
  • branches/GNU/src/gmake/tests/scripts/features/statipattrules

    r53 r284  
    5656$makefile2 = &get_tmpfile;
    5757open(MAKEFILE, "> $makefile2");
    58 print MAKEFILE "foo: foo%: % ; \@echo $@\n";
     58print MAKEFILE "foo: foo%: % ; \@echo \$@\n";
    5959close(MAKEFILE);
    6060
    61 &run_make_with_options($makefile2, '', &get_logfile, 512);
    62 $answer = "$makefile2:1: *** target `foo' leaves prerequisite pattern empty.  Stop.\n";
     61&run_make_with_options($makefile2, '', &get_logfile);
     62$answer = "foo\n";
    6363&compare_output($answer, &get_logfile(1));
    6464
     65# TEST #5 -- bug #12180: core dump on a stat pattern rule with an empty
     66#                        prerequisite list.
     67#
     68run_make_test('
     69foo.x bar.x: %.x : ; @echo $@
     70
     71',
     72'',
     73'foo.x
     74');
    6575
    66761;
    67 
    68 
    69 
    70 
    71 
    72 
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