Changeset 3140 for trunk/src/kmk/tests/scripts
- Timestamp:
- Mar 14, 2018, 10:28:10 PM (7 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 56 edited
- 17 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
-
Property svn:mergeinfo
set to
/vendor/gnumake/current merged eligible
-
Property svn:mergeinfo
set to
-
trunk/src/kmk/tests/scripts/features/conditionals
r969 r3140 142 142 'success'); 143 143 144 # SV 47960 : ensure variable assignments in non-taken legs don't cause problems 145 run_make_test(' 146 ifneq ($(FOO),yes) 147 target: 148 else 149 BAR = bar 150 target: 151 endif 152 @echo one 153 ', 154 '', "one\n"); 155 144 156 145 157 # This tells the test driver that the perl test script executed properly. 146 158 1; 159 160 ### Local Variables: 161 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 162 ### End: -
trunk/src/kmk/tests/scripts/features/default_names
r1937 r3140 11 11 close(MAKEFILE); 12 12 13 # DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile. 14 # Just test what we can here (avoid Makefile versus makefile test). 15 # bird: made this generic, darwin is also defaulting to case insensitive fs. 13 # Create another makefile called "makefile" 14 open(MAKEFILE,"> makefile"); 15 print MAKEFILE "SECOND: ; \@echo It chose makefile\n"; 16 close(MAKEFILE); 16 17 17 if ($port_type eq 'UNIX' && !$case_insensitive_fs) { 18 # Create another makefile called "makefile" 19 open(MAKEFILE,"> makefile"); 20 print MAKEFILE "SECOND: ; \@echo It chose makefile\n"; 21 close(MAKEFILE); 18 # DOS/WIN32/MacOSX platforms are case-insensitive / case-preserving, so 19 # Makefile is the same file as makefile. Just test what we can here. 20 21 my $case_sensitive = 0; 22 if (! -f 'Makefile') { 23 # Create another makefile called "Makefile" 24 $case_sensitive = 1; 25 open(MAKEFILE,"> Makefile"); 26 print MAKEFILE "THIRD: ; \@echo It chose Makefile\n"; 27 close(MAKEFILE); 22 28 } 23 29 24 # Create another makefile called "Makefile" 25 open(MAKEFILE,"> Makefile"); 26 print MAKEFILE "THIRD: ; \@echo It chose Makefile\n"; 27 close(MAKEFILE); 30 run_make_with_options("","",&get_logfile); 31 compare_output("It chose GNUmakefile\n",&get_logfile(1)); 32 unlink($makefile); 28 33 34 run_make_with_options("","",&get_logfile); 35 compare_output("It chose makefile\n",&get_logfile(1)); 36 unlink("makefile"); 29 37 30 &run_make_with_options("","",&get_logfile); 31 &compare_output("It chose GNUmakefile\n",&get_logfile(1)); 32 unlink $makefile; 33 34 if ($port_type eq 'UNIX' && !$case_insensitive_fs) { 35 &run_make_with_options("","",&get_logfile); 36 &compare_output("It chose makefile\n",&get_logfile(1)); 37 unlink "makefile"; 38 if ($case_sensitive) { 39 run_make_with_options("","",&get_logfile); 40 compare_output("It chose Makefile\n",&get_logfile(1)); 41 unlink("Makefile"); 38 42 } 39 43 40 &run_make_with_options("","",&get_logfile); 41 &compare_output("It chose Makefile\n",&get_logfile(1)); 42 unlink "Makefile"; 44 1; -
trunk/src/kmk/tests/scripts/features/double_colon
r969 r3140 152 152 unlink('result','one','two'); 153 153 154 # TEST 10: SV 33399 : check for proper backslash handling 155 156 run_make_test(' 157 a\ xb :: ; @echo one 158 a\ xb :: ; @echo two 159 ', 160 '', "one\ntwo\n"); 161 162 # Test 11: SV 44742 : All double-colon rules should be run in parallel build. 163 164 run_make_test('result :: 01 165 @echo update 166 @touch $@ 167 result :: 02 168 @echo update 169 @touch $@ 170 result :: 03 171 @echo update 172 @touch $@ 173 result :: 04 174 @echo update 175 @touch $@ 176 result :: 05 177 @echo update 178 @touch $@ 179 01 02 03 04 05: 180 @touch 01 02 03 04 05 181 ', 182 '-j10 result', "update\nupdate\nupdate\nupdate\nupdate\n"); 183 184 unlink('result', '01', '02', '03', '04', '05'); 185 186 # Test 12: SV 44742 : Double-colon rules with parallelism 187 188 run_make_test(' 189 root: all 190 echo root 191 all:: 192 echo all_one 193 all:: 3 194 echo all_two 195 %: 196 sleep $* 197 ', 198 '-rs -j2 1 2 root', "all_one\nall_two\nroot\n"); 199 200 # SV 47995 : Parallel double-colon rules with FORCE 201 202 run_make_test(' 203 all:: ; @echo one 204 205 all:: joe ; @echo four 206 207 joe: FORCE ; touch joe-is-forced 208 209 FORCE: 210 ', 211 '-j5', "one\ntouch joe-is-forced\nfour\n"); 212 213 unlink('joe-is-forced'); 214 154 215 # This tells the test driver that the perl test script executed properly. 155 216 1; 217 218 ### Local Variables: 219 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 220 ### End: -
trunk/src/kmk/tests/scripts/features/errors
r969 r3140 31 31 ."\t-$rm_command cleanit\n" 32 32 ."\t$rm_command foo\n" 33 33 ."clean2: \n" 34 34 ."\t$rm_command cleanit\n" 35 35 ."\t$rm_command foo\n"; … … 43 43 unlink("cleanit"); 44 44 $cleanit_error = `sh -c "$rm_command cleanit 2>&1"`; 45 chomp $cleanit_error; 45 46 $delete_error_code = $? >> 8; 46 47 … … 48 49 # ------- 49 50 50 $answer = "$rm_command cleanit \n"51 .$cleanit_error52 ."$make_name: [clean] Error $delete_error_code (ignored)\n" 53 ."$rm_command foo\n";51 $answer = "$rm_command cleanit 52 $cleanit_error 53 $make_name: [$makefile:2: clean] Error $delete_error_code (ignored) 54 $rm_command foo\n"; 54 55 55 56 &run_make_with_options($makefile,"",&get_logfile); … … 75 76 # ------- 76 77 77 $answer = "$rm_command cleanit \n"78 .$cleanit_error79 ."$make_name: [clean2] Error $delete_error_code (ignored)\n" 80 ."$rm_command foo\n";78 $answer = "$rm_command cleanit 79 $cleanit_error 80 $make_name: [$makefile:5: clean2] Error $delete_error_code (ignored) 81 $rm_command foo\n"; 81 82 82 83 &run_make_with_options($makefile,"clean2 -i",&get_logfile); … … 90 91 } 91 92 93 # Test that error line offset works 94 95 run_make_test(q! 96 all: 97 @echo hi 98 @echo there 99 @exit 1 100 !, 101 '', "hi\nthere\n#MAKE#: *** [#MAKEFILE#:5: all] Error 1", 512); 102 92 103 1; 104 105 ### Local Variables: 106 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 107 ### End: -
trunk/src/kmk/tests/scripts/features/escape
r1938 r3140 3 3 4 4 $details = "\ 5 Make sure that escaping of `:' works in target names.5 Make sure that escaping of ':' works in target names. 6 6 Make sure escaping of whitespace works in target names. 7 Make sure that escaping of '#' works."; 8 9 10 close(MAKEFILE); 7 Make sure that escaping of '#' works. 8 Make sure that backslash before non-special characters are kept."; 11 9 12 10 … … 27 25 run_make_test(undef, 28 26 'path=pre:', 29 "#MAKEFILE#:2: *** target pattern contains no `%' (target `foo'). Stop.",27 "#MAKEFILE#:2: *** target pattern contains no '%' (target 'foo'). Stop.", 30 28 512); 31 29 … … 40 38 run_make_test(undef, 41 39 "'path=pre\\\\:'", 42 "#MAKEFILE#:2: *** target pattern contains no `%' (target `foo'). Stop.",40 "#MAKEFILE#:2: *** target pattern contains no '%' (target 'foo'). Stop.", 43 41 512); 44 42 … … 55 53 'foo#bar.ext = (foo#bar.ext)'); 56 54 55 # Test escaped colons in prerequisites 56 # Quoting of backslashes in q!! is kind of messy. 57 # Solaris sh does not properly handle backslashes even in '' so just 58 # check the output make prints, not what the shell interprets. 59 run_make_test(q! 60 foo: foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar 61 foo foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar: ; : '$@' 62 !, 63 '', ": 'foo:bar'\n: 'foo\\:bar'\n: 'foo\\\\:bar'\n: 'foo'\n"); 64 65 # Test backslash before non-special chars: should be kept as-is 66 67 run_make_test(q! 68 all: ..\foo 69 .DEFAULT: ; : '$@' 70 !, 71 '', ": '..\\foo'\n"); 72 57 73 # This tells the test driver that the perl test script executed properly. 58 74 1; -
trunk/src/kmk/tests/scripts/features/include
r2591 r3140 1 1 # -*-mode: perl; rm-trailing-spaces: nil-*- 2 2 3 $description = "Test various forms of the GNU make `include' command.";3 $description = "Test various forms of the GNU make 'include' command."; 4 4 5 5 $details = "\ … … 61 61 ', 62 62 '', 63 "#MAKE#: *** No rule to make target `foo.mk', needed by `error'. Stop.\n",63 "#MAKE#: *** No rule to make target 'foo.mk', needed by 'error'. Stop.\n", 64 64 512 65 65 ); … … 129 129 ', 130 130 '', 131 "#MAKE#: *** No rule to make target `baz', needed by `bar'. Stop.\n",131 "#MAKE#: *** No rule to make target 'baz', needed by 'bar'. Stop.\n", 132 132 512); 133 133 … … 145 145 ', 146 146 '', 147 "#MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n",147 "#MAKE#: *** No rule to make target 'end', needed by 'baz'. Stop.\n", 148 148 512); 149 149 … … 163 163 '', 164 164 "#MAKEFILE#:2: bar: No such file or directory 165 #MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n",165 #MAKE#: *** No rule to make target 'end', needed by 'baz'. Stop.\n", 166 166 512); 167 168 # Test include of make-able file doesn't show an error (Savannah #102) 169 run_make_test(q! 170 .PHONY: default 171 default:; @echo DONE 172 173 inc1:; echo > $@ 174 include inc1 175 include inc2 176 inc2:; echo > $@ 177 !, 178 '', "echo > inc2\necho > inc1\nDONE\n"); 179 180 rmfiles('inc1', 'inc2'); 181 182 # Test include of non-make-able file does show an error (Savannah #102) 183 run_make_test(q! 184 .PHONY: default 185 default:; @echo DONE 186 187 inc1:; echo > $@ 188 include inc1 189 include inc2 190 !, 191 '', "#MAKEFILE#:7: inc2: No such file or directory\n#MAKE#: *** No rule to make target 'inc2'. Stop.\n", 512); 192 193 rmfiles('inc1'); 194 195 # Include same file multiple times 196 197 run_make_test(q! 198 default:; @echo DEFAULT 199 include inc1 200 inc1:; echo > $@ 201 include inc1 202 !, 203 '', "echo > inc1\nDEFAULT\n"); 204 205 rmfiles('inc1'); 206 207 # Included file has a prerequisite that fails to build 208 209 run_make_test(q! 210 default:; @echo DEFAULT 211 include inc1 212 inc1: foo; echo > $@ 213 foo:; exit 1 214 !, 215 '', "exit 1\n#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** [#MAKEFILE#:5: foo] Error 1\n", 512); 216 217 rmfiles('inc1'); 218 219 # Included file has a prerequisite we don't know how to build 220 221 run_make_test(q! 222 default:; @echo DEFAULT 223 include inc1 224 inc1: foo; echo > $@ 225 !, 226 '', "#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** No rule to make target 'foo', needed by 'inc1'. Stop.\n", 512); 227 228 rmfiles('inc1'); 229 230 # include a directory 167 231 168 232 if ($all_tests) { … … 173 237 foo: ; @echo foo = bar > $@ 174 238 !, 175 '', "#MAKE#: `foo' is up to date.\n");239 '', "#MAKE#: 'foo' is up to date.\n"); 176 240 rmfiles('foo'); 177 241 } -
trunk/src/kmk/tests/scripts/features/mult_rules
r969 r3140 48 48 49 49 # Create the answer to what should be produced by this Makefile 50 $answer = "$make_name: *** No rule to make target `extra.h', needed by `foo.o'. Stop.\n";50 $answer = "$make_name: *** No rule to make target 'extra.h', needed by 'foo.o'. Stop.\n"; 51 51 52 52 &compare_output($answer,&get_logfile(1)); -
trunk/src/kmk/tests/scripts/features/parallelism
r2591 r3140 42 42 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@", 43 43 "-j4", 44 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n" );44 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7); 45 45 46 46 rmfiles(qw(1.inc 2.inc)); … … 61 61 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@", 62 62 "-j4", 63 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n" );63 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7); 64 64 65 65 rmfiles(qw(1.inc 2.inc)); … … 92 92 93 93 fail.1 fail.2 fail.3: 94 \@ sleep\$(patsubst fail.%,%,\$\@)94 \@$sleep_command \$(patsubst fail.%,%,\$\@) 95 95 \@echo Fail 96 96 \@exit 1 97 97 98 98 ok: 99 \@ sleep499 \@$sleep_command 4 100 100 \@echo Ok done", 101 '-rR -j5', (!$is_kmk) ? 'Fail102 #MAKE#: *** [ fail.1] Error 1101 '-rR -j5', (!$is_kmk) ? "Fail 102 #MAKE#: *** [#MAKEFILE#:8: fail.1] Error 1 103 103 #MAKE#: *** Waiting for unfinished jobs.... 104 104 Fail 105 #MAKE#: *** [ fail.2] Error 1106 Fail 107 #MAKE#: *** [ fail.3] Error 1108 Ok done ': 'Fail105 #MAKE#: *** [#MAKEFILE#:8: fail.2] Error 1 106 Fail 107 #MAKE#: *** [#MAKEFILE#:8: fail.3] Error 1 108 Ok done" : 'Fail 109 109 #MAKE#: *** [fail.1] Error 1 110 110 The failing command: … … 155 155 rmfiles('target'); 156 156 157 # TEST #10: Don't put --jobserver-fds into a re-exec'd MAKEFLAGS. 158 # We can't test this directly because there's no way a makefile can 159 # show the value of MAKEFLAGS we were re-exec'd with. We can intuit it 160 # by looking for "disabling jobserver mode" warnings; we should only 161 # get one from the original invocation and none from the re-exec. 162 # See Savannah bug #18124 157 # TEST #11: Make sure -jN from MAKEFLAGS is processed even when we re-exec 158 # See Savannah bug #33873 159 160 $extraENV{MAKEFLAGS} = '-j4'; 163 161 164 162 run_make_test(q! 163 things = thing1 thing2 164 all: $(things) 165 thing1:; @sleep 1; echo '$@ start'; sleep 2; echo '$@ end' 166 thing2:; @echo '$@ start'; sleep 2; echo '$@ end' 165 167 -include inc.mk 166 recur: 167 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 168 @rm -f inc.mk 169 @$(MAKE) -j2 -f #MAKEFILE# all 170 all: 171 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 172 @echo $@ 173 inc.mk: 174 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 175 @echo 'FOO = bar' > $@ 168 inc.mk: ; @touch $@ 176 169 !, 177 '--no-print-directory -j2', "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n"); 178 170 '', "thing2 start\nthing1 start\nthing2 end\nthing1 end\n"); 171 172 delete $extraENV{MAKEFLAGS}; 179 173 rmfiles('inc.mk'); 180 174 181 if ($all_tests) { 182 # Implicit files aren't properly recreated during parallel builds 183 # Savannah bug #26864 184 185 # The first run works fine 186 run_make_test(q! 187 %.bar: %.x foo.y ; cat $^ > $@ 188 %.x: ; touch $@ 189 foo.y: foo.y.in ; cp $< $@ 190 foo.y.in: ; touch $@ 175 # Ensure intermediate/secondary files are not pruned incorrectly. 176 # See Savannah bug #30653 177 178 utouch(-15, 'file2'); 179 utouch(-10, 'file4'); 180 utouch(-5, 'file1'); 181 182 run_make_test(q! 183 .INTERMEDIATE: file3 184 file4: file3 ; @mv -f $< $@ 185 file3: file2 ; touch $@ 186 file2: file1 ; @touch $@ 191 187 !, 192 '-j2 main.bar', 193 "touch foo.y.in 194 touch main.x 195 cp foo.y.in foo.y 196 cat main.x foo.y > main.bar 197 rm main.x"); 198 199 # Now we touch the .in file and make sure it still works 200 touch('foo.y.in'); 201 202 run_make_test(undef, '-j2 main.bar', "cp foo.y.in foo.y 203 touch main.x 204 cat main.x foo.y > main.bar 205 rm main.x"); 206 207 # Clean up 208 rmfiles(qw(foo.y foo.y.in main.bar)); 209 } 210 211 if ($all_tests) { 212 # Jobserver FD handling is messed up in some way. 213 # Savannah bug #28189 214 # It doesn't look like that bug anymore but this is the code it runs 215 216 run_make_test(q! 217 ifdef EXTRA 218 vpath %.dst / 219 xxx.dst: ; true 220 yyy.dst: ; true 221 endif 222 223 M := $(MAKE) 224 xx: ; $M --no-print-directory -j2 -f $(MAKEFILE_LIST) xxx.dst yyy.dst EXTRA=1 225 !, 226 '-j2', 227 '#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode. 228 true 229 true 230 '); 231 } 188 '--no-print-directory -j2', "touch file3"); 189 190 rmfiles('file1', 'file2', 'file3', 'file4'); 232 191 233 192 # Make sure that all jobserver FDs are closed if we need to re-exec the … … 267 226 268 227 1; 228 229 ### Local Variables: 230 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 231 ### End: -
trunk/src/kmk/tests/scripts/features/patspecific_vars
r2591 r3140 82 82 b%: pattern := good $$t 83 83 84 global := or ginal $$t84 global := original $$t 85 85 86 86 … … 104 104 endif 105 105 106 %z: ; @echo \'patt rn: $a;\'106 %z: ; @echo \'pattern: $a;\' 107 107 108 108 … … 110 110 ', 111 111 '-j1', 112 'normal: global: or ginal $t pattern: inherit: ;113 patt rn: global: orginal $t pattern: inherit: ;');112 'normal: global: original $t pattern: inherit: ; 113 pattern: global: original $t pattern: inherit: ;'); 114 114 115 115 … … 119 119 '-j1 rec=1', 120 120 'normal: global: new $t pattern: good $t inherit: good $t; 121 patt rn: global: new $t pattern: good $t inherit: good $t;');121 pattern: global: new $t pattern: good $t inherit: good $t;'); 122 122 123 123 # TEST #8: override in pattern-specific variables -
trunk/src/kmk/tests/scripts/features/patternrules
r2591 r3140 112 112 "dir=$dir", 113 113 (!$is_kmk) ? 114 "#MAKE#: *** [ $dir/foo.bar] Error 1":114 "#MAKE#: *** [#MAKEFILE#:6: $dir/foo.bar] Error 1": 115 115 "#MAKE#: *** [$dir/foo.bar] Error 1" . ' 116 116 The failing command: … … 208 208 !, 209 209 'foo.tex', 210 "#MAKE#: *** No rule to make target `foo.tex'. Stop.", 512);210 "#MAKE#: *** No rule to make target 'foo.tex'. Stop.", 512); 211 211 212 212 unlink(@f); … … 227 227 # This tells the test driver that the perl test script executed properly. 228 228 1; 229 230 ### Local Variables: 231 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 232 ### End: -
trunk/src/kmk/tests/scripts/features/recursion
r2591 r3140 19 19 ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')), 20 20 ($vos 21 ? "#MAKE#: Entering directory `#PWD#'21 ? "#MAKE#: Entering directory '#PWD#' 22 22 make 'CFLAGS=-O' -f #MAKEFILE# foo 23 23 make CFLAGS=-O … … 27 27 MAKELEVEL = 0 28 28 THE END 29 #MAKE#: Leaving directory `#PWD#'"30 : "#MAKE#: Entering directory `#PWD#'29 #MAKE#: Leaving directory '#PWD#'" 30 : "#MAKE#: Entering directory '#PWD#' 31 31 #MAKEPATH# -f #MAKEFILE# foo 32 #MAKE#[1]: Entering directory `#PWD#'32 #MAKE#[1]: Entering directory '#PWD#' 33 33 #MAKEPATH# 34 34 MAKELEVEL = 1 35 35 #MAKEPATH# -f #MAKEFILE# last 36 #MAKE#[2]: Entering directory `#PWD#'36 #MAKE#[2]: Entering directory '#PWD#' 37 37 #MAKEPATH# 38 38 MAKELEVEL = 2 39 39 THE END 40 #MAKE#[2]: Leaving directory `#PWD#'41 #MAKE#[1]: Leaving directory `#PWD#'42 #MAKE#: Leaving directory `#PWD#'"));40 #MAKE#[2]: Leaving directory '#PWD#' 41 #MAKE#[1]: Leaving directory '#PWD#' 42 #MAKE#: Leaving directory '#PWD#'")); 43 43 44 44 -
trunk/src/kmk/tests/scripts/features/reinvoke
r969 r3140 58 58 # including: this and the previous one test different parts of the code. 59 59 60 run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n")60 run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n") 61 61 62 62 &rmfiles('a','b','c'); 63 63 64 # Ensure command line variables are preserved properly across re-exec 65 # Tests for Savannah bug #30723 66 67 run_make_test(' 68 ifdef RECURSE 69 -include foo30723 70 endif 71 recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test 72 test: ; @echo F.O=$(F.O) 73 foo30723: ; @touch $@ 74 ', 75 '--no-print-directory F.O=bar', "F.O=bar\n"); 76 77 unlink('foo30723'); 78 64 79 # This tells the test driver that the perl test script executed properly. 65 80 1; -
trunk/src/kmk/tests/scripts/features/se_explicit
r2591 r3140 8 8 # bird: Modified this test to use ${PRE} instead of $(PRE) as it failes 9 9 # when make is built with NO_ARCHIVES defined. 10 11 # If we don't support archives then the prerequisite is different 12 my $prereq = exists $FEATURES{'archives'} ? '$' : '$(PRE)'; 10 13 11 14 run_make_test(q! … … 21 24 !, 22 25 '', 23 " \${PRE}\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz");26 "$prereq\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz"); 24 27 25 28 run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz"); … … 118 121 all : $$(eval $$(info test)) 119 122 !, 120 '', "test\n#MAKE#: Nothing to be done for `all'.\n");123 '', "test\n#MAKE#: Nothing to be done for 'all'.\n"); 121 124 122 125 # TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new … … 155 158 156 159 157 # This tells the test driver that the perl test script executed properly. 160 # Allow patsubst shorthand in second expansion context. 161 # Requires the colon to be quoted. Savannah bug #16545 162 run_make_test(q! 163 .PHONY: foo.bar 164 .SECONDEXPANSION: 165 foo: $$(@\\:%=%.bar); @echo '$^' 166 !, 167 '', "foo.bar\n"); 168 158 169 1; -
trunk/src/kmk/tests/scripts/features/se_implicit
r2591 r3140 223 223 '', "\n"); 224 224 225 # Test #10: Test second expansion with second expansion prerequisites 226 # Ensures pattern_search() recurses with SE prereqs. 227 touch('a'); 228 run_make_test(q! 229 .SECONDEXPANSION: 230 sim_base_rgg := just_a_name 231 sim_base_src := a 232 sim_base_f := a a a 233 sim_%.f: $${sim_$$*_f} 234 echo $@ 235 sim_%.src: $${sim_$$*_src} 236 echo $@ 237 sim_%: \ 238 $$(if $$(sim_$$*_src),sim_%.src) \ 239 $$(if $$(sim_$$*_f),sim_%.f) \ 240 $$(if $$(sim_$$*_rgg),$$(sim_$$*_rgg).s) 241 echo $@ 242 !, 243 '-s sim_base', "#MAKE#: *** No rule to make target 'sim_base'. Stop.", 512); 244 245 unlink('a'); 246 247 # Ensure that order-only tokens embedded in second expansions are parsed 248 run_make_test(q! 249 .SECONDEXPANSION: 250 PREREQS=p1|p2 251 P2=p2 252 all : foo bar 253 f%o: $$(PREREQS) ; @echo '$@' from '$^' and '$|' 254 b%r: p1|$$(P2) ; @echo '$@' from '$^' and '$|' 255 p% : ; : $@ 256 !, 257 "", ": p1\n: p2\nfoo from p1 and p2\nbar from p1 and p2\n"); 258 225 259 # This tells the test driver that the perl test script executed properly. 226 260 1; -
trunk/src/kmk/tests/scripts/features/targetvars
r2591 r3140 238 238 run_make_test(undef, 'FOO=C', "C f1\n"); 239 239 240 # TEST #19: Conditional variables with command-line settings 241 242 run_make_test(' 243 a: FOO ?= f1 244 a: ; @echo "$(FOO)" 245 ', 246 '', "f1\n"); 247 248 run_make_test(undef, 'FOO=C', "C\n"); 249 240 250 # TEST #20: Check for continuation after semicolons 241 251 242 252 run_make_test(q! 243 a: A = 'hello; 253 a: A = 'hello;\ 244 254 world' 245 255 a: ; @echo $(A) -
trunk/src/kmk/tests/scripts/features/varnesting
r969 r3140 1 $description = "The following test creates a makefile to ..."; 1 # -*-perl-*- 2 $description = "Test recursive variables"; 2 3 3 4 $details = ""; 4 5 5 open(MAKEFILE,"> $makefile"); 6 run_make_test(' 7 x = variable1 8 variable2 := Hello 9 y = $(subst 1,2,$(x)) 10 z = y 11 a := $($($(z))) 12 all: 13 @echo $(a) 14 ', 15 '', "Hello\n"); 6 16 7 # The Contents of the MAKEFILE ... 17 # This tests resetting the value of a variable while expanding it. 18 # You may only see problems with this if you're using valgrind or 19 # some other memory checker that poisons freed memory. 20 # See Savannah patch #7534 8 21 9 print MAKEFILE "x = variable1\n" 10 ."variable2 := Hello\n" 11 ."y = \$(subst 1,2,\$(x))\n" 12 ."z = y\n" 13 ."a := \$(\$(\$(z)))\n" 14 ."all: \n" 15 ."\t\@echo \$(a)\n"; 16 17 # END of Contents of MAKEFILE 18 19 close(MAKEFILE); 20 21 &run_make_with_options($makefile,"",&get_logfile); 22 23 # Create the answer to what should be produced by this Makefile 24 $answer = "Hello\n"; 25 26 &compare_output($answer,&get_logfile(1)); 22 run_make_test(' 23 VARIABLE = $(eval VARIABLE := echo hi)$(VARIABLE) 24 wololo: 25 @$(VARIABLE) 26 ', 27 '', "hi\n"); 27 28 28 29 1; -
trunk/src/kmk/tests/scripts/features/vpath
r2591 r3140 76 76 vpath-d/fail.te: 77 77 !, 78 '', "#MAKE#: Nothing to be done for `default'.\n");78 '', "#MAKE#: Nothing to be done for 'default'.\n"); 79 79 80 80 rmdir('vpath-d'); -
trunk/src/kmk/tests/scripts/features/vpath3
r2591 r3140 1 # 1 # -*-perl-*- 2 2 3 3 $description = "Test the interaction of the -lfoo feature and vpath"; 4 4 $details = ""; 5 5 6 open(MAKEFILE,"> $makefile"); 6 my @dirs_to_make = qw(a1 b1 a2 b2 b3); 7 for my $d (@dirs_to_make) { 8 mkdir($d, 0777); 9 } 7 10 8 # The Contents of the MAKEFILE ... 9 10 print MAKEFILE "vpath %.a a1\n"; 11 print MAKEFILE "vpath %.so b1\n"; 12 print MAKEFILE "vpath % a2 b2\n"; 13 print MAKEFILE "vpath % b3\n"; 14 print MAKEFILE "all: -l1 -l2 -l3; \@echo \$^\n"; 15 16 # END of Contents of MAKEFILE 17 18 close(MAKEFILE); 19 20 mkdir("a1", 0777); 21 mkdir("b1", 0777); 22 mkdir("a2", 0777); 23 mkdir("b2", 0777); 24 mkdir("b3", 0777); 25 26 @files_to_touch = ("a1${pathsep}lib1.a", 27 "b1${pathsep}lib1.so", 28 "a2${pathsep}lib2.a", 29 "b2${pathsep}lib2.so", 30 "lib3.a", 31 "b3${pathsep}lib3.so"); 32 11 my @files_to_touch = ("a1${pathsep}lib1.a", 12 "a1${pathsep}libc.a", 13 "b1${pathsep}lib1.so", 14 "a2${pathsep}lib2.a", 15 "b2${pathsep}lib2.so", 16 "lib3.a", 17 "b3${pathsep}lib3.so"); 33 18 &touch(@files_to_touch); 34 19 35 &run_make_with_options($makefile,"",&get_logfile); 20 my $answer = "a1${pathsep}lib1.a a1${pathsep}libc.a " . 21 "a2${pathsep}lib2.a lib3.a\n"; 22 if ($port_type eq 'VMS-DCL') { 23 $answer =~ s/ /,/g; 24 } 36 25 37 # Create the answer to what should be produced by this Makefile 38 $answer = "a1${pathsep}lib1.a a2${pathsep}lib2.a lib3.a\n"; 26 run_make_test(' 27 vpath %.h b3 28 vpath %.a a1 29 vpath %.so b1 30 vpath % a2 b2 31 vpath % b3 32 all: -l1 -lc -l2 -l3; @echo $^ 33 ', 34 '', $answer); 39 35 40 if (&compare_output($answer,&get_logfile(1))) 41 { 42 unlink @files_to_touch; 43 rmdir("a1"); 44 rmdir("b1"); 45 rmdir("a2"); 46 rmdir("b2"); 47 rmdir("b3"); 36 unlink(@files_to_touch); 37 for my $d (@dirs_to_make) { 38 rmdir($d); 48 39 } 49 40 -
trunk/src/kmk/tests/scripts/features/vpathgpath
r969 r3140 58 58 push(@touchedfiles, "bar.c"); 59 59 60 $answer = "$make_name: Nothing to be done for `general'.\n";60 $answer = "$make_name: Nothing to be done for 'general'.\n"; 61 61 62 62 &compare_output($answer,&get_logfile(1)); -
trunk/src/kmk/tests/scripts/features/vpathplus
r969 r3140 87 87 $answer = "not creating notarget.c from notarget.d 88 88 cat notarget.c > notarget.b 2>/dev/null || exit 1 89 $make_name: *** [ notarget.b] Error 189 $make_name: *** [$makefile:16: notarget.b] Error 1 90 90 "; 91 91 … … 127 127 128 128 1; 129 130 ### Local Variables: 131 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 132 ### End: -
trunk/src/kmk/tests/scripts/functions/call
r969 r3140 5 5 results.\n"; 6 6 7 open(MAKEFILE, "> $makefile"); 8 9 # The Contents of the MAKEFILE ... 10 11 print MAKEFILE <<'EOMAKE'; 7 run_make_test(q! 12 8 # Simple, just reverse two things 13 9 # 14 10 reverse = $2 $1 15 11 16 # A complex `map' function, using recursive `call'.12 # A complex 'map' function, using recursive 'call'. 17 13 # 18 14 map = $(foreach a,$2,$(call $1,$a)) … … 39 35 DEP_baz = quux blarp 40 36 rest = $(wordlist 2,$(words ${1}),${1}) 41 tclose = $(if $1,$(firstword $1) 37 tclose = $(if $1,$(firstword $1)\ 42 38 $(call tclose,$(sort ${DEP_$(firstword $1)} $(call rest,$1)))) 43 39 … … 49 45 echo '$(call my-if,a,b,c)'; \ 50 46 echo '$(call two,bar,baz)'; \ 51 echo '$(call tclose,foo)' 47 echo '$(call tclose,foo)'; 48 !, 49 "", "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\nfoo bar baz blarp quux \n"); 52 50 53 54 55 EOMAKE 56 57 # These won't work until/unless PR/1527 is resolved. 58 # echo '$(call my-foreach,a,x y z,$(a)$(a))'; \ 59 # echo '$(call my-if,,$(warning don't print this),ok)' 51 # These won't work because call expands all its arguments first, before 52 # passing them on, then marks them as resolved/simple, so they're not 53 # expanded again by the function. 60 54 # 61 # $answer = "xx yy zz\nok\n"; 62 63 # END of Contents of MAKEFILE 64 65 close(MAKEFILE); 66 67 &run_make_with_options($makefile, "", &get_logfile); 68 $answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\nfoo bar baz blarp quux \n"; 69 &compare_output($answer, &get_logfile(1)); 70 55 # echo '$(call my-foreach,a,x y z,$$(a)$$(a))'; \ 56 # echo '$(call my-if,,$$(info don't print this),$$(info do print this))' 57 # 58 # $answer = "xx yy zz\ndo print this\n"; 71 59 72 60 # TEST eclipsing of arguments when invoking sub-calls 73 61 74 $makefile2 = &get_tmpfile; 75 76 open(MAKEFILE,"> $makefile2"); 77 78 print MAKEFILE <<'EOF'; 79 62 run_make_test(q! 80 63 all = $1 $2 $3 $4 $5 $6 $7 $8 $9 81 64 … … 89 72 @echo $(call level2,1,2,3,4,5,6,7,8) 90 73 @echo $(call level3,1,2,3,4,5,6,7,8) 91 EOF 74 !, 75 "", "1 2 3 4 5 6 7 8 9\n1 2 3 4 5\n1 2 3\n1 2 3\n"); 92 76 93 close(MAKEFILE); 77 # Ensure that variables are defined in global scope even in a $(call ...) 94 78 95 &run_make_with_options($makefile2, "", &get_logfile); 96 $answer = "1 2 3 4 5 6 7 8 9\n1 2 3 4 5\n1 2 3\n1 2 3\n"; 97 &compare_output($answer,&get_logfile(1)); 79 delete $ENV{X123}; 80 81 run_make_test(' 82 tst = $(eval export X123) 83 $(call tst) 84 all: ; @echo "$${X123-not set}" 85 ', 86 '', "\n"); 98 87 99 88 1; 89 90 ### Local Variables: 91 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 92 ### End: -
trunk/src/kmk/tests/scripts/functions/error
r969 r3140 55 55 56 56 &run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512); 57 $answer = "Some stuff\n$makefile:1 6: *** error is definitely. Stop.\n";57 $answer = "Some stuff\n$makefile:17: *** error is definitely. Stop.\n"; 58 58 &compare_output($answer,&get_logfile(1)); 59 59 … … 67 67 1; 68 68 69 70 71 72 73 69 ### Local Variables: 70 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 71 ### End: -
trunk/src/kmk/tests/scripts/functions/filter-out
r969 r3140 1 1 # -*-perl-*- 2 2 3 $description = "Test the filter -out function.";3 $description = "Test the filter and filter-out functions."; 4 4 5 5 $details = "The makefile created in this test has two variables. The … … 12 12 functions is the same single .elc name.\n"; 13 13 14 open(MAKEFILE,"> $makefile"); 14 # Basic test -- filter 15 run_make_test(q! 16 files1 := $(filter %.o, foo.elc bar.o lose.o) 17 files2 := $(filter %.o foo.i, foo.i bar.i lose.i foo.elc bar.o lose.o) 18 all: ; @echo '$(files1) $(files2)' 19 !, 20 '', "bar.o lose.o foo.i bar.o lose.o\n"); 15 21 16 print MAKEFILE <<'EOF'; 22 # Basic test -- filter-out 23 run_make_test(q! 17 24 files1 := $(filter-out %.o, foo.elc bar.o lose.o) 18 25 files2 := $(filter-out foo.i bar.i lose.i %.o, foo.i bar.i lose.i foo.elc bar.o lose.o) 19 all: ; @echo $(files1) $(files2) 20 EOF 26 all: ; @echo '$(files1) $(files2)' 27 !, 28 '', "foo.elc foo.elc\n"); 21 29 22 close(MAKEFILE); 30 # Escaped patterns 31 run_make_test(q!all:;@echo '$(filter foo\%bar,foo%bar fooXbar)'!, 32 '', "foo%bar\n"); 23 33 24 &run_make_with_options($makefile, "", &get_logfile, 0); 25 $answer = "foo.elc foo.elc\n"; 26 &compare_output($answer,&get_logfile(1)); 34 run_make_test(q!all:;@echo '$(filter foo\%\%\\\\\%\%bar,foo%%\\%%bar fooX\\Ybar)'!, 35 '', "foo%%\\%%bar\n"); 36 37 run_make_test(q! 38 X = $(filter foo\\\\\%bar,foo\%bar foo\Xbar) 39 all:;@echo '$(X)'!, 40 '', "foo\\%bar\n"); 27 41 28 42 1; -
trunk/src/kmk/tests/scripts/functions/foreach
r2175 r3140 1 1 # -*-perl-*- 2 # $Id : foreach,v 1.5 2006/03/10 02:20:46 psmith Exp$2 # $Id$ 3 3 4 4 $description = "Test the foreach function."; … … 56 56 'FOREACH'); 57 57 58 # Allow variable names with trailing space 59 run_make_test(q! 60 $(foreach \ 61 a \ 62 , b c d \ 63 , $(info $a)) 64 all:;@: 65 !, 66 "", "b\nc\nd\n"); 58 67 59 # TEST 2: Check some error conditions. 68 # Allow empty variable names. We still expand the body. 69 70 run_make_test(' 71 x = $(foreach ,1 2 3,a) 72 y := $x 73 74 all: ; @echo $y', 75 '', "a a a\n"); 76 77 # Check some error conditions. 60 78 61 79 run_make_test(' … … 65 83 all: ; @echo $y', 66 84 '', 67 "#MAKEFILE#:2: *** insufficient number of arguments (1) to function `foreach'. Stop.",85 "#MAKEFILE#:2: *** insufficient number of arguments (1) to function 'foreach'. Stop.", 68 86 512); 69 87 70 88 run_make_test(' 71 x = $(foreach )89 x = $(foreach x,y) 72 90 y := $x 73 91 74 92 all: ; @echo $y', 75 93 '', 76 "#MAKEFILE#:2: *** insufficient number of arguments ( 1) to function `foreach'. Stop.",94 "#MAKEFILE#:2: *** insufficient number of arguments (2) to function 'foreach'. Stop.", 77 95 512); 78 96 -
trunk/src/kmk/tests/scripts/functions/shell
r2591 r3140 5 5 $details = ''; 6 6 7 # Test standard shell 8 run_make_test('.PHONY: all 9 OUT := $(shell echo hi) 10 all: ; @echo $(OUT) 11 ','','hi'); 7 12 8 13 # Test shells inside rules. 9 14 run_make_test('.PHONY: all 10 15 all: ; @echo $(shell echo hi) 11 ','','hi'); 16 ','','hi'); 17 18 # Verify .SHELLSTATUS 19 run_make_test('.PHONY: all 20 PRE := $(.SHELLSTATUS) 21 $(shell exit 0) 22 OK := $(.SHELLSTATUS) 23 $(shell exit 1) 24 BAD := $(.SHELLSTATUS) 25 all: ; @echo PRE=$(PRE) OK=$(OK) BAD=$(BAD) 26 ','','PRE= OK=0 BAD=1'); 12 27 13 28 … … 28 43 .PHONY: all 29 44 all: ; @echo $$HI 30 ','','hi'); 45 ','','hi'); 46 47 # Test shell errors in recipes including offset 48 run_make_test(' 49 all: 50 @echo hi 51 $(shell ./basdfdfsed there) 52 @echo there 53 ', 54 '', "#MAKE#: ./basdfdfsed: Command not found\nhi\nthere\n"); 31 55 32 56 1; 57 58 ### Local Variables: 59 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 60 ### End: -
trunk/src/kmk/tests/scripts/functions/sort
r969 r3140 1 $description = "The following test creates a makefile to verify\n" 2 ."the ability of make to sort lists of object. Sort\n" 3 ."will also remove any duplicate entries. This will also\n" 4 ."be tested."; 1 # -*-perl-*- 5 2 6 $details = "The make file is built with a list of object in a random order\n" 7 ."and includes some duplicates. Make should sort all of the elements\n" 8 ."remove all duplicates\n"; 3 $description = "The following test creates a makefile to verify 4 the ability of make to sort lists of object. Sort 5 will also remove any duplicate entries. This will also 6 be tested."; 9 7 10 open(MAKEFILE,"> $makefile"); 8 $details = "The make file is built with a list of object in a random order 9 and includes some duplicates. Make should sort all of the elements 10 remove all duplicates\n"; 11 11 12 # The Contents of the MAKEFILE ... 13 14 print MAKEFILE "foo := moon_light days \n" 15 ."foo1:= jazz\n" 16 ."bar := captured \n" 17 ."bar2 = boy end, has rise A midnight \n" 18 ."bar3:= \$(foo)\n" 19 ."s1 := _by\n" 20 ."s2 := _and_a\n" 21 ."t1 := \$(addsuffix \$(s1), \$(bar) )\n" 22 ."t2 := \$(addsuffix \$(s2), \$(foo1) )\n" 23 ."t3 := \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \n" 24 ."t4 := \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \n" 25 ."t5 := \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \n" 26 ."t6 := \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \n" 27 ."t7 := \$(t6) \$(t6) \$(t6) \n" 28 ."p1 := \$(addprefix \$(foo1), \$(s2) )\n" 29 ."blank:= \n" 30 ."all:\n" 31 ."\t\@echo \$(sort \$(bar2) \$(foo) \$(addsuffix \$(s1), \$(bar) ) \$(t2) \$(bar2) \$(bar3))\n" 32 ."\t\@echo \$(sort \$(blank) \$(foo) \$(bar2) \$(t1) \$(p1) )\n" 33 ."\t\@echo \$(sort \$(foo) \$(bar2) \$(t1) \$(t4) \$(t5) \$(t7) \$(t6) )\n"; 12 run_make_test(' 13 foo := moon_light days 14 foo1:= jazz 15 bar := captured 16 bar2 = boy end, has rise A midnight 17 bar3:= $(foo) 18 s1 := _by 19 s2 := _and_a 20 t1 := $(addsuffix $(s1), $(bar) ) 21 t2 := $(addsuffix $(s2), $(foo1) ) 22 t3 := $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) 23 t4 := $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) 24 t5 := $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) 25 t6 := $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) 26 t7 := $(t6) $(t6) $(t6) 27 p1 := $(addprefix $(foo1), $(s2) ) 28 blank:= 29 all: 30 @echo $(sort $(bar2) $(foo) $(addsuffix $(s1), $(bar) ) $(t2) $(bar2) $(bar3)) 31 @echo $(sort $(blank) $(foo) $(bar2) $(t1) $(p1) ) 32 @echo $(sort $(foo) $(bar2) $(t1) $(t4) $(t5) $(t7) $(t6) ) 33 ', 34 '', 'A boy captured_by days end, has jazz_and_a midnight moon_light rise 35 A boy captured_by days end, has jazz_and_a midnight moon_light rise 36 A boy captured_by days end, has jazz_and_a midnight moon_light rise 37 '); 34 38 35 39 36 # END of Contents of MAKEFILE 40 # Test with non-space/tab whitespace. Note that you can't see the 41 # original bug except using valgrind. 37 42 38 close(MAKEFILE); 39 40 &run_make_with_options($makefile,"",&get_logfile); 41 42 # Create the answer to what should be produced by this Makefile 43 $answer = "A boy captured_by days end, has jazz_and_a midnight moon_light rise\n" 44 ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n" 45 ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"; 46 47 &compare_output($answer,&get_logfile(1)); 43 run_make_test("FOO = a b\tc\rd\fe \f \f \f \f \ff 44 all: ; \@echo \$(words \$(sort \$(FOO)))\n", 45 '', "6\n"); 48 46 49 47 1; 50 48 51 52 53 54 55 49 ### Local Variables: 50 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 51 ### End: -
trunk/src/kmk/tests/scripts/functions/warning
r969 r3140 53 53 54 54 &run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0); 55 $answer = "Some stuff\n$makefile:1 4: warning is definitely\nhi\nthere\n";55 $answer = "Some stuff\n$makefile:15: warning is definitely\nhi\nthere\n"; 56 56 &compare_output($answer,&get_logfile(1)); 57 58 # Test linenumber offset 59 60 run_make_test(q! 61 all: one two 62 $(warning in $@ line 3) 63 @true 64 $(warning in $@ line 5) 65 66 one two: 67 $(warning in $@ line 8) 68 @true 69 $(warning in $@ line 10) 70 !, 71 '', "#MAKEFILE#:8: in one line 8 72 #MAKEFILE#:10: in one line 10 73 #MAKEFILE#:8: in two line 8 74 #MAKEFILE#:10: in two line 10 75 #MAKEFILE#:3: in all line 3 76 #MAKEFILE#:5: in all line 5\n"); 57 77 58 78 # This tells the test driver that the perl test script executed properly. 59 79 1; 60 80 61 62 63 64 65 81 ### Local Variables: 82 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 83 ### End: -
trunk/src/kmk/tests/scripts/functions/wildcard
r2591 r3140 89 89 '', "\n"); 90 90 91 # TEST #5: wildcard used to verify file existence 92 93 touch('xxx.yyy'); 94 95 run_make_test(q!exists: ; @echo file=$(wildcard xxx.yyy)!, 96 '', "file=xxx.yyy\n"); 97 98 unlink('xxx.yyy'); 99 100 run_make_test(q!exists: ; @echo file=$(wildcard xxx.yyy)!, 101 '', "file=\n"); 102 91 103 1; -
trunk/src/kmk/tests/scripts/functions/word
r969 r3140 57 57 wordlist-e3: ; @echo $(wordlist 1, 12a ,$(FOO))', 58 58 'word-e1', 59 "#MAKEFILE#:3: *** non-numeric first argument to `word' function: ''. Stop.",59 "#MAKEFILE#:3: *** non-numeric first argument to 'word' function: ''. Stop.", 60 60 512); 61 61 62 62 run_make_test(undef, 63 63 'word-e2', 64 "#MAKEFILE#:4: *** non-numeric first argument to `word' function: 'abc '. Stop.",64 "#MAKEFILE#:4: *** non-numeric first argument to 'word' function: 'abc '. Stop.", 65 65 512); 66 66 67 67 run_make_test(undef, 68 68 'word-e3', 69 "#MAKEFILE#:5: *** non-numeric first argument to `word' function: '1a'. Stop.",69 "#MAKEFILE#:5: *** non-numeric first argument to 'word' function: '1a'. Stop.", 70 70 512); 71 71 72 72 run_make_test(undef, 73 73 'wordlist-e1', 74 "#MAKEFILE#:7: *** non-numeric first argument to `wordlist' function: ''. Stop.",74 "#MAKEFILE#:7: *** non-numeric first argument to 'wordlist' function: ''. Stop.", 75 75 512); 76 76 77 77 run_make_test(undef, 78 78 'wordlist-e2', 79 "#MAKEFILE#:8: *** non-numeric first argument to `wordlist' function: 'abc '. Stop.",79 "#MAKEFILE#:8: *** non-numeric first argument to 'wordlist' function: 'abc '. Stop.", 80 80 512); 81 81 82 82 run_make_test(undef, 83 83 'wordlist-e3', 84 "#MAKEFILE#:9: *** non-numeric second argument to `wordlist' function: ' 12a '. Stop.",84 "#MAKEFILE#:9: *** non-numeric second argument to 'wordlist' function: ' 12a '. Stop.", 85 85 512); 86 86 … … 95 95 wordlist-e: ; @echo $(WL)', 96 96 'word-e x=', 97 "#MAKEFILE#:3: *** non-numeric first argument to `word' function: ''. Stop.",97 "#MAKEFILE#:3: *** non-numeric first argument to 'word' function: ''. Stop.", 98 98 512); 99 99 100 100 run_make_test(undef, 101 101 'word-e x=abc', 102 "#MAKEFILE#:3: *** non-numeric first argument to `word' function: 'abc'. Stop.",102 "#MAKEFILE#:3: *** non-numeric first argument to 'word' function: 'abc'. Stop.", 103 103 512); 104 104 105 105 run_make_test(undef, 106 106 'word-e x=0', 107 "#MAKEFILE#:3: *** first argument to `word' function must be greater than 0. Stop.",107 "#MAKEFILE#:3: *** first argument to 'word' function must be greater than 0. Stop.", 108 108 512); 109 109 110 110 run_make_test(undef, 111 111 'wordlist-e s= e=', 112 "#MAKEFILE#:4: *** non-numeric first argument to `wordlist' function: ''. Stop.",112 "#MAKEFILE#:4: *** non-numeric first argument to 'wordlist' function: ''. Stop.", 113 113 512); 114 114 115 115 run_make_test(undef, 116 116 'wordlist-e s=abc e=', 117 "#MAKEFILE#:4: *** non-numeric first argument to `wordlist' function: 'abc'. Stop.",117 "#MAKEFILE#:4: *** non-numeric first argument to 'wordlist' function: 'abc'. Stop.", 118 118 512); 119 119 120 120 run_make_test(undef, 121 121 'wordlist-e s=4 e=12a', 122 "#MAKEFILE#:4: *** non-numeric second argument to `wordlist' function: '12a'. Stop.",122 "#MAKEFILE#:4: *** non-numeric second argument to 'wordlist' function: '12a'. Stop.", 123 123 512); 124 124 125 125 run_make_test(undef, 126 126 'wordlist-e s=0 e=12', 127 "#MAKEFILE#:4: *** invalid first argument to `wordlist' function: `0'. Stop.",127 "#MAKEFILE#:4: *** invalid first argument to 'wordlist' function: '0'. Stop.", 128 128 512); 129 129 -
trunk/src/kmk/tests/scripts/misc/general3
r969 r3140 27 27 28 28 \$(STR) \$(TAB)", 29 '', "#MAKE#: Nothing to be done for `all'.");29 '', "#MAKE#: Nothing to be done for 'all'."); 30 30 31 31 # TEST 2 … … 311 311 foo bar'); 312 312 313 run_make_test('x:;@-exit 1', '', "#MAKE#: [#MAKEFILE#:1: x] Error 1 (ignored)\n"); 314 313 315 1; -
trunk/src/kmk/tests/scripts/options/dash-B
r2591 r3140 23 23 '', 'cp bar.x foo'); 24 24 25 run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'.");25 run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'."); 26 26 run_make_test(undef, '-B', 'cp bar.x foo'); 27 27 … … 29 29 30 30 utouch(1000, 'foo'); 31 run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'.");31 run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'."); 32 32 run_make_test(undef, '-B', 'cp bar.x foo'); 33 33 … … 46 46 ', 47 47 '-B', 'MAKE_RESTARTS= 48 #MAKEFILE#:4: foo.x: No such file or directory49 48 MAKE_RESTARTS=1'); 50 49 … … 64 63 ', 65 64 '-B', 'MAKE_RESTARTS= 66 #MAKEFILE#:4: foo.x: No such file or directory67 65 MAKE_RESTARTS=1 68 66 blah.x … … 84 82 85 83 1; 84 85 ### Local Variables: 86 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 87 ### End: -
trunk/src/kmk/tests/scripts/options/dash-C
r969 r3140 35 35 36 36 # Create the answer to what should be produced by this Makefile 37 $answer = "$make_name: Entering directory `$wpath'\n"37 $answer = "$make_name: Entering directory '$wpath'\n" 38 38 . "$delete_command EXAMPLE\n" 39 . "$make_name: Leaving directory `$wpath'\n";39 . "$make_name: Leaving directory '$wpath'\n"; 40 40 41 41 &compare_output($answer,&get_logfile(1)); … … 63 63 64 64 # Create the answer to what should be produced by this Makefile 65 $answer = "$make_name: Entering directory `$wpath'\n"65 $answer = "$make_name: Entering directory '$wpath'\n" 66 66 . "$delete_command EXAMPLEslash\n" 67 . "$make_name: Leaving directory `$wpath'\n";67 . "$make_name: Leaving directory '$wpath'\n"; 68 68 69 69 &compare_output($answer,&get_logfile(1)); -
trunk/src/kmk/tests/scripts/options/dash-I
r969 r3140 52 52 53 53 $answer = "$mkpath ANOTHER -f $makefile 54 ${make_name}[1]: Entering directory `$pwd'54 ${make_name}[1]: Entering directory '$pwd' 55 55 This is another included makefile 56 ${make_name}[1]: Leaving directory `$pwd'\n";56 ${make_name}[1]: Leaving directory '$pwd'\n"; 57 57 58 58 &run_make_with_options($makefile,"-I $workdir recurse",&get_logfile); -
trunk/src/kmk/tests/scripts/options/dash-W
r969 r3140 13 13 # Run it again: nothing should happen 14 14 15 run_make_test(undef, '', "#MAKE#: `a.x' is up to date.");15 run_make_test(undef, '', "#MAKE#: 'a.x' is up to date."); 16 16 17 17 # Now run it with -W b.x: should rebuild a.x … … 22 22 23 23 utouch(1000, 'a.x'); 24 run_make_test(undef, '', "#MAKE#: `a.x' is up to date.");24 run_make_test(undef, '', "#MAKE#: 'a.x' is up to date."); 25 25 run_make_test(undef, '-W b.x', 'echo >> a.x'); 26 26 … … 43 43 baz.x: bar.x ; @echo "touch $@" 44 44 ', 45 '', '#MAKEFILE#:3: foo.x: No such file or directory 46 echo >> bar.x 45 '', 'echo >> bar.x 47 46 touch foo.x 48 47 restarts=1 … … 87 86 88 87 1; 88 89 ### Local Variables: 90 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 91 ### End: -
trunk/src/kmk/tests/scripts/options/dash-k
r1964 r3140 43 43 "$workdir${pathsep}commands.c","$workdir${pathsep}display.c", 44 44 "$workdir${pathsep}buffer.h", 45 45 "$workdir${pathsep}command.c"); 46 46 47 47 &touch(@files_to_touch); … … 58 58 # Create the answer to what should be produced by this Makefile 59 59 $answer = "cc -c main.c 60 $make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.60 $make_name: *** No rule to make target 'kbd.c', needed by 'kbd.o'. 61 61 cc -c commands.c 62 62 cc -c display.c 63 $make_name: Target `edit' not remade because of errors.\n";63 $make_name: Target 'edit' not remade because of errors.\n"; 64 64 65 65 # COMPARE RESULTS … … 93 93 94 94 $answer = "exit 1 95 $make_name: *** [ foo.o] Error 196 $make_name: Target `all' not remade because of errors.\n";95 $make_name: *** [$makefile2:9: foo.o] Error 1 96 $make_name: Target 'all' not remade because of errors.\n"; 97 97 98 98 &compare_output($answer, &get_logfile(1)); … … 107 107 '-k', 108 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'.109 #MAKE#: *** No rule to make target 'no-such-file', needed by 'ifile'. 110 #MAKE#: Failed to remake makefile 'ifile'. 111 111 hi\n", 112 112 512); -
trunk/src/kmk/tests/scripts/options/dash-n
r969 r3140 4 4 $details = "Try various uses of -n and ensure they all give the correct results.\n"; 5 5 6 open(MAKEFILE, "> $makefile");6 touch('orig'); 7 7 8 # The Contents of the MAKEFILE ... 9 10 print MAKEFILE <<'EOMAKE'; 11 8 run_make_test(q! 12 9 final: intermediate ; echo >> $@ 13 10 intermediate: orig ; echo >> $@ 14 15 EOMAKE 16 17 close(MAKEFILE); 18 19 &touch('orig'); 20 21 # TEST 0 22 23 &run_make_with_options($makefile, "", &get_logfile); 24 $answer = "echo >> intermediate\necho >> final\n"; 25 &compare_output($answer, &get_logfile(1)); 11 !, 12 '', "echo >> intermediate\necho >> final\n"); 26 13 27 14 # TEST 1 28 15 29 &run_make_with_options($makefile, "-Worig -n", &get_logfile); 30 $answer = "echo >> intermediate\necho >> final\n"; 31 &compare_output($answer, &get_logfile(1)); 16 run_make_test(undef, '-Worig -n', "echo >> intermediate\necho >> final\n"); 32 17 33 unlink('orig', 'intermediate', 'final');18 rmfiles(qw(orig intermediate final)); 34 19 35 20 # We consider the actual updated timestamp of targets with all 36 # recursive commands, even with -n. 21 # recursive commands, even with -n. Switching this to the new model 22 # is non-trivial because we use a trick below to change the log content 23 # before we compare it ... 37 24 38 25 $makefile2 = &get_tmpfile; … … 57 44 58 45 &run_make_with_options($makefile2, "", &get_logfile); 59 $answer = "$make_name: `a' is up to date.\n";46 $answer = "$make_name: 'a' is up to date.\n"; 60 47 &compare_output($answer, &get_logfile(1)); 61 48 … … 63 50 64 51 &run_make_with_options($makefile2, "-n", &get_logfile); 65 $answer = "$make_name: `a' is up to date.\n";52 $answer = "$make_name: 'a' is up to date.\n"; 66 53 &compare_output($answer, &get_logfile(1)); 67 54 68 unlink('a', 'b', 'c'); 55 # TEST 4 56 57 unlink(qw(a b)); 58 59 &run_make_with_options($makefile2, "-t -n", &get_logfile); 60 61 open(DASH_N_LOG, ">>" . &get_logfile(1)); 62 print DASH_N_LOG "a exists but should not!\n" if -e 'a'; 63 print DASH_N_LOG "b exists but should not!\n" if -e 'b'; 64 close(DASH_N_LOG); 65 66 &compare_output("touch b\ntouch a\n", &get_logfile(1)); 67 68 # CLEANUP 69 70 unlink(qw(a b c)); 71 72 # Ensure -n continues to be included with recursive/re-execed make 73 # See Savannah bug #38051 74 75 $topmake = &get_tmpfile; 76 $submake = &get_tmpfile; 77 78 open(MAKEFILE, "> $topmake"); 79 print MAKEFILE <<"EOF"; 80 foo: ; \@\$(MAKE) -f "$submake" bar 81 EOF 82 close(MAKEFILE); 83 84 85 # The bar target should print what would happen, but not actually run 86 open(MAKEFILE, "> $submake"); 87 print MAKEFILE <<'EOF'; 88 inc: ; touch $@ 89 -include inc 90 bar: ; @echo $(strip $(MAKEFLAGS)) 91 EOF 92 close(MAKEFILE); 93 94 &run_make_with_options($topmake, '-n --no-print-directory', &get_logfile); 95 $answer = "$make_command -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n"; 96 &compare_output($answer, &get_logfile(1)); 97 98 unlink('inc'); 69 99 70 100 1; -
trunk/src/kmk/tests/scripts/options/dash-q
r969 r3140 6 6 # TEST 0 7 7 8 run_make_test( '8 run_make_test(qq! 9 9 one: 10 10 two: ; 11 11 three: ; : 12 four: ; $(.XY)13 five: ; \ 14 $(.XY)15 six: ; \ 16 $(.XY)17 18 seven: ; \ 19 $(.XY)20 21 22 ',12 four: ; \$(.XY) 13 five: ; \\ 14 \$(.XY) 15 six: ; \\ 16 \$(.XY) 17 \t\$(.XY) 18 seven: ; \\ 19 \$(.XY) 20 \t: foo 21 \t\$(.XY) 22 !, 23 23 '-q one', ''); 24 24 … … 55 55 '-q', '', 256); 56 56 57 # TEST 7 : Savannah bug # 42249 58 # Make sure we exit with 1 even for prerequisite updates 59 run_make_test(' 60 build-stamp: ; echo $@ 61 build-arch: build-stamp 62 build-x: build-arch 63 build-y: build-x 64 ', 65 '-q build-y', '', 256); 66 67 # TEST 8 68 # Make sure we exit with 2 on error even with -q 69 run_make_test(' 70 build-stamp: ; echo $@ 71 build-arch: build-stamp-2 72 build-x: build-arch 73 build-y: build-x 74 ', 75 '-q build-y', "#MAKE#: *** No rule to make target 'build-stamp-2', needed by 'build-arch'. Stop.\n", 512); 76 77 # TEST 9 : Savannah bug # 47151 78 # Make sure we exit with 1 when invoking a recursive make 79 run_make_test(' 80 foo: bar ; echo foo 81 bar: ; @$(MAKE) -f #MAKEFILE# baz 82 baz: ; echo baz 83 ', 84 '-q foo', '', 256); 85 57 86 1; -
trunk/src/kmk/tests/scripts/options/eval
r2591 r3140 17 17 "eval\neval\nall\nrecurse"); 18 18 19 # Make sure that --eval is handled correctly during restarting 20 run_make_test(q! 21 all: ; @echo $@ 22 -include gen.mk 23 gen.mk: ; @echo > $@ 24 !, 25 '--eval=\$\(info\ eval\)', "eval\neval\nall"); 26 27 unlink('gen.mk'); 28 19 29 1; -
trunk/src/kmk/tests/scripts/options/symlinks
r2591 r3140 27 27 # With -L, it should update targ 28 28 run_make_test('targ: sym ; @echo make $@ from $<', '', 29 "#MAKE#: `targ' is up to date.");29 "#MAKE#: 'targ' is up to date."); 30 30 run_make_test(undef, '-L', "make targ from sym"); 31 31 … … 37 37 # Now update targ; in all cases targ should be up to date. 38 38 &touch('targ'); 39 run_make_test(undef, '', "#MAKE#: `targ' is up to date.");40 run_make_test(undef, '-L', "#MAKE#: `targ' is up to date.");39 run_make_test(undef, '', "#MAKE#: 'targ' is up to date."); 40 run_make_test(undef, '-L', "#MAKE#: 'targ' is up to date."); 41 41 42 42 # Add in a new link between sym and dep. Be sure it's newer than targ. … … 47 47 # Without -L, nothing should happen 48 48 # With -L, it should update targ 49 run_make_test(undef, '', "#MAKE#: `targ' is up to date.");49 run_make_test(undef, '', "#MAKE#: 'targ' is up to date."); 50 50 run_make_test(undef, '-L', "make targ from sym"); 51 51 … … 57 57 symlink("../$dirname/dep", 'sym'); 58 58 run_make_test('targ: sym ; @echo make $@ from $<', '', 59 "#MAKE#: *** No rule to make target `sym', needed by `targ'. Stop.", 512);59 "#MAKE#: *** No rule to make target 'sym', needed by 'targ'. Stop.", 512); 60 60 61 61 run_make_test('targ: sym ; @echo make $@ from $<', '-L', -
trunk/src/kmk/tests/scripts/options/warn-undefined-variables
r969 r3140 19 19 # With --warn-undefined-variables, it should warn me 20 20 run_make_test(undef, '--warn-undefined-variables', 21 "#MAKEFILE#:7: warning: undefined variable `UNDEFINED'22 #MAKEFILE#:9: warning: undefined variable `UNDEFINED'21 "#MAKEFILE#:7: warning: undefined variable 'UNDEFINED' 22 #MAKEFILE#:9: warning: undefined variable 'UNDEFINED' 23 23 ref"); 24 24 -
trunk/src/kmk/tests/scripts/targets/DEFAULT
r969 r3140 36 36 37 37 # Create the answer to what should be produced by this Makefile 38 $answer = "${make_name}[1]: Entering directory `$pwd'\n"38 $answer = "${make_name}[1]: Entering directory '$pwd'\n" 39 39 . "Executing rule BAR\n" 40 . "${make_name}[1]: Leaving directory `$pwd'\n";40 . "${make_name}[1]: Leaving directory '$pwd'\n"; 41 41 42 42 # COMPARE RESULTS -
trunk/src/kmk/tests/scripts/targets/INTERMEDIATE
r1994 r3140 43 43 44 44 &run_make_with_options($makefile,'foo.d',&get_logfile); 45 $answer = "$make_name: `foo.d' is up to date.\n";45 $answer = "$make_name: 'foo.d' is up to date.\n"; 46 46 &compare_output($answer, &get_logfile(1)); 47 47 … … 66 66 67 67 &run_make_with_options($makefile,'foo.c',&get_logfile); 68 $answer = "$make_name: `foo.c' is up to date.\n";68 $answer = "$make_name: 'foo.c' is up to date.\n"; 69 69 &compare_output($answer, &get_logfile(1)); 70 70 -
trunk/src/kmk/tests/scripts/targets/ONESHELL
r2591 r3140 5 5 $details = ""; 6 6 7 # Some shells (*shakes fist at Solaris*) cannot handle multiple flags in 8 # separate arguments. 9 my $t = `/bin/sh -e -c true 2>/dev/null`; 10 my $multi_ok = $? == 0; 7 11 8 12 # Simple … … 17 21 [ 0"$a" -eq "$$" ] || echo fail 18 22 '); 23 24 # Simple but use multi-word SHELLFLAGS 25 26 if ($multi_ok) { 27 run_make_test(q! 28 .ONESHELL: 29 .SHELLFLAGS = -e -c 30 all: 31 a=$$$$ 32 [ 0"$$a" -eq "$$$$" ] || echo fail 33 !, 34 '', 'a=$$ 35 [ 0"$a" -eq "$$" ] || echo fail 36 '); 37 } 19 38 20 39 # Again, but this time with inner prefix chars -
trunk/src/kmk/tests/scripts/targets/POSIX
r2591 r3140 1 1 # -*-perl-*- 2 2 3 $description = "Test the behaviour of the .P HONYtarget.";3 $description = "Test the behaviour of the .POSIX target."; 4 4 5 5 $details = ""; … … 18 18 all: ; \@$script 19 19 !, 20 '', "#MAKE#: *** [ all] Error $err\n", 512);20 '', "#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512); 21 21 22 22 # User settings must override .POSIX … … 30 30 '', $out); 31 31 32 # Test the default value of various POSIX-specific variables 33 my %POSIX = (AR => 'ar', ARFLAGS => '-rv', 34 YACC => 'yacc', YFLAGS => '', 35 LEX => 'lex', LFLAGS => '', 36 LDFLAGS => '', 37 CC => 'c99', CFLAGS => '-O', 38 FC => 'fort77', FFLAGS => '-O 1', 39 GET => 'get', GFLAGS => '', 40 SCCSFLAGS => '', SCCSGETFLAGS => '-s'); 41 my $make = join('', map { "\t\@echo '$_=\$($_)'\n" } sort keys %POSIX); 42 my $r = join('', map { "$_=$POSIX{$_}\n"} sort keys %POSIX); 43 run_make_test(qq! 44 .POSIX: 45 all: 46 $make 47 !, 48 '', $r); 49 50 # Make sure that local settings take precedence 51 %extraENV = map { $_ => "xx-$_" } keys %POSIX; 52 $r = join('', map { "$_=xx-$_\n"} sort keys %POSIX); 53 run_make_test(undef, '', $r); 54 32 55 # This tells the test driver that the perl test script executed properly. 33 56 1; -
trunk/src/kmk/tests/scripts/targets/SECONDARY
r1994 r3140 45 45 46 46 &run_make_with_options($makefile,'foo.d',&get_logfile); 47 $answer = "$make_name: `foo.d' is up to date.\n";47 $answer = "$make_name: 'foo.d' is up to date.\n"; 48 48 &compare_output($answer, &get_logfile(1)); 49 49 … … 68 68 69 69 &run_make_with_options($makefile,'foo.c',&get_logfile); 70 $answer = "$make_name: `foo.c' is up to date.\n";70 $answer = "$make_name: 'foo.c' is up to date.\n"; 71 71 &compare_output($answer, &get_logfile(1)); 72 72 … … 104 104 105 105 &run_make_with_options($makefile2, '', &get_logfile); 106 $answer = "$make_name: `final' is up to date.\n";106 $answer = "$make_name: 'final' is up to date.\n"; 107 107 &compare_output($answer, &get_logfile(1)); 108 108 … … 130 130 %.c : %.b ; cp $< $@ 131 131 %.b : %.a ; cp $< $@ 132 all : 1.c 2.c', '-rR -j', 132 all : 1.c 2.c 133 2.a: 1.c', '-rR -j', 133 134 'cp 1.a 1.b 135 cp 1.b 1.c 134 136 cp 2.a 2.b 135 cp 1.b 1.c136 137 cp 2.b 2.c 137 138 rm 1.b 2.b'); -
trunk/src/kmk/tests/scripts/variables/DEFAULT_GOAL
r2591 r3140 43 43 ', 44 44 '', 45 '#MAKE#: *** No rule to make target `foo\'. Stop.',45 "#MAKE#: *** No rule to make target 'foo'. Stop.", 46 46 512); 47 47 -
trunk/src/kmk/tests/scripts/variables/LIBPATTERNS
r2591 r3140 21 21 all: -lfoo ; @echo "build $@ from $<" 22 22 ', 23 '', "#MAKE#: .LIBPATTERNS element `mtest_foo.a' is not a pattern23 '', "#MAKE#: .LIBPATTERNS element 'mtest_foo.a' is not a pattern 24 24 build all from mtest_foo.a\n"); 25 25 -
trunk/src/kmk/tests/scripts/variables/MAKE
r2591 r3140 17 17 '', 18 18 "#MAKEPATH#\n#MAKEPATH# -f #MAKEFILE# foo\n" 19 . "#MAKE#[1]: Entering directory `#PWD#'\n"20 . "#MAKEPATH#\n#MAKE#[1]: Leaving directory `#PWD#'\n");19 . "#MAKE#[1]: Entering directory '#PWD#'\n" 20 . "#MAKEPATH#\n#MAKE#[1]: Leaving directory '#PWD#'\n"); 21 21 22 22 rmfiles("foo"); -
trunk/src/kmk/tests/scripts/variables/MAKEFLAGS
r2591 r3140 1 # 1 # -*-perl-*- 2 2 3 3 $description = "Test proper behavior of MAKEFLAGS"; … … 9 9 all: ; @echo $(MAKEFLAGS) 10 10 !, 11 '-e -r -R', ' Rre');11 '-e -r -R', 'erR'); 12 12 13 13 # Long arguments mean everything is prefixed with "-" … … 15 15 all: ; @echo $(MAKEFLAGS) 16 16 !, 17 '--no-print-directory -e -r -R', '--no-print-directory -Rre'); 17 '--no-print-directory -e -r -R --trace', "#MAKEFILE#:2: target 'all' does not exist 18 echo erR --trace --no-print-directory 19 erR --trace --no-print-directory"); 18 20 19 21 20 if ($all_tests) { 21 # Recursive invocations of make should accumulate MAKEFLAGS values. 22 # Savannah bug #2216 23 run_make_test(q! 22 # Recursive invocations of make should accumulate MAKEFLAGS values. 23 # Savannah bug #2216 24 run_make_test(q! 24 25 MSG = Fails 25 26 all: … … 27 28 @MSG=Works $(MAKE) -e -f #MAKEFILE# jump 28 29 jump: 29 @echo '$@ : MAKEFLAGS=$(MAKEFLAGS)'30 @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)' 30 31 @$(MAKE) -f #MAKEFILE# print 31 32 print: 32 @echo '$@: MAKEFLAGS=$(MAKEFLAGS)' 33 @echo $(MSG) 33 @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)' 34 34 .PHONY: all jump print 35 35 !, 36 36 '--no-print-directory', 37 37 'all: MAKEFLAGS= --no-print-directory 38 jump: MAKEFLAGS= --no-print-directory -e 39 print: MAKEFLAGS= --no-print-directory -e 40 Works'); 41 } 38 jump Works: MAKEFLAGS=e --no-print-directory 39 print Works: MAKEFLAGS=e --no-print-directory'); 42 40 43 41 1; 42 43 ### Local Variables: 44 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 45 ### End: -
trunk/src/kmk/tests/scripts/variables/MAKE_RESTARTS
r969 r3140 12 12 ', 13 13 '', 'MAKE_RESTARTS= 14 #MAKEFILE#:4: foo.x: No such file or directory15 14 MAKE_RESTARTS=1'); 16 15 … … 27 26 ', 28 27 '', 'MAKE_RESTARTS= 29 #MAKEFILE#:4: foo.x: No such file or directory30 28 MAKE_RESTARTS=1 31 foo.x:1: bar.x: No such file or directory32 29 MAKE_RESTARTS=2'); 33 30 … … 48 45 ', 49 46 '', "MAKE_RESTARTS= 50 #MAKEFILE#:8: foo.x: No such file or directory51 47 MAKE_RESTARTS=1 52 foo.x:1: bar.x: No such file or directory53 48 MAKE_RESTARTS=2 54 49 recurse MAKE_RESTARTS= 50 #MAKE#[1]: Entering directory '#PWD#' 55 51 MAKE_RESTARTS= 56 #MAKE#[1]: Entering directory `#PWD#'57 52 all MAKE_RESTARTS= 58 #MAKE#[1]: Leaving directory `#PWD#'");53 #MAKE#[1]: Leaving directory '#PWD#'"); 59 54 60 55 rmfiles('foo.x', 'bar.x'); 61 56 62 57 1; 58 59 ### Local Variables: 60 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 61 ### End: -
trunk/src/kmk/tests/scripts/variables/SHELL
r2591 r3140 72 72 '', $out); 73 73 74 # Do it again but add spaces to SHELLFLAGS 75 76 # Some shells (*shakes fist at Solaris*) cannot handle multiple flags in 77 # separate arguments. 78 my $t = `/bin/sh -e -c true 2>/dev/null`; 79 my $multi_ok = $? == 0; 80 81 if ($multi_ok) { 82 $flags = '-x -c'; 83 run_make_test(qq! 84 .SHELLFLAGS = $flags 85 all: ; \@$script 86 !, 87 '', $out); 88 } 89 74 90 # We can't just use "false" because on different systems it provides a 75 91 # different exit code--once again Solaris: false exits with 255 not 1 … … 83 99 all: ; \@$script 84 100 !, 85 '', "$out#MAKE#: *** [ all] Error $err\n", 512);101 '', "$out#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512); 86 102 87 103 1; -
trunk/src/kmk/tests/scripts/variables/define
r2591 r3140 31 31 endef 32 32 33 define posix ::= 34 @echo $(FOO) 35 endef 36 33 37 append = @echo a 34 38 … … 50 54 all: ; $(multi) 51 55 $(simple) 56 $(posix) 52 57 $(append) 53 58 $(cond) 54 59 ', 55 '', "echo hi\nhi\nthere\nfoo\na\nb\nfirst\n"); 60 '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n"); 61 62 # TEST 1a: Various new-style define/endef, with no spaces 63 64 run_make_test(' 65 FOO = foo 66 67 define multi= 68 echo hi 69 @echo $(FOO) 70 endef # this is the end 71 72 define simple:= 73 @echo $(FOO) 74 endef 75 76 define posix::= 77 @echo $(FOO) 78 endef 79 80 append = @echo a 81 82 define append+= 83 84 @echo b 85 endef 86 87 define cond?= # this is a conditional 88 @echo first 89 endef 90 91 define cond?= 92 @echo second 93 endef 94 95 FOO = there 96 97 all: ; $(multi) 98 $(simple) 99 $(posix) 100 $(append) 101 $(cond) 102 ', 103 '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n"); 56 104 57 105 # TEST 2: define in true section of conditional (containing conditional) … … 113 161 all: ; @echo ok 114 162 ', 115 '', "#MAKEFILE#:3: extraneous text after `define' directive\nok\n");163 '', "#MAKEFILE#:3: extraneous text after 'define' directive\nok\n"); 116 164 117 165 # TEST 7: NEGATIVE: extra text after endef … … 124 172 all: ; @echo ok 125 173 ', 126 '', "#MAKEFILE#:5: extraneous text after `endef' directive\nok\n");174 '', "#MAKEFILE#:5: extraneous text after 'endef' directive\nok\n"); 127 175 128 176 # TEST 8: NEGATIVE: missing endef … … 135 183 endef$(NAME) 136 184 ', 137 '', "#MAKEFILE#:4: *** missing `endef', unterminated `define'. Stop.\n", 512);185 '', "#MAKEFILE#:4: *** missing 'endef', unterminated 'define'. Stop.\n", 512); 138 186 139 187 # ------------------------- -
trunk/src/kmk/tests/scripts/variables/flavors
r2591 r3140 74 74 '', "Hello\n"); 75 75 76 # TEST 6: Simple using POSIX syntax 77 run_make_test(' 78 bar = Goodbye 79 foo ::= $(bar) 80 bar = ${ugh} 81 ugh = Hello 82 all: ; @echo $(foo) 83 ', 84 '', "Goodbye\n"); 85 86 # TEST 7: POSIX syntax no spaces 87 run_make_test(' 88 bar = Goodbye 89 foo::=$(bar) 90 bar = ${ugh} 91 ugh = Hello 92 all: ; @echo $(foo) 93 ', 94 '', "Goodbye\n"); 95 76 96 1; -
trunk/src/kmk/tests/scripts/variables/private
r2591 r3140 76 76 '', "b=a\na=a\n"); 77 77 78 # 9: make sure private suppresses inheritance 79 run_make_test(q! 80 DEFS = FOO 81 all: bar1 82 bar1: private DEFS += 1 83 bar3: private DEFS += 3 84 bar1: bar2 85 bar2: bar3 86 bar1 bar2 bar3: ; @echo '$@: $(DEFS)' 87 !, 88 '', "bar3: FOO 3\nbar2: FOO\nbar1: FOO 1\n"); 89 90 # 10: Test append with pattern-specific variables and private 91 92 run_make_test(q! 93 IA = global 94 PA = global 95 PS = global 96 S = global 97 PS = global 98 SV = global 99 b%: IA += b% 100 b%: private PA += b% 101 b%: private PS = b% 102 bar: all 103 bar: IA += bar 104 bar: private PA += bar 105 bar: private PS = bar 106 a%: IA += a% 107 a%: private PA += a% 108 a%: private PS = a% 109 all: IA += all 110 all: private PA += all 111 all: private PS = all 112 113 bar all: ; @echo '$@: IA=$(IA)'; echo '$@: PA=$(PA)'; echo '$@: PS=$(PS)' 114 !, 115 '', "all: IA=global b% bar a% all 116 all: PA=global a% all 117 all: PS=all 118 bar: IA=global b% bar 119 bar: PA=global b% bar 120 bar: PS=bar\n"); 121 78 122 1; -
trunk/src/kmk/tests/scripts/variables/special
r2000 r3140 15 15 BAR := bar 16 16 17 all: 18 @echo X1 = $(X1) 19 @echo X2 = $(X2) 20 @echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) 17 all: ; @echo X1 = $(X1); echo X2 = $(X2); echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) 21 18 ', 22 19 '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n"); 23 20 21 # SV 45728: Test that undefining a variable is reflected properly 24 22 23 &run_make_test(' 24 FOO := foo 25 BAR := bar 26 $(info one: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) 27 undefine BAR 28 BAZ := baz 29 $(info two: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) 30 all:;@: 31 ', 32 '', "one: BAR FOO\ntwo: BAZ FOO\n"); 25 33 26 34 # $makefile2 = &get_tmpfile; … … 32 40 33 41 # all: foo 34 # 35 # 36 # 42 # @echo X1 = $(X1) 43 # @echo X2 = $(X2) 44 # @echo LAST = $(sort $(.TARGETS)) 37 45 38 46 # X2 := $(sort $(.TARGETS)) … … 55 63 &run_make_test(' 56 64 define foo 57 : foo-one 65 : foo-one\ 58 66 foo-two 59 67 : foo-three … … 116 124 : foo-four'); 117 125 126 # Test that the "did you mean TAB" message is printed properly 127 128 run_make_test(q! 129 $x. 130 !, 131 '', '#MAKEFILE#:2: *** missing separator. Stop.', 512); 132 133 run_make_test(q! 134 foo: 135 bar 136 !, 137 '', '#MAKEFILE#:3: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.', 512); 138 139 run_make_test(q! 140 .RECIPEPREFIX = : 141 foo: 142 bar 143 !, 144 '', '#MAKEFILE#:4: *** missing separator. Stop.', 512); 145 118 146 1; 147 148 ### Local Variables: 149 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 150 ### End:
Note:
See TracChangeset
for help on using the changeset viewer.