Changeset 284 in kBuild for branches/GNU/src/gmake/tests/scripts/functions
- Timestamp:
- May 16, 2005 4:54:08 PM (19 years ago)
- 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 135 135 delete $ENV{EVAR}; 136 136 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 144 run_make_test(' 145 define FOO 146 all: ; @echo hello \ 147 world 148 endef 149 $(eval $(FOO)) 150 ', '', 'hello world'); 151 152 run_make_test(' 153 define FOO 154 all: ; @echo he\llo 155 @echo world 156 endef 157 $(eval $(FOO)) 158 ', '', 'hello 159 world'); 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 167 run_make_test('deps: ; $(eval deps: foo)', '', 168 '#MAKEFILE#:1: *** prerequisites cannot be defined in command scripts. Stop.', 169 512); 170 137 171 1; -
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"; 2 4 3 5 $details = ""; 4 6 5 open(MAKEFILE,"> $makefile"); 7 # Generic patsubst test: test both the function and variable form. 6 8 7 # The Contents of the MAKEFILE ... 9 run_make_test(' 10 foo := a.o b.o c.o 11 bar := $(foo:.o=.c) 12 bar2:= $(foo:%.o=%.c) 13 bar3:= $(patsubst %.c,%.o,x.c.c bar.c) 14 all:;@echo $(bar); echo $(bar2); echo $(bar3)', 15 '', 16 'a.c b.c c.c 17 a.c b.c c.c 18 x.c.o bar.o'); 8 19 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> 17 22 18 # END of Contents of MAKEFILE 23 run_make_test('all:;@echo $(patsubst Foo,Repl,FooFoo)', '', 'FooFoo'); 19 24 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> 21 27 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)); 28 run_make_test(' 29 A := fooBARfooBARfoo 30 all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL'); 30 31 31 32 1; -
branches/GNU/src/gmake/tests/scripts/functions/wildcard
r53 r284 86 86 &run_make_with_options($makefile,"clean",&get_logfile); 87 87 88 &compare_output($answer,&get_logfile(1)); 89 90 if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) 91 { 88 if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) { 92 89 $test_passed = 0; 93 90 } 91 92 &compare_output($answer,&get_logfile(1)); 94 93 95 94 -
branches/GNU/src/gmake/tests/scripts/functions/word
r53 r284 1 1 # -*-perl-*- 2 $description = "Test the word, words, and wordlist functions.\n"; 2 $description = "\ 3 Test the word, words, wordlist, firstword, and lastword functions.\n"; 3 4 4 5 $details = "\ … … 88 89 &compare_output($answer, &get_logfile(1)); 89 90 91 92 # TEST #8 -- test $(firstword ) 93 # 94 run_make_test(' 95 void := 96 list := $(void) foo bar baz # 97 98 a := $(word 1,$(list)) 99 b := $(firstword $(list)) 100 101 .PHONY: all 102 103 all: 104 @test "$a" = "$b" && echo $a 105 ', 106 '', 107 'foo'); 108 109 110 # TEST #9 -- test $(lastword ) 111 # 112 run_make_test(' 113 void := 114 list := $(void) foo bar baz # 115 116 a := $(word $(words $(list)),$(list)) 117 b := $(lastword $(list)) 118 119 .PHONY: all 120 121 all: 122 @test "$a" = "$b" && echo $a 123 ', 124 '', 125 'baz'); 126 90 127 # This tells the test driver that the perl test script executed properly. 91 128 1;
Note:
See TracChangeset
for help on using the changeset viewer.

