Changeset 501 in kBuild for vendor/gnumake/current/tests/scripts
- Timestamp:
- Sep 15, 2006 2:30:32 AM (19 years ago)
- Location:
- vendor/gnumake/current/tests/scripts
- Files:
-
- 9 added
- 1 deleted
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/tests/scripts/features/default_names
r53 r501 8 8 9 9 open(MAKEFILE,"> $makefile"); 10 11 10 print MAKEFILE "FIRST: ; \@echo It chose GNUmakefile\n"; 12 13 11 close(MAKEFILE); 14 12 15 13 # DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile. 16 14 # Just test what we can here (avoid Makefile versus makefile test). 17 # 18 if ($port_type eq 'UNIX') 19 { 15 16 if ($port_type eq 'UNIX') { 20 17 # Create another makefile called "makefile" 21 18 open(MAKEFILE,"> makefile"); 22 23 19 print MAKEFILE "SECOND: ; \@echo It chose makefile\n"; 24 25 20 close(MAKEFILE); 26 21 } 27 22 28 29 23 # Create another makefile called "Makefile" 30 24 open(MAKEFILE,"> Makefile"); 31 32 25 print MAKEFILE "THIRD: ; \@echo It chose Makefile\n"; 33 34 26 close(MAKEFILE); 35 27 36 28 37 29 &run_make_with_options("","",&get_logfile); 38 39 # Create the answer to what should be produced by this Makefile 40 $answer = "It chose GNUmakefile\n"; 41 42 # COMPARE RESULTS 43 44 &compare_output($answer,&get_logfile(1)) || &error("abort"); 30 &compare_output("It chose GNUmakefile\n",&get_logfile(1)); 45 31 unlink $makefile; 46 32 47 # DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile. 48 # Just test what we can here (avoid Makefile versus makefile test). 49 # 50 if ($port_type eq 'UNIX') 51 { 52 $answer = "It chose makefile\n"; 53 33 if ($port_type eq 'UNIX') { 54 34 &run_make_with_options("","",&get_logfile); 55 56 &compare_output($answer,&get_logfile(1)) || &error("abort"); 35 &compare_output("It chose makefile\n",&get_logfile(1)); 57 36 unlink "makefile"; 58 37 } 59 38 60 $answer = "It chose Makefile\n";61 62 39 &run_make_with_options("","",&get_logfile); 63 64 &compare_output($answer,&get_logfile(1)) || &error("abort"); 40 &compare_output("It chose Makefile\n",&get_logfile(1)); 65 41 unlink "Makefile"; -
vendor/gnumake/current/tests/scripts/features/double_colon
r53 r501 125 125 unlink('foo','f1.h','f2.h'); 126 126 127 128 # TEST 9: make sure all rules in s double colon family get executed 129 # (Savannah bug #14334). 130 # 131 132 &touch('one'); 133 &touch('two'); 134 135 run_make_test(' 136 .PHONY: all 137 all: result 138 139 result:: one 140 @echo $^ >>$@ 141 @echo $^ 142 143 result:: two 144 @echo $^ >>$@ 145 @echo $^ 146 147 ', 148 '', 149 'one 150 two'); 151 152 unlink('result','one','two'); 153 154 # This tells the test driver that the perl test script executed properly. 127 155 1; -
vendor/gnumake/current/tests/scripts/features/errors
r280 r501 1 # -*-perl-*- 2 1 3 $description = "The following tests the -i option and the '-' in front of \n" 2 4 ."commands to test that make ignores errors in these commands\n" … … 15 17 if ($vos) 16 18 { 17 $ delete_command = "delete_file";19 $rm_command = "delete_file"; 18 20 } 19 21 else 20 22 { 21 $ delete_command = "rm";23 $rm_command = "rm"; 22 24 } 23 25 … … 27 29 28 30 print MAKEFILE "clean:\n" 29 ."\t-$ delete_command cleanit\n"30 ."\t$ delete_command foo\n"31 ."\t-$rm_command cleanit\n" 32 ."\t$rm_command foo\n" 31 33 ."clean2: \n" 32 ."\t$ delete_command cleanit\n"33 ."\t$ delete_command foo\n";34 ."\t$rm_command cleanit\n" 35 ."\t$rm_command foo\n"; 34 36 35 37 # END of Contents of MAKEFILE … … 40 42 41 43 unlink("cleanit"); 42 $cleanit_error = `sh -c "$ delete_command cleanit 2>&1"`;44 $cleanit_error = `sh -c "$rm_command cleanit 2>&1"`; 43 45 $delete_error_code = $? >> 8; 44 46 … … 46 48 # ------- 47 49 48 $answer = "$ delete_command cleanit\n"50 $answer = "$rm_command cleanit\n" 49 51 . $cleanit_error 50 52 ."$make_name: [clean] Error $delete_error_code (ignored)\n" 51 ."$ delete_command foo\n";53 ."$rm_command foo\n"; 52 54 53 55 &run_make_with_options($makefile,"",&get_logfile); … … 73 75 # ------- 74 76 75 $answer = "$ delete_command cleanit\n"77 $answer = "$rm_command cleanit\n" 76 78 . $cleanit_error 77 79 ."$make_name: [clean2] Error $delete_error_code (ignored)\n" 78 ."$ delete_command foo\n";80 ."$rm_command foo\n"; 79 81 80 82 &run_make_with_options($makefile,"clean2 -i",&get_logfile); -
vendor/gnumake/current/tests/scripts/features/escape
r53 r501 7 7 Make sure that escaping of '#' works."; 8 8 9 open(MAKEFILE,"> $makefile");10 11 print MAKEFILE <<'EOF';12 $(path)foo : ; @echo cp $^ $@13 14 foo\ bar: ; @echo 'touch "$@"'15 16 sharp: foo\#bar.ext17 foo\#bar.ext: ; @echo foo\#bar.ext = '$@'18 EOF19 9 20 10 close(MAKEFILE); … … 23 13 # TEST 1 24 14 25 &run_make_with_options($makefile, "", &get_logfile); 26 $answer = "cp foo\n"; 27 &compare_output($answer,&get_logfile(1)); 15 run_make_test(' 16 $(path)foo : ; @echo "touch ($@)" 17 18 foo\ bar: ; @echo "touch ($@)" 19 20 sharp: foo\#bar.ext 21 foo\#bar.ext: ; @echo "foo#bar.ext = ($@)"', 22 '', 23 'touch (foo)'); 28 24 29 25 # TEST 2: This one should fail, since the ":" is unquoted. 30 26 31 &run_make_with_options($makefile, "path=p:", &get_logfile, 512); 32 $answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n"; 33 &compare_output($answer,&get_logfile(1)); 27 run_make_test(undef, 28 'path=pre:', 29 "#MAKEFILE#:2: *** target pattern contains no `%'. Stop.", 30 512); 34 31 35 32 # TEST 3: This one should work, since we escape the ":". 36 33 37 &run_make_with_options($makefile, "'path=p\\:'", &get_logfile, 0); 38 $answer = "cp p:foo\n"; 39 &compare_output($answer,&get_logfile(1));34 run_make_test(undef, 35 "'path=pre\\:'", 36 'touch (pre:foo)'); 40 37 41 38 # TEST 4: This one should fail, since the escape char is escaped. 42 39 43 &run_make_with_options($makefile, "'path=p\\\\:'", &get_logfile, 512); 44 $answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n"; 45 &compare_output($answer,&get_logfile(1)); 40 run_make_test(undef, 41 "'path=pre\\\\:'", 42 "#MAKEFILE#:2: *** target pattern contains no `%'. Stop.", 43 512); 46 44 47 45 # TEST 5: This one should work 48 46 49 &run_make_with_options($makefile, "'foo bar'", &get_logfile, 0); 50 $answer = "touch \"foo bar\"\n"; 51 &compare_output($answer,&get_logfile(1));47 run_make_test(undef, 48 "'foo bar'", 49 'touch (foo bar)'); 52 50 53 51 # TEST 6: Test escaped comments 54 52 55 &run_make_with_options($makefile, "sharp", &get_logfile, 0); 56 $answer = "foo#bar.ext = foo#bar.ext\n"; 57 &compare_output($answer,&get_logfile(1));53 run_make_test(undef, 54 'sharp', 55 'foo#bar.ext = (foo#bar.ext)'); 58 56 59 57 # This tells the test driver that the perl test script executed properly. -
vendor/gnumake/current/tests/scripts/features/export
r53 r501 57 57 # TEST 1: make sure vars inherited from the parent are exported 58 58 59 $ ENV{FOO} = 1;59 $extraENV{FOO} = 1; 60 60 61 61 &run_make_with_options($makefile,"",&get_logfile,0); … … 65 65 66 66 &compare_output($answer,&get_logfile(1)); 67 68 delete $ENV{FOO};69 67 70 68 # TEST 2: global export. Explicit unexport takes precedence. … … 238 236 close(MAKEFILE); 239 237 240 @ ENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10);238 @extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); 241 239 242 240 &run_make_with_options($makefile5,"",&get_logfile,0); … … 244 242 &compare_output($answer,&get_logfile(1)); 245 243 246 delete @ENV{qw(A B C D E F G H I J)};247 248 244 249 245 # This tells the test driver that the perl test script executed properly. -
vendor/gnumake/current/tests/scripts/features/include
r284 r501 79 79 ); 80 80 81 81 82 # Test inheritance of dontcare flag when rebuilding makefiles. 82 83 # … … 91 92 92 93 1; 94 95 96 # Make sure that we don't die when the command fails but we dontcare. 97 # (Savannah bug #13216). 98 # 99 run_make_test(' 100 .PHONY: all 101 all:; @: 102 103 -include foo 104 105 foo: bar; @: 106 107 bar:; @exit 1 108 ', '', ''); 109 110 # Check include, sinclude, -include with no filenames. 111 # (Savannah bug #1761). 112 113 run_make_test(' 114 .PHONY: all 115 all:; @: 116 include 117 -include 118 sinclude', '', ''); 119 120 1; -
vendor/gnumake/current/tests/scripts/features/order_only
r284 r501 6 6 prerequisites and ensure they behave properly. Test the \$| variable."; 7 7 8 open(MAKEFILE,"> $makefile"); 8 # TEST #0 -- Basics 9 9 10 print MAKEFILE <<'EOF'; 10 run_make_test(' 11 %r: | baz ; @echo $< $^ $| 12 bar: foo 13 foo:;@: 14 baz:;@:', 15 '', "foo foo baz\n"); 16 17 # TEST #1 -- First try: the order-only prereqs need to be built. 18 19 run_make_test(q! 11 20 foo: bar | baz 12 21 @echo '$$^ = $^' … … 17 26 18 27 bar baz: 19 touch $@ 20 EOF 21 22 close(MAKEFILE); 23 24 25 # TEST #1 -- just the syntax 26 27 &run_make_with_options($makefile, "", &get_logfile); 28 $answer = "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n"; 29 &compare_output($answer,&get_logfile(1)); 28 touch $@!, 29 '', "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n"); 30 30 31 31 32 32 # TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated 33 33 34 &run_make_with_options($makefile, "", &get_logfile); 35 $answer = "touch baz\n"; 36 &compare_output($answer,&get_logfile(1)); 34 run_make_test(undef, '', "touch baz\n"); 37 35 38 36 unlink(qw(foo bar baz)); 39 37 40 # T est prereqs that are both order and non-order38 # TEST #3 -- Make sure the order-only prereq was promoted to normal. 41 39 42 $makefile2 = &get_tmpfile; 43 44 open(MAKEFILE,"> $makefile2"); 45 46 print MAKEFILE <<'EOF'; 40 run_make_test(q! 47 41 foo: bar | baz 48 42 @echo '$$^ = $^' … … 55 49 56 50 bar baz: 57 touch $@ 58 EOF 59 60 close(MAKEFILE); 61 62 # TEST #3 -- Make sure the order-only prereq was promoted to normal. 63 64 &run_make_with_options($makefile2, "", &get_logfile); 65 $answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"; 66 &compare_output($answer,&get_logfile(1)); 51 touch $@!, 52 '', "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"); 67 53 68 54 69 55 # TEST #4 -- now we do it again 70 56 71 &run_make_with_options($makefile2, "", &get_logfile); 72 $answer = "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"; 73 &compare_output($answer,&get_logfile(1)); 57 run_make_test(undef, '', "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"); 74 58 75 59 unlink(qw(foo bar baz)); … … 77 61 # Test empty normal prereqs 78 62 79 $makefile3 = &get_tmpfile; 63 # TEST #5 -- make sure the parser was correct. 80 64 81 open(MAKEFILE,"> $makefile3"); 82 83 print MAKEFILE <<'EOF'; 65 run_make_test(q! 84 66 foo:| baz 85 67 @echo '$$^ = $^' … … 90 72 91 73 baz: 92 touch $@ 93 EOF 94 95 close(MAKEFILE); 96 97 # TEST #5 -- make sure the parser was correct. 98 99 &run_make_with_options($makefile3, "", &get_logfile); 100 $answer = "touch baz\n\$^ = \n\$| = baz\ntouch foo\n"; 101 &compare_output($answer,&get_logfile(1)); 102 74 touch $@!, 75 '', "touch baz\n\$^ = \n\$| = baz\ntouch foo\n"); 103 76 104 77 # TEST #6 -- now we do it again: this time foo won't be built 105 78 106 &run_make_with_options($makefile3, "", &get_logfile); 107 $answer = "touch baz\n"; 108 &compare_output($answer,&get_logfile(1)); 79 run_make_test(undef, '', "touch baz\n"); 109 80 110 81 unlink(qw(foo baz)); … … 112 83 # Test order-only in pattern rules 113 84 114 $makefile4 = &get_tmpfile; 85 # TEST #7 -- make sure the parser was correct. 115 86 116 open(MAKEFILE,"> $makefile4"); 117 118 print MAKEFILE <<'EOF'; 87 run_make_test(q! 119 88 %.w : %.x | baz 120 89 @echo '$$^ = $^' … … 126 95 .PHONY: baz 127 96 foo.x baz: 128 touch $@ 129 EOF 130 131 close(MAKEFILE); 132 133 # TEST #7 -- make sure the parser was correct. 134 135 &run_make_with_options($makefile4, "", &get_logfile); 136 $answer = "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n"; 137 &compare_output($answer,&get_logfile(1)); 97 touch $@!, 98 '', 99 "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n"); 138 100 139 101 # TEST #8 -- now we do it again: this time foo.w won't be built 140 102 141 &run_make_with_options($makefile4, "", &get_logfile); 142 $answer = "touch baz\n"; 143 &compare_output($answer,&get_logfile(1)); 103 run_make_test(undef, '', "touch baz\n"); 144 104 145 105 unlink(qw(foo.w foo.x baz)); … … 152 112 bar: foo 153 113 foo:;@: 154 baz:;@: 155 ','', "foo foo baz\n");114 baz:;@:', 115 '', "foo foo baz\n"); 156 116 157 117 -
vendor/gnumake/current/tests/scripts/features/parallelism
r284 r501 19 19 20 20 if ($vos) { 21 $delete_command = "delete_file -no_ask";22 21 $sleep_command = "sleep -seconds"; 23 22 } 24 23 else { 25 $delete_command = "rm -f";26 24 $sleep_command = "sleep"; 27 25 } … … 84 82 '-j2', "first\nfirst\nsecond\nsecond"); 85 83 84 # Michael Matz <[email protected]> reported a bug where if make is running in 85 # parallel without -k and two jobs die in a row, but not too close to each 86 # other, then make will quit without waiting for the rest of the jobs to die. 87 88 run_make_test(" 89 .PHONY: all fail.1 fail.2 fail.3 ok 90 all: fail.1 ok fail.2 fail.3 91 92 fail.1 fail.2 fail.3: 93 \@sleep \$(patsubst fail.%,%,\$\@) 94 \@echo Fail 95 \@exit 1 96 97 ok: 98 \@sleep 4 99 \@echo Ok done", 100 '-rR -j5', 'Fail 101 #MAKE#: *** [fail.1] Error 1 102 #MAKE#: *** Waiting for unfinished jobs.... 103 Fail 104 #MAKE#: *** [fail.2] Error 1 105 Fail 106 #MAKE#: *** [fail.3] Error 1 107 Ok done', 108 512); 109 110 111 # Test for Savannah bug #15641. 112 # 113 run_make_test(' 114 .PHONY: all 115 all:; @: 116 117 -include foo.d 118 119 foo.d: comp 120 @echo building $@ 121 122 comp: mod_a.o mod_b.o; @: 123 124 mod_a.o mod_b.o: 125 @exit 1 126 ', '-j2', ''); 127 128 129 # Make sure that all jobserver FDs are closed if we need to re-exec the 130 # master copy. 131 # 132 # First, find the "default" file descriptors we normally use 133 # Then make sure they're still used. 134 # 135 # Right now we don't have a way to run a makefile and capture the output 136 # without checking it, so we can't really write this test. 137 138 # run_make_test(' 139 # submake: ; @$(MAKE) --no-print-directory -f #MAKEFILE# fdprint 5>output 140 141 # dependfile: ; @echo FOO=bar > $@ 142 143 # INCL := true 144 145 # FOO=foo 146 # ifeq ($(INCL),true) 147 # -include dependfile 148 # endif 149 150 # fdprint: ; @echo $(filter --jobserver%,$(MAKEFLAGS)) 151 152 # recurse: ; @$(MAKE) --no-print-directory -f #MAKEFILE# submake INCL=true', 153 # '-j2 INCL=false fdprint', 154 # 'bar'); 155 156 # unlink('dependfile', 'output'); 157 158 159 # # Do it again, this time where the include is done by the non-master make. 160 # run_make_test(undef, '-j2 recurse INCL=false', 'bar'); 161 162 # unlink('dependfile', 'output'); 163 86 164 1; -
vendor/gnumake/current/tests/scripts/features/patspecific_vars
r284 r501 68 68 69 69 /bar: 70 @ test "$(foo)" = "$$foo"71 ', '', ' ');70 @echo $(foo) $$foo 71 ', '', 'foo foo'); 72 72 73 73 -
vendor/gnumake/current/tests/scripts/features/patternrules
r283 r501 24 24 # 1 - existing file 25 25 %.1: void 26 @ false26 @exit 1 27 27 %.1: #MAKEFILE# 28 @ true28 @exit 0 29 29 30 30 # 2 - phony 31 31 %.2: void 32 @ false32 @exit 1 33 33 %.2: 2.phony 34 @ true34 @exit 0 35 35 .PHONY: 2.phony 36 36 37 37 # 3 - implicit-phony 38 38 %.3: void 39 @ false39 @exit 1 40 40 %.3: 3.implicit-phony 41 @ true41 @exit 0 42 42 43 43 3.implicit-phony: … … 96 96 unlink("$dir/foo.c"); 97 97 98 99 # TEST #4: make sure precious flag is set properly for targets 100 # that are built via implicit rules (Savannah bug #13218). 101 # 102 run_make_test(' 103 .DELETE_ON_ERROR: 104 105 .PRECIOUS: %.bar 106 107 %.bar:; @touch $@ && exit 1 108 109 $(dir)/foo.bar: 110 111 ', 112 "dir=$dir", 113 "#MAKE#: *** [$dir/foo.bar] Error 1", 114 512); 115 116 unlink("$dir/foo.bar"); 117 118 119 # TEST #5: make sure targets of a macthed implicit pattern rule never 120 # never considered intermediate (Savannah bug #13022). 121 # 122 run_make_test(' 123 .PHONY: all 124 all: foo.c foo.o 125 126 %.h %.c: %.in 127 touch $*.h 128 touch $*.c 129 130 %.o: %.c %.h 131 echo $+ >$@ 132 133 %.o: %.c 134 @echo wrong rule 135 136 foo.in: 137 touch $@ 138 139 ', 140 '', 141 'touch foo.in 142 touch foo.h 143 touch foo.c 144 echo foo.c foo.h >foo.o'); 145 146 unlink('foo.in', 'foo.h', 'foo.c', 'foo.o'); 147 98 148 # This tells the test driver that the perl test script executed properly. 99 149 1; -
vendor/gnumake/current/tests/scripts/features/reinvoke
r53 r501 8 8 file, then touch the temp file to make it newer than the makefile."; 9 9 10 $makefile2 = &get_tmpfile; 11 $makefile_orig = &get_tmpfile; 10 $omkfile = $makefile; 12 11 13 open(MAKEFILE,"> $makefile"); 12 &utouch(-600, 'incl.mk'); 13 # For some reason if we don't do this then the test fails for systems 14 # with sub-second timestamps, maybe + NFS? Not sure. 15 &utouch(-1, 'incl-1.mk'); 14 16 15 print MAKEFILE <<EOM; 17 run_make_test(' 18 all: ; @echo running rules. 16 19 17 all: ; \@echo 'running rules.' 20 #MAKEFILE# incl.mk: incl-1.mk 21 @echo rebuilding $@ 22 @echo >> $@ 18 23 19 $makefile $makefile2: $makefile_orig 20 \@echo 'rebuilding \$\@.' 21 \@echo >> \$\@ 24 include incl.mk', 25 '', "rebuilding incl.mk\nrunning rules.\n"); 22 26 23 include $makefile2 27 # Make sure updating the makefile itself also works 24 28 25 EOM 29 &utouch(-600, $omkfile); 26 30 27 close(MAKEFILE);31 run_make_test(undef, '', "rebuilding #MAKEFILE#\nrunning rules.\n"); 28 32 29 &utouch(-10, $makefile, $makefile2); 30 &touch($makefile_orig); 33 &rmfiles('incl.mk', 'incl-1.mk'); 31 34 32 &run_make_with_options($makefile, "", &get_logfile, 0);33 34 # Create the answer to what should be produced by this Makefile35 36 $answer = "rebuilding $makefile2.\nrebuilding $makefile.\nrunning rules.\n";37 38 &compare_output($answer,&get_logfile(1))39 && unlink "$makefile_orig";40 35 41 36 # In this test we create an included file that's out-of-date, but then 42 37 # the rule doesn't update it. Make shouldn't re-exec. 43 38 44 $makefile3 = &get_tmpfile; 39 &utouch(-600, 'b','a'); 40 #&utouch(-10, 'a'); 41 &touch('c'); 45 42 46 open(MAKEFILE, "> $makefile3"); 47 print MAKEFILE <<'EOM'; 43 run_make_test(' 48 44 SHELL = /bin/sh 49 45 … … 56 52 c: ; echo >> $@ 57 53 58 include $(F) 59 EOM 60 61 close(MAKEFILE); 62 63 &utouch(-20, 'b','a'); 64 #&utouch(-10, 'a'); 65 &touch('c'); 66 67 # First try with the file that's not updated "once removed" from the 68 # file we're including. 69 70 &run_make_with_options($makefile3, "F=a", &get_logfile, 0); 71 72 $answer = "[ -f b ] || echo >> b\nhello\n"; 73 &compare_output($answer,&get_logfile(1)); 54 include $(F)', 55 'F=a', "[ -f b ] || echo >> b\nhello\n"); 74 56 75 57 # Now try with the file we're not updating being the actual file we're 76 58 # including: this and the previous one test different parts of the code. 77 59 78 &run_make_with_options($makefile3, "F=b", &get_logfile, 0); 60 run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n") 79 61 80 $answer = "[ -f b ] || echo >> b\nhello\n"; 81 &compare_output($answer,&get_logfile(1)); 82 83 unlink('a','b','c'); 62 &rmfiles('a','b','c'); 84 63 85 64 # This tells the test driver that the perl test script executed properly. -
vendor/gnumake/current/tests/scripts/features/se_explicit
r283 r501 4 4 $details = ""; 5 5 6 # Test #1: automatic variables. 6 # TEST #0: Test handing of '$' in prerequisites with and without second 7 # expansion. 8 9 run_make_test(q! 10 ifdef SE 11 .SECONDEXPANSION: 12 endif 13 foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^' 14 PRE = one two 15 bar$$baz: $$(PRE) 16 baraz: $$(PRE) 17 PRE = three four 18 .DEFAULT: ; @echo '$@' 19 !, 20 '', 21 "\$\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz"); 22 23 run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz"); 24 25 # TEST #1: automatic variables. 7 26 # 8 27 run_make_test(' 28 .SECONDEXPANSION: 9 29 .DEFAULT: ; @echo $@ 10 30 … … 42 62 # 43 63 run_make_test(' 64 .SECONDEXPANSION: 44 65 .DEFAULT: ; @echo $@ 45 66 … … 60 81 # 61 82 run_make_test(' 83 .SECONDEXPANSION: 62 84 .DEFAULT: ; @echo $@ 63 85 -
vendor/gnumake/current/tests/scripts/features/se_implicit
r283 r501 13 13 # 14 14 run_make_test(' 15 .SECONDEXPANSION: 15 16 .DEFAULT: ; @echo $@ 16 17 … … 61 62 # 62 63 run_make_test(' 64 .SECONDEXPANSION: 63 65 foo.x: 64 66 … … 82 84 # 83 85 run_make_test(' 86 .SECONDEXPANSION: 84 87 .DEFAULT: ; @echo $@ 85 88 … … 133 136 # 134 137 run_make_test(' 138 .SECONDEXPANSION: 135 139 $(dir)/tmp/bar.o: 136 140 … … 154 158 # 155 159 run_make_test(' 160 .SECONDEXPANSION: 156 161 $(dir)/tmp/foo.o: $(dir)/tmp/foo.c 157 162 $(dir)/tmp/foo.c: ; @echo $@ … … 172 177 # 173 178 run_make_test(' 179 .SECONDEXPANSION: 174 180 foo.o: foo.c 175 181 foo.c: ; @echo $@ … … 187 193 # 188 194 run_make_test(' 195 .SECONDEXPANSION: 189 196 foobarbaz: 190 197 … … 205 212 # 206 213 run_make_test(' 214 .SECONDEXPANSION: 207 215 foo$$bar: 208 216 -
vendor/gnumake/current/tests/scripts/features/se_statpat
r283 r501 7 7 # 8 8 run_make_test(' 9 .SECONDEXPANSION: 9 10 .DEFAULT: ; @echo $@ 10 11 … … 42 43 # 43 44 run_make_test(' 45 .SECONDEXPANSION: 44 46 .DEFAULT: ; @echo $@ 45 47 … … 61 63 # 62 64 run_make_test(' 65 .SECONDEXPANSION: 63 66 .DEFAULT: ; @echo $@ 64 67 … … 107 110 # 108 111 run_make_test(' 112 .SECONDEXPANSION: 109 113 foo$$bar: f%r: % $$*.1 110 114 @echo \'$*\' -
vendor/gnumake/current/tests/scripts/features/statipattrules
r284 r501 10 10 to emacs a .el file"; 11 11 12 open(MAKEFILE,"> $makefile"); 13 print MAKEFILE <<'EOF'; 12 &touch('bar.c', 'lose.c'); 13 14 # TEST #0 15 # ------- 16 17 run_make_test(' 14 18 files = foo.elc bar.o lose.o 15 19 … … 17 21 18 22 $(filter %.elc,$(files)): %.elc: %.el ; @echo emacs $< 19 EOF 20 close(MAKEFILE); 23 ', 24 '', 25 'CC -c bar.c -o bar.o'); 26 27 # TEST #1 28 # ------- 29 30 run_make_test(undef, 'lose.o', 'CC -c lose.c -o lose.o'); 21 31 22 32 23 &touch('bar.c', 'lose.c'); 24 25 # TEST #1 26 # ------- 27 28 &run_make_with_options($makefile, '', &get_logfile); 29 $answer = "CC -c bar.c -o bar.o\n"; 30 &compare_output($answer, &get_logfile(1)); 31 32 33 # TEST #2 34 # ------- 35 36 &run_make_with_options($makefile, 'lose.o', &get_logfile); 37 $answer = "CC -c lose.c -o lose.o\n"; 38 &compare_output($answer, &get_logfile(1)); 39 40 41 # TEST #3 33 # TEST #2 42 34 # ------- 43 35 &touch("foo.el"); 44 36 45 &run_make_with_options($makefile, 'foo.elc', &get_logfile); 46 $answer = "emacs foo.el\n"; 47 &compare_output($answer, &get_logfile(1)); 37 run_make_test(undef, 'foo.elc', 'emacs foo.el'); 48 38 49 39 # Clean up after the first tests. 50 40 unlink('foo.el', 'bar.c', 'lose.c'); 51 41 52 42 53 # TEST # 4-- PR/1670: don't core dump on invalid static pattern rules43 # TEST #3 -- PR/1670: don't core dump on invalid static pattern rules 54 44 # ------- 55 45 56 $makefile2 = &get_tmpfile; 57 open(MAKEFILE, "> $makefile2"); 58 print MAKEFILE "foo: foo%: % ; \@echo \$@\n"; 59 close(MAKEFILE); 46 run_make_test(' 47 .DEFAULT: ; @echo $@ 48 foo: foo%: % %.x % % % y.% % ; @echo $@ 49 ', 50 '', ".x\ny.\nfoo"); 60 51 61 &run_make_with_options($makefile2, '', &get_logfile);62 $answer = "foo\n";63 &compare_output($answer, &get_logfile(1));64 52 65 # TEST # 5-- bug #12180: core dump on a stat pattern rule with an empty53 # TEST #4 -- bug #12180: core dump on a stat pattern rule with an empty 66 54 # prerequisite list. 67 #68 55 run_make_test(' 69 56 foo.x bar.x: %.x : ; @echo $@ 70 57 71 58 ', 59 '', 'foo.x'); 60 61 62 # TEST #5 -- bug #13881: double colon static pattern rule does not 63 # substitute %. 64 run_make_test(' 65 foo.bar:: %.bar: %.baz 66 foo.baz: ;@: 67 ', 68 '', ''); 69 70 71 # TEST #6: make sure the second stem does not overwrite the first 72 # perprerequisite's stem (Savannah bug #16053). 73 # 74 run_make_test(' 75 all.foo.bar: %.foo.bar: %.one 76 77 all.foo.bar: %.bar: %.two 78 79 all.foo.bar: 80 @echo $* 81 @echo $^ 82 83 .DEFAULT:;@: 84 ', 72 85 '', 73 'foo.x 74 '); 86 'all.foo 87 all.one all.foo.two'); 88 89 90 # TEST #7: make sure the second stem does not overwrite the first 91 # perprerequisite's stem when second expansion is enabled 92 # (Savannah bug #16053). 93 # 94 run_make_test(' 95 .SECONDEXPANSION: 96 97 all.foo.bar: %.foo.bar: %.one $$*-one 98 99 all.foo.bar: %.bar: %.two $$*-two 100 101 all.foo.bar: 102 @echo $* 103 @echo $^ 104 105 .DEFAULT:;@: 106 ', 107 '', 108 'all.foo 109 all.one all-one all.foo.two all.foo-two'); 75 110 76 111 1; -
vendor/gnumake/current/tests/scripts/features/targetvars
r53 r501 268 268 &compare_output($answer, &get_logfile(1)); 269 269 270 # TEST #17 271 272 # Test a merge of set_lists for files, where one list is much longer 273 # than the other. See Savannah bug #15757. 274 275 mkdir('t1', 0777); 276 touch('t1/rules.mk'); 277 278 run_make_test(' 279 VPATH = t1 280 include rules.mk 281 .PHONY: all 282 all: foo.x 283 foo.x : rules.mk ; @echo MYVAR=$(MYVAR) FOOVAR=$(FOOVAR) ALLVAR=$(ALLVAR) 284 all: ALLVAR = xxx 285 foo.x: FOOVAR = bar 286 rules.mk : MYVAR = foo 287 .INTERMEDIATE: foo.x rules.mk 288 ', 289 '-I t1', 290 'MYVAR= FOOVAR=bar ALLVAR=xxx'); 291 292 rmfiles('t1/rules.mk'); 293 rmdir('t1'); 294 295 # TEST #18 296 297 # Test appending to a simple variable containing a "$": avoid a 298 # double-expansion. See Savannah bug #15913. 299 300 run_make_test(" 301 VAR := \$\$FOO 302 foo: VAR += BAR 303 foo: ; \@echo '\$(VAR)'", 304 '', 305 '$FOO BAR'); 306 270 307 1; -
vendor/gnumake/current/tests/scripts/functions/abspath
r283 r501 6 6 run_make_test(' 7 7 ifneq ($(realpath $(abspath .)),$(CURDIR)) 8 $( error)8 $(warning .: abs="$(abspath .)" real="$(realpath $(abspath .))" curdir="$(CURDIR)") 9 9 endif 10 10 11 11 ifneq ($(realpath $(abspath ./)),$(CURDIR)) 12 $( error)12 $(warning ./: abs="$(abspath ./)" real="$(realpath $(abspath ./))" curdir="$(CURDIR)") 13 13 endif 14 14 15 15 ifneq ($(realpath $(abspath .///)),$(CURDIR)) 16 $( error)16 $(warning .///: abs="$(abspath .///)" real="$(realpath $(abspath .///))" curdir="$(CURDIR)") 17 17 endif 18 18 19 19 ifneq ($(abspath /),/) 20 $( error)20 $(warning /: abspath="$(abspath /)") 21 21 endif 22 22 23 23 ifneq ($(abspath ///),/) 24 $( error)24 $(warning ///: abspath="$(abspath ///)") 25 25 endif 26 26 27 27 ifneq ($(abspath /.),/) 28 $( error)28 $(warning /.: abspath="$(abspath /.)") 29 29 endif 30 30 31 31 ifneq ($(abspath ///.),/) 32 $( error)32 $(warning ///.: abspath="$(abspath ///.)") 33 33 endif 34 34 35 35 ifneq ($(abspath /./),/) 36 $( error)36 $(warning /./: abspath="$(abspath /./)") 37 37 endif 38 38 39 39 ifneq ($(abspath /.///),/) 40 $( error)40 $(warning /.///: abspath="$(abspath /.///)") 41 41 endif 42 42 43 43 ifneq ($(abspath /..),/) 44 $( error)44 $(warning /..: abspath="$(abspath /..)") 45 45 endif 46 46 47 47 ifneq ($(abspath ///..),/) 48 $( error)48 $(warning ///..: abspath="$(abspath ///..)") 49 49 endif 50 50 51 51 ifneq ($(abspath /../),/) 52 $( error)52 $(warning /../: abspath="$(abspath /../)") 53 53 endif 54 54 55 55 ifneq ($(abspath /..///),/) 56 $( error)56 $(warning /..///: abspath="$(abspath /..///)") 57 57 endif 58 58 59 59 60 60 ifneq ($(abspath /foo/bar/..),/foo) 61 $( error)61 $(warning /foo/bar/..: abspath="$(abspath /foo/bar/..)") 62 62 endif 63 63 64 64 ifneq ($(abspath /foo/bar/../../../baz),/baz) 65 $( error)65 $(warning /foo/bar/../../../baz: abspath="$(abspath /foo/bar/../../../baz)") 66 66 endif 67 67 68 68 ifneq ($(abspath /foo/bar/../ /..),/foo /) 69 $( error)69 $(warning /foo/bar/../ /..: abspath="$(abspath /foo/bar/../ /..)") 70 70 endif 71 71 -
vendor/gnumake/current/tests/scripts/functions/error
r53 r501 1 # -*-Perl-*- 2 1 3 $description = "\ 2 4 The following test creates a makefile to test the error function."; … … 6 8 open(MAKEFILE,"> $makefile"); 7 9 8 print MAKEFILE <<'EOF'; 10 print MAKEFILE 'err = $(error Error found!) 11 9 12 ifdef ERROR1 10 13 $(error error is $(ERROR1)) … … 26 29 some: ; @echo Some stuff 27 30 28 EOF 31 testvar: ; @: $(err) 32 '; 29 33 30 34 close(MAKEFILE); … … 33 37 34 38 &run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512); 35 $answer = "$makefile: 2: *** error is yes. Stop.\n";39 $answer = "$makefile:4: *** error is yes. Stop.\n"; 36 40 &compare_output($answer,&get_logfile(1)); 37 41 … … 39 43 40 44 &run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512); 41 $answer = "$makefile: 6: *** error is no. Stop.\n";45 $answer = "$makefile:8: *** error is no. Stop.\n"; 42 46 &compare_output($answer,&get_logfile(1)); 43 47 … … 45 49 46 50 &run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512); 47 $answer = "Some stuff\n$makefile:1 0: *** error is maybe. Stop.\n";51 $answer = "Some stuff\n$makefile:12: *** error is maybe. Stop.\n"; 48 52 &compare_output($answer,&get_logfile(1)); 49 53 … … 51 55 52 56 &run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512); 53 $answer = "Some stuff\n$makefile:14: *** error is definitely. Stop.\n"; 57 $answer = "Some stuff\n$makefile:16: *** error is definitely. Stop.\n"; 58 &compare_output($answer,&get_logfile(1)); 59 60 # Test #5 61 62 &run_make_with_options($makefile, "testvar", &get_logfile, 512); 63 $answer = "$makefile:22: *** Error found!. Stop.\n"; 54 64 &compare_output($answer,&get_logfile(1)); 55 65 -
vendor/gnumake/current/tests/scripts/functions/eval
r284 r501 128 128 close(MAKEFILE); 129 129 130 $ ENV{EVAR} = '1';130 $extraENV{EVAR} = '1'; 131 131 &run_make_with_options($makefile4, "", &get_logfile); 132 132 $answer = "OK\n"; 133 133 &compare_output($answer,&get_logfile(1)); 134 135 delete $ENV{EVAR};136 134 137 135 … … 152 150 run_make_test(' 153 151 define FOO 154 all: ; @echo he\llo152 all: ; @echo '."'".'he\llo'."'".' 155 153 @echo world 156 154 endef 157 155 $(eval $(FOO)) 158 ', '', 'he llo156 ', '', 'he\llo 159 157 world'); 160 158 -
vendor/gnumake/current/tests/scripts/functions/foreach
r53 r501 1 1 # -*-perl-*- 2 # $Id: foreach,v 1.5 2006/03/10 02:20:46 psmith Exp $ 2 3 3 # Updated 6.16.93 variable "MAKE" is default was environment override 4 # For make 3.63 and above 5 6 $description = "The following test creates a makefile to verify 7 test the foreach function."; 4 $description = "Test the foreach function."; 8 5 9 6 $details = "This is a test of the foreach function in gnu make. … … 15 12 16 13 17 open(MAKEFILE,"> $makefile"); 14 # TEST 0 18 15 19 # The Contents of the MAKEFILE ... 16 # Set an environment variable that we can test in the makefile. 17 $extraENV{FOOFOO} = 'foo foo'; 20 18 21 # On WIN32 systems, the user's path is found in %Path% ($Path) 22 # 23 $pathvar = (($port_type eq 'Windows') ? "Path" : "PATH"); 19 run_make_test("space = ' '".' 20 null := 21 auto_var = udef space CC null FOOFOO MAKE foo CFLAGS WHITE @ < 22 foo = bletch null @ garf 23 av = $(foreach var, $(auto_var), $(origin $(var)) ) 24 override WHITE := BLACK 25 for_var = $(addsuffix .c,foo $(null) $(foo) $(space) $(av) ) 26 fe = $(foreach var2, $(for_var),$(subst .c,.o, $(var2) ) ) 27 all: auto for2 28 auto : ; @echo $(av) 29 for2: ; @echo $(fe)', 30 '-e WHITE=WHITE CFLAGS=', 31 "undefined file default file environment default file command line override automatic automatic 32 foo.o bletch.o null.o @.o garf.o .o .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o"); 24 33 25 print MAKEFILE <<EOF; 26 foo = bletch null \@ garf 27 null := 28 space = ' ' 29 auto_var = udef space CC null $pathvar MAKE foo CFLAGS WHITE \@ < 30 av = \$(foreach var, \$(auto_var), \$(origin \$(var)) ) 31 override WHITE := BLACK 32 for_var = \$(addsuffix .c,foo \$(null) \$(foo) \$(space) \$(av) ) 33 fe = \$(foreach var2, \$(for_var),\$(subst .c,.o, \$(var2) ) ) 34 all: auto for2 35 auto : 36 \t\@echo \$(av) 37 for2: 38 \t\@echo \$(fe) 39 EOF 34 delete $extraENV{FOOFOO}; 40 35 41 close(MAKEFILE); 36 # TEST 1: Test that foreach variables take precedence over global 37 # variables in a global scope (like inside an eval). Tests bug #11913 42 38 43 &run_make_with_options($makefile, 44 "-e WHITE=WHITE CFLAGS=", 45 &get_logfile); 39 run_make_test(' 40 .PHONY: all target 41 all: target 46 42 47 # Create the answer to what should be produced by this Makefile 48 $answer = "undefined file default file environment default file command line override automatic automatic 49 foo.o bletch.o null.o @.o garf.o .o .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o\n"; 43 x := BAD 50 44 51 &compare_output($answer,&get_logfile(1)); 45 define mktarget 46 target: x := $(x) 47 target: ; @echo "$(x)" 48 endef 49 50 x := GLOBAL 51 52 $(foreach x,FOREACH,$(eval $(value mktarget)))', 53 '', 54 'FOREACH'); 55 56 57 # TEST 2: Check some error conditions. 58 59 run_make_test(' 60 x = $(foreach ) 61 y = $x 62 63 all: ; @echo $y', 64 '', 65 "#MAKEFILE#:2: *** insufficient number of arguments (1) to function `foreach'. Stop.", 66 512); 67 68 run_make_test(' 69 x = $(foreach ) 70 y := $x 71 72 all: ; @echo $y', 73 '', 74 "#MAKEFILE#:2: *** insufficient number of arguments (1) to function `foreach'. Stop.", 75 512); 52 76 53 77 1; -
vendor/gnumake/current/tests/scripts/functions/origin
r153 r501 17 17 18 18 # Set an environment variable 19 $ ENV{MAKETEST} = 1;19 $extraENV{MAKETEST} = 1; 20 20 21 open(MAKEFILE,"> $makefile"); 22 23 print MAKEFILE <<EOF; 21 run_make_test(' 24 22 foo := bletch garf 25 auto_var = u def CC MAKETEST MAKE foo CFLAGS WHITE \@26 av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )23 auto_var = undefined CC MAKETEST MAKE foo CFLAGS WHITE @ 24 av = $(foreach var, $(auto_var), $(origin $(var)) ) 27 25 override WHITE := BLACK 28 26 all: auto 29 \t\@echo \$(origin undefined)30 \t\@echo \$(origin CC)31 \t\@echo \$(origin MAKETEST)32 \t\@echo \$(origin MAKE)33 \t\@echo \$(origin foo)34 \t\@echo \$(origin CFLAGS)35 \t\@echo \$(origin WHITE)36 \t\@echo \$(origin \@)27 @echo $(origin undefined) 28 @echo $(origin CC) 29 @echo $(origin MAKETEST) 30 @echo $(origin MAKE) 31 @echo $(origin foo) 32 @echo $(origin CFLAGS) 33 @echo $(origin WHITE) 34 @echo $(origin @) 37 35 auto : 38 \t\@echo \$(av) 39 EOF 40 41 close(MAKEFILE); 42 43 &run_make_with_options($makefile, 44 "-e WHITE=WHITE CFLAGS=", 45 &get_logfile); 46 47 # Create the answer to what should be produced by this Makefile 48 $answer = "undefined default environment default file command line override automatic 36 @echo $(av)', 37 '-e WHITE=WHITE CFLAGS=', 38 'undefined default environment default file command line override automatic 49 39 undefined 50 40 default … … 54 44 command line 55 45 override 56 automatic \n";46 automatic'); 57 47 58 59 &compare_output($answer,&get_logfile(1));48 # Reset an environment variable 49 delete $extraENV{MAKETEST}; 60 50 61 51 1; -
vendor/gnumake/current/tests/scripts/functions/realpath
r283 r501 21 21 endif 22 22 23 ifneq ($(realpath ///),/)24 $(error )25 endif26 27 23 ifneq ($(realpath /.),/) 28 $(error )29 endif30 31 ifneq ($(realpath ///.),/)32 24 $(error ) 33 25 endif … … 42 34 43 35 ifneq ($(realpath /..),/) 44 $(error )45 endif46 47 ifneq ($(realpath ///..),/)48 36 $(error ) 49 37 endif … … 64 52 all: ; @: 65 53 ', 66 '', 67 ''); 54 '', 55 ''); 56 57 # On Windows platforms, "//" means something special. So, don't do these 58 # tests there. 59 60 if ($port_type ne 'W32') { 61 run_make_test(' 62 ifneq ($(realpath ///),/) 63 $(error ) 64 endif 65 66 ifneq ($(realpath ///.),/) 67 $(error ) 68 endif 69 70 ifneq ($(realpath ///..),/) 71 $(error ) 72 endif 73 74 .PHONY: all 75 all: ; @:', 76 '', 77 ''); 78 } 68 79 69 80 -
vendor/gnumake/current/tests/scripts/functions/warning
r53 r501 1 # -*-Perl-*- 2 1 3 $description = "\ 2 4 The following test creates a makefile to test the warning function."; -
vendor/gnumake/current/tests/scripts/functions/wildcard
r284 r501 14 14 the '*' wildcard as in the first test"; 15 15 16 if ($vos)17 {18 $delete_command = "delete_file -no_ask";19 }20 else21 {22 $delete_command = "rm";23 }24 25 26 16 open(MAKEFILE,"> $makefile"); 27 17 … … 30 20 print MAKEFILE <<EOM; 31 21 .PHONY: print1 print2 clean 32 print1: ;\@echo \$( wildcard example.*)22 print1: ;\@echo \$(sort \$(wildcard example.*)) 33 23 print2: 34 \t\@echo \$( wildcard example.?)35 \t\@echo \$( wildcard example.[a-z0-9])36 \t\@echo \$( wildcard example.[!A-Za-z_\\!])24 \t\@echo \$(sort \$(wildcard example.?)) 25 \t\@echo \$(sort \$(wildcard example.[a-z0-9])) 26 \t\@echo \$(sort \$(wildcard example.[!A-Za-z_\\!])) 37 27 clean: 38 \t$delete_command \$( wildcard example.*)28 \t$delete_command \$(sort \$(wildcard example.*)) 39 29 EOM 40 30 -
vendor/gnumake/current/tests/scripts/functions/word
r284 r501 47 47 # Test error conditions 48 48 49 $makefile2 = &get_tmpfile; 50 51 open(MAKEFILE, "> $makefile2"); 52 print MAKEFILE <<'EOF'; 53 FOO = foo bar biz baz 49 run_make_test('FOO = foo bar biz baz 54 50 55 51 word-e1: ; @echo $(word ,$(FOO)) … … 59 55 wordlist-e1: ; @echo $(wordlist ,,$(FOO)) 60 56 wordlist-e2: ; @echo $(wordlist abc ,,$(FOO)) 61 wordlist-e3: ; @echo $(wordlist 1, 12a ,$(FOO)) 57 wordlist-e3: ; @echo $(wordlist 1, 12a ,$(FOO))', 58 'word-e1', 59 "#MAKEFILE#:3: *** non-numeric first argument to `word' function: ''. Stop.", 60 512); 62 61 63 EOF 62 run_make_test(undef, 63 'word-e2', 64 "#MAKEFILE#:4: *** non-numeric first argument to `word' function: 'abc '. Stop.", 65 512); 64 66 65 close(MAKEFILE); 67 run_make_test(undef, 68 'word-e3', 69 "#MAKEFILE#:5: *** non-numeric first argument to `word' function: '1a'. Stop.", 70 512); 66 71 67 &run_make_with_options($makefile2, 'word-e1', &get_logfile, 512); 68 $answer = "$makefile2:3: *** non-numeric first argument to `word' function: ''. Stop.\n"; 69 &compare_output($answer, &get_logfile(1)); 72 run_make_test(undef, 73 'wordlist-e1', 74 "#MAKEFILE#:7: *** non-numeric first argument to `wordlist' function: ''. Stop.", 75 512); 70 76 71 &run_make_with_options($makefile2, 'word-e2', &get_logfile, 512); 72 $answer = "$makefile2:4: *** non-numeric first argument to `word' function: 'abc '. Stop.\n"; 73 &compare_output($answer, &get_logfile(1)); 77 run_make_test(undef, 78 'wordlist-e2', 79 "#MAKEFILE#:8: *** non-numeric first argument to `wordlist' function: 'abc '. Stop.", 80 512); 74 81 75 &run_make_with_options($makefile2, 'word-e3', &get_logfile, 512); 76 $answer = "$makefile2:5: *** non-numeric first argument to `word' function: '1a'. Stop.\n"; 77 &compare_output($answer, &get_logfile(1)); 82 run_make_test(undef, 83 'wordlist-e3', 84 "#MAKEFILE#:9: *** non-numeric second argument to `wordlist' function: ' 12a '. Stop.", 85 512); 78 86 79 &run_make_with_options($makefile2, 'wordlist-e1', &get_logfile, 512); 80 $answer = "$makefile2:7: *** non-numeric first argument to `wordlist' function: ''. Stop.\n"; 81 &compare_output($answer, &get_logfile(1)); 87 # Test error conditions again, but this time in a variable reference 82 88 83 &run_make_with_options($makefile2, 'wordlist-e2', &get_logfile, 512); 84 $answer = "$makefile2:8: *** non-numeric first argument to `wordlist' function: 'abc '. Stop.\n"; 85 &compare_output($answer, &get_logfile(1)); 89 run_make_test('FOO = foo bar biz baz 86 90 87 &run_make_with_options($makefile2, 'wordlist-e3', &get_logfile, 512); 88 $answer = "$makefile2:9: *** non-numeric second argument to `wordlist' function: ' 12a '. Stop.\n"; 89 &compare_output($answer, &get_logfile(1)); 91 W = $(word $x,$(FOO)) 92 WL = $(wordlist $s,$e,$(FOO)) 93 94 word-e: ; @echo $(W) 95 wordlist-e: ; @echo $(WL)', 96 'word-e x=', 97 "#MAKEFILE#:3: *** non-numeric first argument to `word' function: ''. Stop.", 98 512); 99 100 run_make_test(undef, 101 'word-e x=abc', 102 "#MAKEFILE#:3: *** non-numeric first argument to `word' function: 'abc'. Stop.", 103 512); 104 105 run_make_test(undef, 106 'word-e x=0', 107 "#MAKEFILE#:3: *** first argument to `word' function must be greater than 0. Stop.", 108 512); 109 110 run_make_test(undef, 111 'wordlist-e s= e=', 112 "#MAKEFILE#:4: *** non-numeric first argument to `wordlist' function: ''. Stop.", 113 512); 114 115 run_make_test(undef, 116 'wordlist-e s=abc e=', 117 "#MAKEFILE#:4: *** non-numeric first argument to `wordlist' function: 'abc'. Stop.", 118 512); 119 120 run_make_test(undef, 121 'wordlist-e s=4 e=12a', 122 "#MAKEFILE#:4: *** non-numeric second argument to `wordlist' function: '12a'. Stop.", 123 512); 124 125 run_make_test(undef, 126 'wordlist-e s=0 e=12', 127 "#MAKEFILE#:4: *** invalid first argument to `wordlist' function: `0'. Stop.", 128 512); 90 129 91 130 -
vendor/gnumake/current/tests/scripts/misc/general3
r53 r501 6 6 break."; 7 7 8 $makefile2 = &get_tmpfile; 9 10 open(MAKEFILE,"> $makefile"); 11 12 # The contents of the Makefile ... 13 14 print MAKEFILE <<EOF; 8 run_make_test(" 15 9 # We want to allow both empty commands _and_ commands that resolve to empty. 16 10 EMPTY = … … 32 26 \$(STR) 33 27 34 \$(STR) \$(TAB) 35 36 EOF 37 38 close(MAKEFILE); 39 40 &run_make_with_options($makefile,"",&get_logfile); 41 $answer = "$make_name: Nothing to be done for `all'.\n"; 42 &compare_output($answer,&get_logfile(1)); 43 28 \$(STR) \$(TAB)", 29 '', "#MAKE#: Nothing to be done for `all'."); 44 30 45 31 # TEST 2 46 32 47 33 # Make sure files without trailing newlines are handled properly. 34 # Have to use the old style invocation to test this. 35 36 $makefile2 = &get_tmpfile; 48 37 49 38 open(MAKEFILE, "> $makefile2"); … … 55 44 &compare_output($answer,&get_logfile(1)); 56 45 46 # TEST 3 47 48 # Check semicolons in variable references 49 50 run_make_test(' 51 $(if true,$(info true; true)) 52 all: ; @: 53 ', 54 '', 'true; true'); 55 56 # TEST 4 57 58 # Check that backslashes in command scripts are handled according to POSIX. 59 # Checks Savannah bug # 1332. 60 61 # Test the fastpath / no quotes 62 run_make_test(' 63 all: 64 @echo foo\ 65 bar 66 @echo foo\ 67 bar 68 @echo foo\ 69 bar 70 @echo foo\ 71 bar 72 @echo foo \ 73 bar 74 @echo foo \ 75 bar 76 @echo foo \ 77 bar 78 @echo foo \ 79 bar 80 ', 81 '', 'foobar 82 foobar 83 foo bar 84 foo bar 85 foo bar 86 foo bar 87 foo bar 88 foo bar'); 89 90 # Test the fastpath / single quotes 91 run_make_test(" 92 all: 93 \@echo 'foo\\ 94 bar' 95 \@echo 'foo\\ 96 bar' 97 \@echo 'foo\\ 98 bar' 99 \@echo 'foo\\ 100 bar' 101 \@echo 'foo \\ 102 bar' 103 \@echo 'foo \\ 104 bar' 105 \@echo 'foo \\ 106 bar' 107 \@echo 'foo \\ 108 bar' 109 ", 110 '', 'foo\ 111 bar 112 foo\ 113 bar 114 foo\ 115 bar 116 foo\ 117 bar 118 foo \ 119 bar 120 foo \ 121 bar 122 foo \ 123 bar 124 foo \ 125 bar'); 126 127 # Test the fastpath / double quotes 128 run_make_test(' 129 all: 130 @echo "foo\ 131 bar" 132 @echo "foo\ 133 bar" 134 @echo "foo\ 135 bar" 136 @echo "foo\ 137 bar" 138 @echo "foo \ 139 bar" 140 @echo "foo \ 141 bar" 142 @echo "foo \ 143 bar" 144 @echo "foo \ 145 bar" 146 ', 147 '', 'foobar 148 foobar 149 foo bar 150 foo bar 151 foo bar 152 foo bar 153 foo bar 154 foo bar'); 155 156 # Test the slow path / no quotes 157 run_make_test(' 158 all: 159 @echo hi; echo foo\ 160 bar 161 @echo hi; echo foo\ 162 bar 163 @echo hi; echo foo\ 164 bar 165 @echo hi; echo foo\ 166 bar 167 @echo hi; echo foo \ 168 bar 169 @echo hi; echo foo \ 170 bar 171 @echo hi; echo foo \ 172 bar 173 @echo hi; echo foo \ 174 bar 175 ', 176 '', 'hi 177 foobar 178 hi 179 foobar 180 hi 181 foo bar 182 hi 183 foo bar 184 hi 185 foo bar 186 hi 187 foo bar 188 hi 189 foo bar 190 hi 191 foo bar'); 192 193 # Test the slow path / no quotes. This time we put the slow path 194 # determination _after_ the backslash-newline handling. 195 run_make_test(' 196 all: 197 @echo foo\ 198 bar; echo hi 199 @echo foo\ 200 bar; echo hi 201 @echo foo\ 202 bar; echo hi 203 @echo foo\ 204 bar; echo hi 205 @echo foo \ 206 bar; echo hi 207 @echo foo \ 208 bar; echo hi 209 @echo foo \ 210 bar; echo hi 211 @echo foo \ 212 bar; echo hi 213 ', 214 '', 'foobar 215 hi 216 foobar 217 hi 218 foo bar 219 hi 220 foo bar 221 hi 222 foo bar 223 hi 224 foo bar 225 hi 226 foo bar 227 hi 228 foo bar 229 hi'); 230 231 # Test the slow path / single quotes 232 run_make_test(" 233 all: 234 \@echo hi; echo 'foo\\ 235 bar' 236 \@echo hi; echo 'foo\\ 237 bar' 238 \@echo hi; echo 'foo\\ 239 bar' 240 \@echo hi; echo 'foo\\ 241 bar' 242 \@echo hi; echo 'foo \\ 243 bar' 244 \@echo hi; echo 'foo \\ 245 bar' 246 \@echo hi; echo 'foo \\ 247 bar' 248 \@echo hi; echo 'foo \\ 249 bar' 250 ", 251 '', 'hi 252 foo\ 253 bar 254 hi 255 foo\ 256 bar 257 hi 258 foo\ 259 bar 260 hi 261 foo\ 262 bar 263 hi 264 foo \ 265 bar 266 hi 267 foo \ 268 bar 269 hi 270 foo \ 271 bar 272 hi 273 foo \ 274 bar'); 275 276 # Test the slow path / double quotes 277 run_make_test(' 278 all: 279 @echo hi; echo "foo\ 280 bar" 281 @echo hi; echo "foo\ 282 bar" 283 @echo hi; echo "foo\ 284 bar" 285 @echo hi; echo "foo\ 286 bar" 287 @echo hi; echo "foo \ 288 bar" 289 @echo hi; echo "foo \ 290 bar" 291 @echo hi; echo "foo \ 292 bar" 293 @echo hi; echo "foo \ 294 bar" 295 ', 296 '', 'hi 297 foobar 298 hi 299 foobar 300 hi 301 foo bar 302 hi 303 foo bar 304 hi 305 foo bar 306 hi 307 foo bar 308 hi 309 foo bar 310 hi 311 foo bar'); 57 312 58 313 1; -
vendor/gnumake/current/tests/scripts/misc/general4
r284 r501 6 6 break."; 7 7 8 open(MAKEFILE,"> $makefile"); 9 print MAKEFILE <<'EOF'; 8 run_make_test(' 10 9 # Make sure that subdirectories built as prerequisites are actually handled 11 10 # properly. … … 17 16 dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b 18 17 19 dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@ 20 EOF 21 close(MAKEFILE); 22 23 &run_make_with_options($makefile,"",&get_logfile); 24 $answer = "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n"; 25 &compare_output($answer,&get_logfile(1)); 18 dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@', 19 '', "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n"); 26 20 27 21 # Test implicit rules … … 48 42 unlink('bar'); 49 43 44 45 # Test implicit rules with '$' in the name (see se_implicit) 46 47 run_make_test(q! 48 %.foo : baz$$bar ; @echo 'done $<' 49 %.foo : bar$$baz ; @echo 'done $<' 50 test.foo: 51 baz$$bar bar$$baz: ; @echo '$@' 52 !, 53 '', 54 "baz\$bar\ndone baz\$bar"); 55 56 57 # Test implicit rules with '$' in the name (see se_implicit) 58 # Use the '$' in the pattern. 59 60 run_make_test(q! 61 %.foo : %$$bar ; @echo 'done $<' 62 test.foo: 63 test$$bar: ; @echo '$@' 64 !, 65 '', 66 "test\$bar\ndone test\$bar"); 67 68 # Make sure that subdirectories built as prerequisites are actually handled 69 # properly... this time with '$' 70 71 run_make_test(q! 72 73 all: dir/subdir/file.$$a 74 75 dir/subdir: ; @echo mkdir -p '$@' 76 77 dir/subdir/file.$$b: dir/subdir ; @echo touch '$@' 78 79 dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@' 80 !, 81 '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n"); 82 50 83 1; -
vendor/gnumake/current/tests/scripts/options/dash-B
r284 r501 32 32 run_make_test(undef, '-B', 'cp bar.x foo'); 33 33 34 35 34 # Clean up 36 35 37 36 rmfiles('bar.x', 'foo'); 38 37 38 # Test -B with the re-exec feature: we don't want to re-exec forever 39 # Savannah bug # 7566 40 41 run_make_test(' 42 all: ; @: 43 $(info MAKE_RESTARTS=$(MAKE_RESTARTS)) 44 include foo.x 45 foo.x: ; @touch $@ 46 ', 47 '-B', 'MAKE_RESTARTS= 48 #MAKEFILE#:4: foo.x: No such file or directory 49 MAKE_RESTARTS=1'); 50 51 rmfiles('foo.x'); 52 53 # Test -B with the re-exec feature: we DO want -B in the "normal" part of the 54 # makefile. 55 56 &touch('blah.x'); 57 58 run_make_test(' 59 all: blah.x ; @echo $@ 60 $(info MAKE_RESTARTS=$(MAKE_RESTARTS)) 61 include foo.x 62 foo.x: ; @touch $@ 63 blah.x: ; @echo $@ 64 ', 65 '-B', 'MAKE_RESTARTS= 66 #MAKEFILE#:4: foo.x: No such file or directory 67 MAKE_RESTARTS=1 68 blah.x 69 all'); 70 71 rmfiles('foo.x', 'blah.x'); 72 39 73 1; -
vendor/gnumake/current/tests/scripts/options/dash-I
r53 r501 1 # -*-perl-*- 2 1 3 $description ="The following test creates a makefile to test the -I option."; 2 4 -
vendor/gnumake/current/tests/scripts/options/dash-e
r53 r501 5 5 $details = ""; 6 6 7 $ ENV{GOOGLE} = 'boggle';7 $extraENV{GOOGLE} = 'boggle'; 8 8 9 9 open(MAKEFILE,"> $makefile"); -
vendor/gnumake/current/tests/scripts/options/symlinks
r283 r501 6 6 7 7 # Only run these tests if the system sypports symlinks 8 if (eval { symlink("",""); 1 }) { 8 9 # Apparently the Windows port of Perl reports that it does support symlinks 10 # (in that the symlink() function doesn't fail) but it really doesn't, so 11 # check for it explicitly. 12 13 if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) { 14 # This test is N/A 15 -1; 16 } else { 9 17 10 18 # Set up a symlink sym -> dep … … 43 51 44 52 rmfiles('targ', 'dep', 'sym', 'dep1'); 53 54 # Check handling when symlinks point to non-existent files. Without -L we 55 # should get an error: with -L we should use the timestamp of the symlink. 56 57 symlink("../$dirname/dep", 'sym'); 58 run_make_test('targ: sym ; @echo make $@ from $<', '', 59 "#MAKE#: *** No rule to make target `sym', needed by `targ'. Stop.", 512); 60 61 run_make_test('targ: sym ; @echo make $@ from $<', '-L', 62 'make targ from sym'); 63 64 65 rmfiles('targ', 'sym'); 66 67 1; 45 68 } 46 47 1; -
vendor/gnumake/current/tests/scripts/targets/FORCE
r284 r501 1 # -*-perl-*- 2 1 3 $description = "The following tests rules without Commands or Dependencies."; 2 4 3 5 $details = "If the rule ...\n"; 4 5 if ($vos)6 {7 $delete_command = "delete_file";8 }9 else10 {11 $delete_command = "rm";12 }13 6 14 7 open(MAKEFILE,"> $makefile"); -
vendor/gnumake/current/tests/scripts/targets/PHONY
r284 r501 1 # -*-perl-*- 2 1 3 $description = "The following tests the use of a PHONY target. It makes\n" 2 4 ."sure that the rules under a target get executed even if\n" … … 8 10 ."directory. Although this file exists, the rule under the target\n" 9 11 ."clean should still execute because of it's phony status."; 10 11 if ($vos)12 {13 $delete_command = "delete_file";14 }15 else16 {17 $delete_command = "rm";18 }19 12 20 13 $example = "EXAMPLE_FILE"; -
vendor/gnumake/current/tests/scripts/targets/SILENT
r284 r501 1 # -*-perl-*- 2 1 3 $description = "The following tests the special target .SILENT. By simply\n" 2 4 ."mentioning this as a target, it tells make not to print\n" … … 5 7 $details = "This test is the same as the clean test except that it should\n" 6 8 ."not echo its command before deleting the specified file.\n"; 7 8 if ($vos)9 {10 $delete_command = "delete_file";11 }12 else13 {14 $delete_command = "rm";15 }16 9 17 10 $example = "EXAMPLE_FILE"; -
vendor/gnumake/current/tests/scripts/variables/SHELL
r283 r501 5 5 # Find the default value when SHELL is not set. On UNIX it will be /bin/sh, 6 6 # but on other platforms who knows? 7 $oshell = $ENV{SHELL};7 resetENV(); 8 8 delete $ENV{SHELL}; 9 $mshell = `echo 'all:;\@echo \$(SHELL)' | $make_ name-f-`;9 $mshell = `echo 'all:;\@echo \$(SHELL)' | $make_path -f-`; 10 10 chop $mshell; 11 11 12 12 # According to POSIX, the value of SHELL in the environment has no impact on 13 13 # the value in the makefile. 14 # Note %extraENV takes precedence over the default value for the shell. 14 15 15 $ ENV{SHELL} = '/dev/null';16 $extraENV{SHELL} = '/dev/null'; 16 17 run_make_test('all:;@echo "$(SHELL)"', '', $mshell); 17 18 … … 19 20 # exported to the subshell! I wanted to set SHELL to be $^X (perl) in the 20 21 # makefile, but make runs $(SHELL) -c 'commandline' and that doesn't work at 21 # all when $(SHELL) is perl :-/. So, we just add an extra initial / and hope22 # for the best on non-UNIX platforms :-/.22 # all when $(SHELL) is perl :-/. So, we just add an extra initial /./ which 23 # works well on UNIX and seems to work OK on at least some non-UNIX systems. 23 24 24 $ ENV{SHELL} = $mshell;25 $extraENV{SHELL} = $mshell; 25 26 26 run_make_test("SHELL := / $mshell\n".'27 run_make_test("SHELL := /./$mshell\n".' 27 28 all:;@echo "$(SHELL) $$SHELL" 28 ', '', "/ $mshell $mshell");29 ', '', "/./$mshell $mshell"); 29 30 30 31 # As a GNU make extension, if make's SHELL variable is explicitly exported, 31 32 # then we really _DO_ export it. 32 33 33 run_make_test("export SHELL := /$mshell\n".' 34 $extraENV{SHELL} = $mshell; 35 36 run_make_test("export SHELL := /./$mshell\n".' 34 37 all:;@echo "$(SHELL) $$SHELL" 35 ', '', "/ $mshell/$mshell");38 ', '', "/./$mshell /./$mshell"); 36 39 37 40 … … 39 42 # variable. 40 43 41 run_make_test("all: SHELL := /$mshell\n".' 44 $extraENV{SHELL} = $mshell; 45 46 run_make_test("all: SHELL := /./$mshell\n".' 42 47 all:;@echo "$(SHELL) $$SHELL" 43 ', '', "/ $mshell $mshell");48 ', '', "/./$mshell $mshell"); 44 49 45 run_make_test("all: export SHELL := /$mshell\n".' 50 $extraENV{SHELL} = $mshell; 51 52 run_make_test("all: export SHELL := /./$mshell\n".' 46 53 all:;@echo "$(SHELL) $$SHELL" 47 ', '', "/ $mshell $mshell");54 ', '', "/./$mshell $mshell"); 48 55 49 56 1; -
vendor/gnumake/current/tests/scripts/variables/automatic
r284 r501 28 28 close(MAKEFILE); 29 29 30 # TEST # 1-- simple test30 # TEST #0 -- simple test 31 31 # ------- 32 32 … … 47 47 unlink(qw(foo.x bar.y baz.z)); 48 48 49 # TEST # 2-- test the SysV emulation of $$@ etc.49 # TEST #1 -- test the SysV emulation of $$@ etc. 50 50 # ------- 51 51 … … 55 55 print MAKEFILE "dir = $dir\n"; 56 56 print MAKEFILE <<'EOF'; 57 .SECONDEXPANSION: 57 58 .SUFFIXES: 58 59 .DEFAULT: ; @echo '$@' … … 79 80 &compare_output($answer, &get_logfile(1)); 80 81 81 # TEST # 3-- test for Savannah bug #12320.82 # TEST #2 -- test for Savannah bug #12320. 82 83 # 83 84 run_make_test(' … … 87 88 @echo $* 88 89 89 mbr.src: ; @: 90 mbr.src: ; @:', 91 '', 92 'mbr'); 90 93 91 ', 92 '', 93 'mbr 94 '); 94 # TEST #3 -- test for Savannah bug #8154 95 # Make sure that nonexistent prerequisites are listed in $?, since they are 96 # considered reasons for the target to be rebuilt. 97 # 98 # This was undone due to Savannah bug #16002. We'll re-do it in the next 99 # release. See Savannah bug #16051. 100 101 #touch('foo'); 102 # 103 #run_make_test(' 104 #foo: bar ; @echo "\$$? = $?" 105 #bar: ;', 106 # '', 107 # '$? = bar'); 108 # 109 #unlink('foo'); 95 110 96 111 1;
Note:
See TracChangeset
for help on using the changeset viewer.