Changeset 2591 in kBuild for trunk/src/kmk/tests/scripts/features/targetvars
- Timestamp:
- Jun 17, 2012 8:45:31 PM (12 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
- Property svn:ignore
-
old new 13 13 stamp-* 14 14 makebook* 15 15 16 .*gdbinit 17 .gdb_history 18 16 19 *.dep 17 20 *.dvi … … 31 34 *.pg 32 35 *.pgs 36 33 37 README 34 38 README.DOS 35 39 README.W32 40 README.OS2 36 41 aclocal.m4 37 42 autom4te.cache … … 52 57 config.h.W32 53 58 config.h-vms 59 54 60 loadavg 55 61 loadavg.c 56 62 make 63 57 64 .deps 58 65 .dep_segment 66 ID 67 TAGS 68 59 69 _* 60 70 sun4 … … 72 82 sol2 73 83 i486-linux 84 74 85 customs 86 75 87 install-sh 76 88 mkinstalldirs 89 90 .directive.asc
-
- Property svn:ignore
-
trunk/src/kmk/tests
- Property svn:ignore
--- +++
- Property svn:ignore
-
trunk/src/kmk/tests/scripts/features/targetvars
r2165 r2591 7 7 rules, semicolon interference, etc."; 8 8 9 open(MAKEFILE,"> $makefile"); 10 11 print MAKEFILE <<'EOF'; 9 run_make_test(' 12 10 SHELL = /bin/sh 13 11 export FOO = foo … … 18 16 three: ; BAR=1000 19 17 @echo $(FOO) $(BAR) 20 # Some things that shouldn 't be target vars18 # Some things that shouldn not be target vars 21 19 funk : override 22 20 funk : override adelic … … 25 23 four:FOO=x 26 24 four:VAR$(FOO)=ok 27 four: ; @echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)'25 four: ; @echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)" 28 26 five:FOO=x 29 27 five six : VAR$(FOO)=good 30 five six: ;@echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)'28 five six: ;@echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)" 31 29 # Test per-target variable inheritance 32 30 seven: eight … … 42 40 # Test = escaping 43 41 EQ = = 44 ten: one \=two45 ten: one \=two42 ten: one$(EQ)two 43 ten: one $(EQ) two 46 44 ten one$(EQ)two $(EQ):;@echo $@ 47 45 .PHONY: one two three four five six seven eight nine ten $(EQ) one$(EQ)two … … 55 53 foo.r : RVAR += rvar 56 54 foo.t : TVAR := $(QVAR) 57 EOF 58 59 close(MAKEFILE); 60 61 # TEST #1 62 63 &run_make_with_options($makefile, "-j1 one two three", &get_logfile); 64 $answer = "one bar\nfoo two\nBAR=1000\nfoo bar\n"; 65 &compare_output($answer,&get_logfile(1)); 55 ', 56 "one two three", "one bar\nfoo two\nBAR=1000\nfoo bar\n"); 66 57 67 58 # TEST #2 68 59 69 &run_make_with_options($makefile, "-j1 one two FOO=1 BAR=2", &get_logfile); 70 $answer = "one 2\n1 2\n"; 71 &compare_output($answer,&get_logfile(1)); 60 run_make_test(undef, "one two FOO=1 BAR=2", "one 2\n1 2\n"); 72 61 73 62 # TEST #3 74 63 75 &run_make_with_options($makefile, "-j1 four", &get_logfile); 76 $answer = "x ok ok\n"; 77 &compare_output($answer,&get_logfile(1)); 64 run_make_test(undef, "four", "x ok ok\n"); 78 65 79 66 # TEST #4 80 67 81 &run_make_with_options($makefile, "-j1 seven", &get_logfile); 82 $answer = "eight: seven eight\nseven: seven seven\n"; 83 &compare_output($answer,&get_logfile(1)); 68 run_make_test(undef, "seven", "eight: seven eight\nseven: seven seven\n"); 84 69 85 70 # TEST #5 86 71 87 &run_make_with_options($makefile, "-j1 nine", &get_logfile); 88 $answer = "wallace bar wallace bar\n"; 89 &compare_output($answer,&get_logfile(1)); 72 run_make_test(undef, "nine", "wallace bar wallace bar\n"); 90 73 91 74 # TEST #5-a 92 75 93 &run_make_with_options($makefile, "-j1 nine-a", &get_logfile); 94 $answer = "baz\n"; 95 &compare_output($answer,&get_logfile(1)); 76 run_make_test(undef, "nine-a", "baz\n"); 96 77 97 78 # TEST #6 98 79 99 &run_make_with_options($makefile, "-j1 ten", &get_logfile); 100 $answer = "one=two\none bar\n=\nfoo two\nten\n"; 101 &compare_output($answer,&get_logfile(1)); 80 run_make_test(undef, "ten", "one=two\none bar\n=\nfoo two\nten\n"); 102 81 103 82 # TEST #6 104 83 105 &run_make_with_options($makefile, "-j1 foo.q bar.q", &get_logfile); 106 $answer = "qvar = rvar\nqvar =\n"; 107 &compare_output($answer,&get_logfile(1)); 84 run_make_test(undef, "foo.q bar.q", "qvar = rvar\nqvar =\n"); 108 85 109 86 # TEST #7 110 87 111 &run_make_with_options($makefile, "-j1 foo.t bar.s", &get_logfile); 112 $answer = "qvar = qvar\nqvar =\n"; 113 &compare_output($answer,&get_logfile(1)); 88 run_make_test(undef, "foo.t bar.s", "qvar = qvar\nqvar =\n"); 114 89 115 90 … … 117 92 # For PR/1378: Target-specific vars don't inherit correctly 118 93 119 $makefile2 = &get_tmpfile; 120 121 open(MAKEFILE,"> $makefile2"); 122 print MAKEFILE <<'EOF'; 94 run_make_test(' 123 95 foo: FOO = foo 124 96 bar: BAR = bar … … 126 98 bar: baz 127 99 baz: ; @echo $(FOO) $(BAR) 128 EOF 129 close(MAKEFILE); 130 131 &run_make_with_options("$makefile2", "", &get_logfile); 132 $answer = "foo bar\n"; 133 &compare_output($answer, &get_logfile(1)); 100 ', "", "foo bar\n"); 134 101 135 102 # TEST #9 … … 137 104 # Also PR/1831 138 105 139 $makefile3 = &get_tmpfile; 140 141 open(MAKEFILE,"> $makefile3"); 142 print MAKEFILE <<'EOF'; 106 run_make_test(' 143 107 .PHONY: all one 144 108 all: FOO += baz … … 150 114 one: FOO += boz 151 115 one: ; @echo $(FOO) 152 EOF 153 close(MAKEFILE); 154 155 &run_make_with_options("$makefile3", "", &get_logfile); 156 $answer = "bar baz biz boz\nbar baz\n"; 157 &compare_output($answer, &get_logfile(1)); 116 ', 117 '', "bar baz biz boz\nbar baz\n"); 158 118 159 119 # Test #10 160 120 161 &run_make_with_options("$makefile3", "one", &get_logfile); 162 $answer = "bar biz boz\n"; 163 &compare_output($answer, &get_logfile(1)); 121 run_make_test(undef, 'one', "bar biz boz\n"); 164 122 165 123 # Test #11 166 124 # PR/1709: Test semicolons in target-specific variable values 167 125 168 $makefile4 = &get_tmpfile; 169 170 open(MAKEFILE, "> $makefile4"); 171 print MAKEFILE <<'EOF'; 126 run_make_test(' 172 127 foo : FOO = ; ok 173 foo : ; @echo '$(FOO)' 174 EOF 175 close(MAKEFILE); 176 177 &run_make_with_options("$makefile4", "", &get_logfile); 178 $answer = "; ok\n"; 179 &compare_output($answer, &get_logfile(1)); 128 foo : ; @echo "$(FOO)" 129 ', 130 '', "; ok\n"); 180 131 181 132 # Test #12 … … 183 134 # I nailed it this time :-/. 184 135 185 $makefile5 = &get_tmpfile; 186 187 open(MAKEFILE, "> $makefile5"); 188 print MAKEFILE <<'EOF'; 136 run_make_test(' 189 137 .PHONY: a 190 138 … … 196 144 a: BLAH := bar 197 145 a: COMMAND += snafu $(BLAH) 198 EOF 199 close(MAKEFILE); 200 201 &run_make_with_options("$makefile5", "", &get_logfile); 202 $answer = "bar snafu bar\n"; 203 &compare_output($answer, &get_logfile(1)); 146 ', 147 '', "bar snafu bar\n"); 204 148 205 149 # Test #13 206 150 # Test double-colon rules with target-specific variable values 207 151 208 $makefile6 = &get_tmpfile; 209 210 open(MAKEFILE, "> $makefile6"); 211 print MAKEFILE <<'EOF'; 152 run_make_test(' 212 153 W = bad 213 154 X = bad … … 225 166 fo% : Z = pat 226 167 endif 227 228 EOF 229 close(MAKEFILE); 230 231 &run_make_with_options("$makefile6", "foo", &get_logfile); 232 $answer = "ok ok foo nopat\nok ok foo nopat\n"; 233 &compare_output($answer, &get_logfile(1)); 168 ', 169 'foo', "ok ok foo nopat\nok ok foo nopat\n"); 234 170 235 171 # Test #14 … … 237 173 # inheritance 238 174 239 &run_make_with_options("$makefile6", "bar", &get_logfile); 240 $answer = "ok ok bar nopat\nok ok bar nopat\n"; 241 &compare_output($answer, &get_logfile(1)); 175 run_make_test(undef, 'bar', "ok ok bar nopat\nok ok bar nopat\n"); 242 176 243 177 # Test #15 244 178 # Test double-colon rules with pattern-specific variable values 245 179 246 &run_make_with_options("$makefile6", "foo PATTERN=yes", &get_logfile); 247 $answer = "ok ok foo pat\nok ok foo pat\n"; 248 &compare_output($answer, &get_logfile(1)); 249 180 run_make_test(undef, 'foo PATTERN=yes', "ok ok foo pat\nok ok foo pat\n"); 250 181 251 182 # Test #16 … … 253 184 # (> make default buffer length) 254 185 255 $makefile7 = &get_tmpfile; 256 257 open(MAKEFILE, "> $makefile7"); 258 print MAKEFILE <<'EOF'; 186 run_make_test(' 259 187 base_metals_fmd_reports.sun5 base_metals_fmd_reports CreateRealPositions CreateMarginFunds deals_changed_since : BUILD_OBJ=$(shell if [ -f "build_information.generate" ]; then echo "$(OBJ_DIR)/build_information.o"; else echo "no build information"; fi ) 260 188 261 189 deals_changed_since: ; @echo $(BUILD_OBJ) 262 263 EOF 264 close(MAKEFILE); 265 266 &run_make_with_options("$makefile7", '', &get_logfile); 267 $answer = "no build information\n"; 268 &compare_output($answer, &get_logfile(1)); 190 ', 191 '', "no build information\n"); 269 192 270 193 # TEST #17 … … 287 210 .INTERMEDIATE: foo.x rules.mk 288 211 ', 289 '-I t1', 290 'MYVAR= FOOVAR=bar ALLVAR=xxx'); 212 '-I t1', 'MYVAR= FOOVAR=bar ALLVAR=xxx'); 291 213 292 214 rmfiles('t1/rules.mk'); … … 298 220 # double-expansion. See Savannah bug #15913. 299 221 300 run_make_test( "301 VAR := \$\$FOO222 run_make_test(' 223 VAR := $$FOO 302 224 foo: VAR += BAR 303 foo: ; \@echo '\$(VAR)'", 304 '', 305 '$FOO BAR'); 225 foo: ; @echo '."'".'$(VAR)'."'".' 226 ', 227 '', '$FOO BAR'); 228 229 # TEST #19: Override with append variables 230 231 run_make_test(' 232 a: override FOO += f1 233 a: FOO += f2 234 a: ; @echo "$(FOO)" 235 ', 236 '', "f1\n"); 237 238 run_make_test(undef, 'FOO=C', "C f1\n"); 239 240 # TEST #20: Check for continuation after semicolons 241 242 run_make_test(q! 243 a: A = 'hello; \ 244 world' 245 a: ; @echo $(A) 246 !, 247 '', "hello; world\n"); 248 249 # TEST #19: Test define/endef variables as target-specific vars 250 251 # run_make_test(' 252 # define b 253 # @echo global 254 # endef 255 # a: define b 256 # @echo local 257 # endef 258 259 # a: ; $(b) 260 # ', 261 # '', "local\n"); 306 262 307 263 1;
Note:
See TracChangeset
for help on using the changeset viewer.

