Changeset 503 in kBuild for trunk/src/gmake/tests/scripts/features
- Timestamp:
- Sep 15, 2006 5:09:38 AM (18 years ago)
- Location:
- trunk/src/gmake/tests/scripts/features
- Files:
-
- 16 edited
-
default_names (modified) (1 diff)
-
double_colon (modified) (1 diff)
-
errors (modified) (6 diffs)
-
escape (modified) (2 diffs)
-
export (modified) (4 diffs)
-
include (modified) (2 diffs)
-
order_only (modified) (8 diffs)
-
parallelism (modified) (2 diffs)
-
patspecific_vars (modified) (1 diff)
-
patternrules (modified) (2 diffs)
-
reinvoke (modified) (2 diffs)
-
se_explicit (modified) (3 diffs)
-
se_implicit (modified) (8 diffs)
-
se_statpat (modified) (4 diffs)
-
statipattrules (modified) (2 diffs)
-
targetvars (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/tests/scripts/features/default_names
r53 r503 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"; -
trunk/src/gmake/tests/scripts/features/double_colon
r53 r503 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; -
trunk/src/gmake/tests/scripts/features/errors
r281 r503 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); -
trunk/src/gmake/tests/scripts/features/escape
r53 r503 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. -
trunk/src/gmake/tests/scripts/features/export
r53 r503 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. -
trunk/src/gmake/tests/scripts/features/include
r285 r503 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; -
trunk/src/gmake/tests/scripts/features/order_only
r285 r503 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 -
trunk/src/gmake/tests/scripts/features/parallelism
r285 r503 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 <matz@suse.de> 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; -
trunk/src/gmake/tests/scripts/features/patspecific_vars
r285 r503 68 68 69 69 /bar: 70 @ test "$(foo)" = "$$foo"71 ', '', ' ');70 @echo $(foo) $$foo 71 ', '', 'foo foo'); 72 72 73 73 -
trunk/src/gmake/tests/scripts/features/patternrules
r282 r503 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; -
trunk/src/gmake/tests/scripts/features/reinvoke
r53 r503 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. -
trunk/src/gmake/tests/scripts/features/se_explicit
r282 r503 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 -
trunk/src/gmake/tests/scripts/features/se_implicit
r282 r503 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 -
trunk/src/gmake/tests/scripts/features/se_statpat
r282 r503 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 \'$*\' -
trunk/src/gmake/tests/scripts/features/statipattrules
r285 r503 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; -
trunk/src/gmake/tests/scripts/features/targetvars
r53 r503 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;
Note:
See TracChangeset
for help on using the changeset viewer.

