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/functions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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 <qwe123@chello.at>
    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 <qwe123@chello.at>
    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;
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