VirtualBox

Changeset 284 in kBuild for branches/GNU/src/gmake/tests


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

Current make snaphot, 2005-05-16.

Location:
branches/GNU/src/gmake/tests/scripts
Files:
25 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 
  • branches/GNU/src/gmake/tests/scripts/functions/eval

    r53 r284  
    135135delete $ENV{EVAR};
    136136
     137
     138# Clean out previous information to allow new run_make_test() interface.
     139# If we ever convert all the above to run_make_test() we can remove this line.
     140$makefile = undef;
     141
     142# Test handling of backslashes in strings to be evaled.
     143
     144run_make_test('
     145define FOO
     146all: ; @echo hello \
     147world
     148endef
     149$(eval $(FOO))
     150', '', 'hello world');
     151
     152run_make_test('
     153define FOO
     154all: ; @echo he\llo
     155        @echo world
     156endef
     157$(eval $(FOO))
     158', '', 'hello
     159world');
     160
     161
     162# We don't allow new target/prerequisite relationships to be defined within a
     163# command script, because these are evaluated after snap_deps() and that
     164# causes lots of problems (like core dumps!)
     165# See Savannah bug # 12124.
     166
     167run_make_test('deps: ; $(eval deps: foo)', '',
     168              '#MAKEFILE#:1: *** prerequisites cannot be defined in command scripts.  Stop.',
     169              512);
     170
    1371711;
  • branches/GNU/src/gmake/tests/scripts/functions/substitution

    r53 r284  
    1 $description = "The following test creates a makefile to ...";
     1#                                                                    -*-perl-*-
     2
     3$description = "Test the subst and patsubst functions";
    24
    35$details = "";
    46
    5 open(MAKEFILE,"> $makefile");
     7# Generic patsubst test: test both the function and variable form.
    68
    7 # The Contents of the MAKEFILE ...
     9run_make_test('
     10foo := a.o b.o c.o
     11bar := $(foo:.o=.c)
     12bar2:= $(foo:%.o=%.c)
     13bar3:= $(patsubst %.c,%.o,x.c.c bar.c)
     14all:;@echo $(bar); echo $(bar2); echo $(bar3)',
     15'',
     16'a.c b.c c.c
     17a.c b.c c.c
     18x.c.o bar.o');
    819
    9 print MAKEFILE "foo := a.o b.o c.o\n"
    10               ."bar := \$(foo:.o=.c)\n"
    11               ."bar2:= \$(foo:%.o=%.c)\n"
    12               ."bar3:= \$(patsubst %.c,%.o,x.c.c bar.c)\n"
    13               ."all:\n"
    14               ."\t\@echo \$(bar)\n"
    15               ."\t\@echo \$(bar2)\n"
    16               ."\t\@echo \$(bar3)\n";
     20# Patsubst without '%'--shouldn't match because the whole word has to match
     21# in patsubst.  Based on a bug report by Markus Mauhart <[email protected]>
    1722
    18 # END of Contents of MAKEFILE
     23run_make_test('all:;@echo $(patsubst Foo,Repl,FooFoo)', '', 'FooFoo');
    1924
    20 close(MAKEFILE);
     25# Variable subst where a pattern matches multiple times in a single word.
     26# Based on a bug report by Markus Mauhart <[email protected]>
    2127
    22 &run_make_with_options($makefile,"",&get_logfile);
    23 
    24 # Create the answer to what should be produced by this Makefile
    25 $answer = "a.c b.c c.c\n"
    26          ."a.c b.c c.c\n"
    27          ."x.c.o bar.o\n";
    28 
    29 &compare_output($answer,&get_logfile(1));
     28run_make_test('
     29A := fooBARfooBARfoo
     30all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL');
    3031
    31321;
  • branches/GNU/src/gmake/tests/scripts/functions/wildcard

    r53 r284  
    8686&run_make_with_options($makefile,"clean",&get_logfile);
    8787
    88 &compare_output($answer,&get_logfile(1));
    89 
    90 if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for"))
    91 {
     88if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) {
    9289   $test_passed = 0;
    9390}
     91
     92&compare_output($answer,&get_logfile(1));
    9493
    9594
  • branches/GNU/src/gmake/tests/scripts/functions/word

    r53 r284  
    11#                                                                    -*-perl-*-
    2 $description = "Test the word, words, and wordlist functions.\n";
     2$description = "\
     3Test the word, words, wordlist, firstword, and lastword functions.\n";
    34
    45$details = "\
     
    8889&compare_output($answer, &get_logfile(1));
    8990
     91
     92# TEST #8 -- test $(firstword )
     93#
     94run_make_test('
     95void :=
     96list := $(void) foo bar baz #
     97
     98a := $(word 1,$(list))
     99b := $(firstword $(list))
     100
     101.PHONY: all
     102
     103all:
     104        @test "$a" = "$b" && echo $a
     105',
     106'',
     107'foo');
     108
     109
     110# TEST #9 -- test $(lastword )
     111#
     112run_make_test('
     113void :=
     114list := $(void) foo bar baz #
     115
     116a := $(word $(words $(list)),$(list))
     117b := $(lastword $(list))
     118
     119.PHONY: all
     120
     121all:
     122        @test "$a" = "$b" && echo $a
     123',
     124'',
     125'baz');
     126
    90127# This tells the test driver that the perl test script executed properly.
    911281;
  • branches/GNU/src/gmake/tests/scripts/misc/general4

    r53 r284  
    77
    88open(MAKEFILE,"> $makefile");
    9 
    10 # The contents of the Makefile ...
    11 
    129print MAKEFILE <<'EOF';
    1310# Make sure that subdirectories built as prerequisites are actually handled
     
    2219dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@
    2320EOF
    24 
    2521close(MAKEFILE);
    2622
     
    2925&compare_output($answer,&get_logfile(1));
    3026
     27# Test implicit rules
     28
     29&touch('foo.c');
     30run_make_test('foo: foo.o',
     31              'CC="@echo cc" OUTPUT_OPTION=',
     32              'cc -c foo.c
     33cc foo.o -o foo');
     34unlink('foo.c');
     35
     36
     37# Test other implicit rule searching
     38
     39&touch('bar');
     40run_make_test('
     41test.foo:
     42%.foo : baz ; @echo done $<
     43%.foo : bar ; @echo done $<
     44fox: baz
     45',
     46              '',
     47              'done bar');
     48unlink('bar');
     49
    31501;
  • branches/GNU/src/gmake/tests/scripts/options/dash-B

    r53 r284  
    99is built again.";
    1010
    11 open(MAKEFILE,"> $makefile");
     11&touch('bar.x');
    1212
    13 print MAKEFILE <<'EOF';
     13run_make_test('
    1414.SUFFIXES:
    1515
     
    2020        @echo cp $< $@
    2121        @echo "" > $@
    22 EOF
     22',
     23              '', 'cp bar.x foo');
    2324
    24 close(MAKEFILE);
     25run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'.");
     26run_make_test(undef, '-B', 'cp bar.x foo');
     27
     28# Put the timestamp for foo into the future; it should still be remade.
     29
     30utouch(1000, 'foo');
     31run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'.");
     32run_make_test(undef, '-B', 'cp bar.x foo');
    2533
    2634
    27 &touch('bar.x');
     35# Clean up
    2836
    29 &run_make_with_options($makefile, '', &get_logfile);
    30 $answer = "cp bar.x foo\n";
    31 &compare_output($answer, &get_logfile(1));
    32 
    33 &run_make_with_options($makefile, '', &get_logfile);
    34 $answer = "$make_name: Nothing to be done for `all'.\n";
    35 &compare_output($answer, &get_logfile(1));
    36 
    37 &run_make_with_options($makefile, '-B', &get_logfile);
    38 $answer = "cp bar.x foo\n";
    39 &compare_output($answer, &get_logfile(1));
    40 
    41 unlink('bar.x', 'foo') unless $keep;
     37rmfiles('bar.x', 'foo');
    4238
    43391;
  • branches/GNU/src/gmake/tests/scripts/options/dash-C

    r53 r284  
    1 $description = "The following test creates a makefile to test the -C dir \n"
    2               ."option in make.  This option tells make to change to \n"
    3               ."directory dir before reading the makefile.";
     1#                                                                    -*-perl-*-
    42
    5 $details = "This test is similar to the clean test except that this test\n"
    6           ."creates the file to delete in the work directory instead of\n"
    7           ."the current directory.  Make is called from another directory\n"
    8           ."using the -C workdir option so that it can both find the \n"
    9           ."makefile and the file to delete in the work directory. ";
     3$description = "Test the -C option to GNU make.";
    104
    11 $example = $workdir . $pathsep . "EXAMPLE_FILE";
     5$details = "\
     6This test is similar to the clean test except that this test creates the file
     7to delete in the work directory instead of the current directory.  Make is
     8called from another directory using the -C workdir option so that it can both
     9find the makefile and the file to delete in the work directory.";
     10
     11$example = $workdir . $pathsep . "EXAMPLE";
    1212
    1313open(MAKEFILE,"> $makefile");
    14 
    15 # The Contents of the MAKEFILE ...
    16 
    17 print MAKEFILE "all: \n";
    18 print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n";
    19 print MAKEFILE "clean: \n";
    20 print MAKEFILE "\t$delete_command EXAMPLE_FILE\n";
    21 
    22 # END of Contents of MAKEFILE
    23 
     14print MAKEFILE <<EOF;
     15all: ; \@echo This makefile did not clean the dir ... good
     16clean: ; $delete_command EXAMPLE\$(ext)
     17EOF
    2418close(MAKEFILE);
    2519
     20# TEST #1
     21# -------
    2622&touch($example);
    2723
     
    3430chdir $pwd;
    3531
     32if (-f $example) {
     33  $test_passed = 0;
     34}
     35
    3636# Create the answer to what should be produced by this Makefile
    3737$answer = "$make_name: Entering directory `$wpath'\n"
    38         . "$delete_command EXAMPLE_FILE\n"
     38        . "$delete_command EXAMPLE\n"
    3939        . "$make_name: Leaving directory `$wpath'\n";
    4040
    4141&compare_output($answer,&get_logfile(1));
    4242
    43 if (-f $example)
    44 {
    45    $test_passed = 0;
     43
     44# TEST #2
     45# -------
     46# Do it again with trailing "/"; this should work the same
     47
     48$example .= "slash";
     49
     50&touch($example);
     51
     52&run_make_with_options("${testname}.mk",
     53                       "-C $workdir/ clean ext=slash",
     54                       &get_logfile);
     55
     56chdir $workdir;
     57$wpath = &get_this_pwd;
     58chdir $pwd;
     59
     60if (-f $example) {
     61  $test_passed = 0;
    4662}
    4763
     64# Create the answer to what should be produced by this Makefile
     65$answer = "$make_name: Entering directory `$wpath'\n"
     66        . "$delete_command EXAMPLEslash\n"
     67        . "$make_name: Leaving directory `$wpath'\n";
     68
     69&compare_output($answer,&get_logfile(1));
     70
    48711;
  • branches/GNU/src/gmake/tests/scripts/options/dash-k

    r53 r284  
    9898&compare_output($answer, &get_logfile(1));
    9999
     100# TEST -- make sure we keep the error code if we can't create an included
     101# makefile.
     102
     103run_make_test('all: ; @echo hi
     104include ifile
     105ifile: no-such-file; @false
     106',
     107              '-k',
     108              "#MAKEFILE#:2: ifile: No such file or directory
     109#MAKE#: *** No rule to make target `no-such-file', needed by `ifile'.
     110#MAKE#: Failed to remake makefile `ifile'.
     111hi\n",
     112              512);
     113
    1001141;
  • branches/GNU/src/gmake/tests/scripts/options/dash-q

    r53 r284  
    44$details = "Try various uses of -q and ensure they all give the correct results.\n";
    55
    6 open(MAKEFILE, "> $makefile");
     6# TEST 0
    77
    8 # The Contents of the MAKEFILE ...
    9 
    10 print MAKEFILE <<'EOMAKE';
     8run_make_test('
    119one:
    1210two: ;
     
    2220        : foo
    2321        $(.XY)
    24 EOMAKE
    25 
    26 close(MAKEFILE);
    27 
    28 # TEST 0
    29 
    30 &run_make_with_options($makefile, "-q one", &get_logfile);
    31 $answer = "";
    32 &compare_output($answer, &get_logfile(1));
     22',
     23              '-q one', '');
    3324
    3425# TEST 1
    3526
    36 &run_make_with_options($makefile, "-q two", &get_logfile);
    37 $answer = "";
    38 &compare_output($answer, &get_logfile(1));
     27run_make_test(undef, '-q two', '');
    3928
    4029# TEST 2
    4130
    42 &run_make_with_options($makefile, "-q three", &get_logfile, 256);
    43 $answer = "";
    44 &compare_output($answer, &get_logfile(1));
     31run_make_test(undef, '-q three', '', 256);
    4532
    4633# TEST 3
    4734
    48 &run_make_with_options($makefile, "-q four", &get_logfile);
    49 $answer = "";
    50 &compare_output($answer, &get_logfile(1));
     35run_make_test(undef, '-q four', '');
    5136
    5237# TEST 4
    5338
    54 &run_make_with_options($makefile, "-q five", &get_logfile);
    55 $answer = "";
    56 &compare_output($answer, &get_logfile(1));
     39run_make_test(undef, '-q five', '');
    5740
    5841# TEST 5
    5942
    60 &run_make_with_options($makefile, "-q six", &get_logfile);
    61 $answer = "";
    62 &compare_output($answer, &get_logfile(1));
     43run_make_test(undef, '-q six', '');
    6344
    6445# TEST 6
    6546
    66 &run_make_with_options($makefile, "-q seven", &get_logfile, 256);
    67 $answer = "";
    68 &compare_output($answer, &get_logfile(1));
     47run_make_test(undef, '-q seven', '', 256);
     48
     49# TEST 7 : Savannah bug # 7144
     50
     51run_make_test('
     52one:: ; @echo one
     53one:: ; @echo two
     54',
     55              '-q', '', 256);
    6956
    70571;
  • branches/GNU/src/gmake/tests/scripts/targets/FORCE

    r53 r284  
    1 $description = "The following tests rules without Commands or Dependencies."; 
     1$description = "The following tests rules without Commands or Dependencies.";
    22
    33$details = "If the rule ...\n";
     
    1818print MAKEFILE ".IGNORE :\n";
    1919print MAKEFILE "clean: FORCE\n";
    20 print MAKEFILE "\t$delete_command clean\n"; 
     20print MAKEFILE "\t$delete_command clean\n";
    2121print MAKEFILE "FORCE:\n";
    2222
     
    2727
    2828# Create a file named "clean".  This is the same name as the target clean
    29 # and tricks the target into thinking that it is up to date.  (Unless you 
     29# and tricks the target into thinking that it is up to date.  (Unless you
    3030# use the .PHONY target.
    3131&touch("clean");
     
    3434&run_make_with_options($makefile,"clean",&get_logfile);
    3535
    36 &compare_output($answer,&get_logfile(1)); 
     36&compare_output($answer,&get_logfile(1));
    3737
    38 if (-f $example)
    39 {
    40    $test_passed = 0;
    41 }
    42  
    43381;
    4439
  • branches/GNU/src/gmake/tests/scripts/targets/PHONY

    r53 r284  
    2828print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n";
    2929print MAKEFILE "clean: \n";
    30 print MAKEFILE "\t$delete_command $example clean\n"; 
     30print MAKEFILE "\t$delete_command $example clean\n";
    3131
    3232# END of Contents of MAKEFILE
     
    3737
    3838# Create a file named "clean".  This is the same name as the target clean
    39 # and tricks the target into thinking that it is up to date.  (Unless you 
     39# and tricks the target into thinking that it is up to date.  (Unless you
    4040# use the .PHONY target.
    4141&touch("clean");
     
    4444&run_make_with_options($makefile,"clean",&get_logfile);
    4545
    46 &compare_output($answer,&get_logfile(1));
     46if (-f $example) {
     47  $test_passed = 0;
     48}
    4749
    48 if (-f $example)
    49 {
    50    $test_passed = 0;
    51 }
    52  
     50&compare_output($answer,&get_logfile(1));
     51
    53521;
    5453
  • branches/GNU/src/gmake/tests/scripts/targets/SECONDARY

    r53 r284  
    109109unlink('source', 'final', 'intermediate');
    110110
     111
     112# TEST #8 -- test the "global" .SECONDARY, with .PHONY.
     113
     114touch('version2');
     115run_make_test('
     116.PHONY: version
     117.SECONDARY:
     118version2: version ; @echo GOOD
     119all: version2',
     120              'all', 'GOOD');
     121
     122unlink('version2');
     123
    111124# This tells the test driver that the perl test script executed properly.
    1121251;
  • branches/GNU/src/gmake/tests/scripts/targets/SILENT

    r53 r284  
    2323print MAKEFILE ".SILENT : clean\n";
    2424print MAKEFILE "clean: \n";
    25 print MAKEFILE "\t$delete_command EXAMPLE_FILE\n"; 
     25print MAKEFILE "\t$delete_command EXAMPLE_FILE\n";
    2626
    2727# END of Contents of MAKEFILE
     
    3333$answer = "";
    3434&run_make_with_options($makefile,"clean",&get_logfile,0);
     35if (-f $example) {
     36  $test_passed = 0;
     37}
     38&compare_output($answer,&get_logfile(1));
    3539
    36 &compare_output($answer,&get_logfile(1));
    37 if (-f $example)
    38 {
    39    $test_passed = 0;
    40 }
    41  
    42401;
    4341
  • branches/GNU/src/gmake/tests/scripts/targets/clean

    r53 r284  
    3434$answer = "$delete_command $example\n";
    3535&run_make_with_options($makefile,"clean",&get_logfile,0);
    36 
     36if (-f $example) {
     37  $test_passed = 0;
     38}
    3739&compare_output($answer,&get_logfile(1)) || &error ("abort");
    38 if (-f $example) {
    39    $test_passed = 0;
    40 }
    4140
    42411;
  • branches/GNU/src/gmake/tests/scripts/variables/MAKE

    r53 r284  
     1#                                                                    -*-perl-*-
     2
    13$description = "The following test creates a makefile to test MAKE \n"
    24              ."(very generic)";
     
    2729&run_make_with_options($makefile,"",&get_logfile,0);
    2830
    29 &delete("foo");
     31&rmfiles("foo");
    3032# COMPARE RESULTS
    3133&compare_output($answer,&get_logfile(1));
  • branches/GNU/src/gmake/tests/scripts/variables/MAKELEVEL

    r53 r284  
    1 #                                                               -*-perl-mode-*-
     1#                                                                    -*-perl-*-
    22
    33$description = "The following test creates a makefile to test
     
    1010
    1111print MAKEFILE <<EOF;
    12 SHELL = /bin/sh
    1312all:
    1413\t\@echo MAKELEVEL is \$(MAKELEVEL)
  • branches/GNU/src/gmake/tests/scripts/variables/automatic

    r53 r284  
    6868
    6969&run_make_with_options($makefile2, "$dir/foo $dir/bar", &get_logfile);
    70 $answer = ".x\n$dir/foo.x\n\$.x\n\[email protected]\n$dir.x\nfoo.x\n$dir/bar.x\nbar.x\n";
     70$answer = ".x\n$dir/foo.x\nx\n\[email protected]\n$dir.x\nfoo.x\n$dir/bar.x\nbar.x\n";
    7171&compare_output($answer, &get_logfile(1));
    7272
    7373&run_make_with_options($makefile2, "$dir/x.z $dir/y.z", &get_logfile);
    74 $answer = ".x\n$dir/x.z.x\n\$.x\n\[email protected]\n$dir.x\nx.z.x\n.y\n$dir/y.z.y\n\$.y\n\[email protected]\n$dir.y\ny.z.y\n";
     74$answer = ".x\n$dir/x.z.x\nx\n\[email protected]\n$dir.x\nx.z.x\n.y\n$dir/y.z.y\n\y\n\[email protected]\n$dir.y\ny.z.y\n";
    7575&compare_output($answer, &get_logfile(1));
    7676
     
    7979&compare_output($answer, &get_logfile(1));
    8080
     81# TEST #3 -- test for Savannah bug #12320.
     82#
     83run_make_test('
     84.SUFFIXES: .b .src
     85
     86mbr.b: mbr.src
     87        @echo $*
     88
     89mbr.src: ; @:
     90
     91',
     92'',
     93'mbr
     94');
     95
    81961;
  • branches/GNU/src/gmake/tests/scripts/variables/flavors

    r53 r284  
    7272
    7373&run_make_with_options($makefile, "BOGUS=true", &get_logfile, 512);
    74 $answer = "$makefile:23: *** empty variable name.  Stop.\n";
     74$answer = "$makefile:24: *** empty variable name.  Stop.\n";
    7575&compare_output($answer, &get_logfile(1));
    7676
     
    8282&compare_output($answer, &get_logfile(1));
    8383
     84# Clean up from "old style" testing.  If all the above tests are converted to
     85# run_make_test() syntax than this line can be removed.
     86$makefile = undef;
     87
     88# -------------------------
     89# Make sure that prefix characters apply properly to define/endef values.
     90#
     91# There's a bit of oddness here if you try to use a variable to hold the
     92# prefix character for a define.  Even though something like this:
     93#
     94#       define foo
     95#       echo bar
     96#       endef
     97#
     98#       all: ; $(V)$(foo)
     99#
     100# (where V=@) can be seen by the user to be obviously different than this:
     101#
     102#       define foo
     103#       $(V)echo bar
     104#       endef
     105#
     106#       all: ; $(foo)
     107#
     108# and the user thinks it should behave the same as when the "@" is literal
     109# instead of in a variable, that can't happen because by the time make
     110# expands the variables for the command line and sees it begins with a "@" it
     111# can't know anymore whether the prefix character came before the variable
     112# reference or was included in the first line of the variable reference.
     113
     114# TEST #5
     115# -------
     116
     117run_make_test('
     118define FOO
     119$(V1)echo hello
     120$(V2)echo world
     121endef
     122all: ; @$(FOO)
     123', '', 'hello
     124world');
     125
     126# TEST #6
     127# -------
     128
     129run_make_test(undef, 'V1=@ V2=@', 'hello
     130world');
     131
     132# TEST #7
     133# -------
     134
     135run_make_test('
     136define FOO
     137$(V1)echo hello
     138$(V2)echo world
     139endef
     140all: ; $(FOO)
     141', 'V1=@', 'hello
     142echo world
     143world');
     144
     145# TEST #8
     146# -------
     147
     148run_make_test(undef, 'V2=@', 'echo hello
     149hello
     150world');
     151
     152# TEST #9
     153# -------
     154
     155run_make_test(undef, 'V1=@ V2=@', 'hello
     156world');
     157
     158# TEST #10
     159# -------
     160# Test the basics; a "@" internally to the variable applies to only one line.
     161# A "@" before the variable applies to the entire variable.
     162
     163run_make_test('
     164define FOO
     165@echo hello
     166echo world
     167endef
     168define BAR
     169echo hello
     170echo world
     171endef
     172
     173all: foo bar
     174foo: ; $(FOO)
     175bar: ; @$(BAR)
     176', '', 'hello
     177echo world
     178world
     179hello
     180world
     181');
    84182
    851831;
  • branches/GNU/src/gmake/tests/scripts/variables/special

    r53 r284  
    55$details = "";
    66
    7 $makefile2 = &get_tmpfile;
    8 
    9 
    10 open(MAKEFILE, "> $makefile");
    11 
    12 print MAKEFILE <<'EOF';
     7&run_make_test('
    138
    149X1 := $(sort $(filter FOO BAR,$(.VARIABLES)))
     
    2419        @echo X2 = $(X2)
    2520        @echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES)))
    26 
    27 EOF
    28 
    29 close(MAKEFILE);
    30 
    31 # TEST #1
    32 # -------
    33 
    34 &run_make_with_options($makefile, "", &get_logfile);
    35 $answer = "X1 =\nX2 = FOO\nLAST = BAR FOO\n";
    36 &compare_output($answer, &get_logfile(1));
     21',
     22               '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n");
    3723
    3824
    3925
    40 
     26# $makefile2 = &get_tmpfile;
    4127# open(MAKEFILE, "> $makefile2");
    4228
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