Changeset 284 in kBuild for branches/GNU/src/gmake/tests
- Timestamp:
- May 16, 2005 4:54:08 PM (20 years ago)
- Location:
- branches/GNU/src/gmake/tests/scripts
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gmake/tests/scripts/features/include
r53 r284 3 3 $description = "Test various forms of the GNU make `include' command."; 4 4 5 $details = "Test include, -include, sinclude and various regressions involving them. 5 $details = "\ 6 Test include, -include, sinclude and various regressions involving them. 6 7 Test extra whitespace at the end of the include, multiple -includes and 7 8 sincludes (should not give an error) and make sure that errors are reported … … 16 17 print MAKEFILE <<EOF; 17 18 \#Extra space at the end of the following file name 18 include $makefile2 19 include $makefile2 19 20 all: ; \@echo There should be no errors for this makefile. 20 21 … … 47 48 &compare_output($answer, &get_logfile(1)); 48 49 50 $makefile = undef; 51 49 52 # Try to build the "error" target; this will fail since we don't know 50 53 # how to create makeit.mk, but we should also get a message (even though … … 52 55 # see one during the makefile run phase). 53 56 54 # The fix to this caused more problems than the error, so I removed it. 55 # pds -- 22 Jan 2000 57 run_make_test 58 (' 59 -include foo.mk 60 error: foo.mk ; @echo $@ 61 ', 62 '', 63 "#MAKE#: *** No rule to make target `foo.mk', needed by `error'. Stop.\n", 64 512 65 ); 56 66 57 #&run_make_with_options($makefile, "error", &get_logfile, 512); 58 #$answer = "$make_name: *** No rule to make target `makeit.mk', needed by `error'.\n"; 59 #&compare_output($answer, &get_logfile(1)); 67 # Make sure that target-specific variables don't impact things. This could 68 # happen because a file record is created when a target-specific variable is 69 # set. 70 71 run_make_test 72 (' 73 bar.mk: foo := baz 74 -include bar.mk 75 hello: ; @echo hello 76 ', 77 '', 78 "hello\n" 79 ); 80 81 # Test inheritance of dontcare flag when rebuilding makefiles. 82 # 83 run_make_test(' 84 .PHONY: all 85 all: ; @: 86 87 -include foo 88 89 foo: bar; @: 90 ', '', ''); 60 91 61 92 1; -
branches/GNU/src/gmake/tests/scripts/features/order_only
r153 r284 145 145 unlink(qw(foo.w foo.x baz)); 146 146 147 # TEST #9 -- make sure that $< is set correctly in the face of order-only 148 # prerequisites in pattern rules. 149 150 run_make_test(' 151 %r: | baz ; @echo $< $^ $| 152 bar: foo 153 foo:;@: 154 baz:;@: 155 ', '', "foo foo baz\n"); 156 157 147 158 1; -
branches/GNU/src/gmake/tests/scripts/features/parallelism
r53 r284 27 27 } 28 28 29 open(MAKEFILE,"> $makefile");30 29 31 print MAKEFILE <<"EOF"; 30 run_make_test(" 32 31 all : def_1 def_2 def_3 33 32 def_1 : ; \@echo ONE; $sleep_command 3 ; echo TWO 34 33 def_2 : ; \@$sleep_command 2 ; echo THREE 35 def_3 : ; \@$sleep_command 1 ; echo FOUR 36 EOF 37 38 close(MAKEFILE); 39 40 &run_make_with_options($makefile, "-j 4", &get_logfile); 41 $answer = "ONE\nFOUR\nTHREE\nTWO\n"; 42 &compare_output($answer, &get_logfile(1)); 43 34 def_3 : ; \@$sleep_command 1 ; echo FOUR", 35 '-j4', "ONE\nFOUR\nTHREE\nTWO"); 44 36 45 37 # Test parallelism with included files. Here we sleep/echo while 46 38 # building the included files, to test that they are being built in 47 39 # parallel. 48 49 $makefile2 = &get_tmpfile; 50 51 open(MAKEFILE,"> $makefile2"); 52 53 print MAKEFILE <<"EOF"; 40 run_make_test(" 54 41 all: 1 2; \@echo success 55 56 42 -include 1.inc 2.inc 57 58 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo "1: ; \@echo ONE; $sleep_command 2; echo TWO" > \$\@ 59 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@ 60 EOF 61 62 close(MAKEFILE); 63 64 &run_make_with_options("$makefile2", "-j 4", &get_logfile); 65 $answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"; 66 &compare_output($answer, &get_logfile(1)); 43 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@ 44 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@", 45 "-j4", 46 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"); 67 47 68 48 unlink('1.inc', '2.inc'); … … 71 51 # Test parallelism with included files--this time recurse first and make 72 52 # sure the jobserver works. 73 74 $makefile3 = &get_tmpfile; 75 76 open(MAKEFILE,"> $makefile3"); 77 78 print MAKEFILE <<"EOF"; 79 recurse: ; \@\$(MAKE) --no-print-directory -f $makefile3 INC=yes all 80 53 run_make_test(" 54 recurse: ; \@\$(MAKE) --no-print-directory -f #MAKEFILE# INC=yes all 81 55 all: 1 2; \@echo success 82 56 … … 86 60 endif 87 61 88 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo "1: ; \@echo ONE; $sleep_command 2; echo TWO" > \$\@ 89 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@ 90 EOF 91 92 close(MAKEFILE); 93 94 &run_make_with_options("$makefile3", "-j 4", &get_logfile); 95 $answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"; 96 &compare_output($answer, &get_logfile(1)); 62 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@ 63 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@", 64 "-j4", 65 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"); 97 66 98 67 unlink('1.inc', '2.inc'); 99 68 69 # Grant Taylor reports a problem where tokens can be lost (not written back 70 # to the pipe when they should be): this happened when there is a $(shell ...) 71 # function in an exported recursive variable. I added some code to check 72 # for this situation and print a message if it occurred. This test used 73 # to trigger this code when I added it but no longer does after the fix. 74 75 run_make_test(" 76 export HI = \$(shell \$(\$\@.CMD)) 77 first.CMD = echo hi 78 second.CMD = $sleep_command 4; echo hi 79 80 .PHONY: all first second 81 all: first second 82 83 first second: ; \@echo \$\@; $sleep_command 1; echo \$\@", 84 '-j2', "first\nfirst\nsecond\nsecond"); 85 100 86 1; -
branches/GNU/src/gmake/tests/scripts/features/patspecific_vars
r53 r284 62 62 &compare_output($answer,&get_logfile(1)); 63 63 64 # TEST #5 -- test pattern-specific exported variables 65 # 66 run_make_test(' 67 /%: export foo := foo 68 69 /bar: 70 @test "$(foo)" = "$$foo" 71 ', '', ''); 72 73 74 # TEST #6 -- test expansion of pattern-specific simple variables 75 # 76 run_make_test(' 77 .PHONY: all 78 79 all: inherit := good $$t 80 all: bar baz 81 82 b%: pattern := good $$t 83 84 global := orginal $$t 85 86 87 # normal target 88 # 89 ifdef rec 90 bar: a = global: $(global) pattern: $(pattern) inherit: $(inherit) 91 else 92 bar: a := global: $(global) pattern: $(pattern) inherit: $(inherit) 93 endif 94 95 bar: ; @echo \'normal: $a;\' 96 97 98 # pattern target 99 # 100 ifdef rec 101 %z: a = global: $(global) pattern: $(pattern) inherit: $(inherit) 102 else 103 %z: a := global: $(global) pattern: $(pattern) inherit: $(inherit) 104 endif 105 106 %z: ; @echo \'pattrn: $a;\' 107 108 109 global := new $$t 110 ', 111 '', 112 'normal: global: orginal $t pattern: inherit: ; 113 pattrn: global: orginal $t pattern: inherit: ;'); 114 115 116 # TEST #7 -- test expansion of pattern-specific recursive variables 117 # 118 run_make_test(undef, # reuse previous makefile 119 'rec=1', 120 'normal: global: new $t pattern: good $t inherit: good $t; 121 pattrn: global: new $t pattern: good $t inherit: good $t;'); 122 123 64 124 1; -
branches/GNU/src/gmake/tests/scripts/features/recursion
r53 r284 1 1 # -*-perl-*- 2 $description = "T he following test creates a makefile to ...\n";2 $description = "Test recursion."; 3 3 4 4 $details = "DETAILS"; 5 5 6 open(MAKEFILE,"> $makefile"); 6 # Test some basic recursion. 7 run_make_test(' 8 all: 9 $(MAKE) -f #MAKEFILE# foo 10 foo: 11 @echo $(MAKE) 12 @echo MAKELEVEL = $(MAKELEVEL) 13 $(MAKE) -f #MAKEFILE# last 14 last: 15 @echo $(MAKE) 16 @echo MAKELEVEL = $(MAKELEVEL) 17 @echo THE END 18 ', 19 ('CFLAGS=-O -w' . ($parallel_jobs ? '-j 2' : '')), 20 ($vos 21 ? "#MAKE#: Entering directory `#PWD#' 22 make 'CFLAGS=-O' -f #MAKEFILE# foo 23 make CFLAGS=-O 24 MAKELEVEL = 0 25 make 'CFLAGS=-O' -f #MAKEFILE# last 26 make CFLAGS=-O 27 MAKELEVEL = 0 28 THE END 29 #MAKE#: Leaving directory `#PWD#'" 30 : "#MAKE#: Entering directory `#PWD#' 31 #MAKEPATH# -f #MAKEFILE# foo 32 #MAKE#[1]: Entering directory `#PWD#' 33 #MAKEPATH# 34 MAKELEVEL = 1 35 #MAKEPATH# -f #MAKEFILE# last 36 #MAKE#[2]: Entering directory `#PWD#' 37 #MAKEPATH# 38 MAKELEVEL = 2 39 THE END 40 #MAKE#[2]: Leaving directory `#PWD#' 41 #MAKE#[1]: Leaving directory `#PWD#' 42 #MAKE#: Leaving directory `#PWD#'")); 7 43 8 # The Contents of the MAKEFILE ...9 44 10 print MAKEFILE "all: \n" 11 ."\t\$(MAKE) -f $makefile foo \n" 12 ."foo: \n" 13 ."\t\@echo \$(MAKE) \n" 14 ."\t\@echo MAKELEVEL = \$(MAKELEVEL)\n" 15 ."\t\$(MAKE) -f $makefile last \n" 16 ."last: \n" 17 ."\t\@echo \$(MAKE) \n" 18 ."\t\@echo MAKELEVEL = \$(MAKELEVEL) \n" 19 ."\t\@echo THE END\n"; 20 21 # END of Contents of MAKEFILE 22 23 close(MAKEFILE); 24 25 if ($vos) 26 { 27 $answer = "$make_name: Entering directory \`$pwd\'\n" 28 ."make 'CFLAGS=-O' -f $makefile foo \n" 29 ."make CFLAGS=-O\n" 30 ."MAKELEVEL = 0\n" 31 ."make 'CFLAGS=-O' -f $makefile last \n" 32 ."make CFLAGS=-O\n" 33 ."MAKELEVEL = 0\n" 34 ."THE END\n" 35 ."$make_name: Leaving directory `$pwd'\n"; 36 } 37 else 38 { 39 $answer = "$make_name: Entering directory `$pwd'\n" 40 ."$mkpath -f $makefile foo \n" 41 ."${make_name}[1]: Entering directory `$pwd'\n" 42 ."$mkpath\n" 43 ."MAKELEVEL = 1\n" 44 ."$mkpath -f $makefile last \n" 45 ."${make_name}[2]: Entering directory `$pwd'\n" 46 ."$mkpath\n" 47 ."MAKELEVEL = 2\n" 48 ."THE END\n" 49 ."${make_name}[2]: Leaving directory `$pwd'\n" 50 ."${make_name}[1]: Leaving directory `$pwd'\n" 51 ."$make_name: Leaving directory `$pwd'\n"; 52 } 53 54 $mkoptions = "CFLAGS=-O -w"; 55 $mkoptions .= " -j 2" if ($parallel_jobs); 56 57 &run_make_with_options($makefile,$mkoptions,&get_logfile,0); 58 59 &compare_output($answer,&get_logfile(1)); 45 # Test command line overrides. 46 run_make_test(' 47 recur: all ; @$(MAKE) --no-print-directory -f #MAKEFILE# a=AA all 48 all: ; @echo "MAKEOVERRIDES = $(MAKEOVERRIDES)" 49 ', 50 'a=ZZ', 51 'MAKEOVERRIDES = a=ZZ 52 MAKEOVERRIDES = a=AA 53 '); 60 54 61 55 1; -
branches/GNU/src/gmake/tests/scripts/features/statipattrules
r53 r284 56 56 $makefile2 = &get_tmpfile; 57 57 open(MAKEFILE, "> $makefile2"); 58 print MAKEFILE "foo: foo%: % ; \@echo $@\n";58 print MAKEFILE "foo: foo%: % ; \@echo \$@\n"; 59 59 close(MAKEFILE); 60 60 61 &run_make_with_options($makefile2, '', &get_logfile , 512);62 $answer = " $makefile2:1: *** target `foo' leaves prerequisite pattern empty. Stop.\n";61 &run_make_with_options($makefile2, '', &get_logfile); 62 $answer = "foo\n"; 63 63 &compare_output($answer, &get_logfile(1)); 64 64 65 # TEST #5 -- bug #12180: core dump on a stat pattern rule with an empty 66 # prerequisite list. 67 # 68 run_make_test(' 69 foo.x bar.x: %.x : ; @echo $@ 70 71 ', 72 '', 73 'foo.x 74 '); 65 75 66 76 1; 67 68 69 70 71 72 -
branches/GNU/src/gmake/tests/scripts/functions/eval
r53 r284 135 135 delete $ENV{EVAR}; 136 136 137 138 # Clean out previous information to allow new run_make_test() interface. 139 # If we ever convert all the above to run_make_test() we can remove this line. 140 $makefile = undef; 141 142 # Test handling of backslashes in strings to be evaled. 143 144 run_make_test(' 145 define FOO 146 all: ; @echo hello \ 147 world 148 endef 149 $(eval $(FOO)) 150 ', '', 'hello world'); 151 152 run_make_test(' 153 define FOO 154 all: ; @echo he\llo 155 @echo world 156 endef 157 $(eval $(FOO)) 158 ', '', 'hello 159 world'); 160 161 162 # We don't allow new target/prerequisite relationships to be defined within a 163 # command script, because these are evaluated after snap_deps() and that 164 # causes lots of problems (like core dumps!) 165 # See Savannah bug # 12124. 166 167 run_make_test('deps: ; $(eval deps: foo)', '', 168 '#MAKEFILE#:1: *** prerequisites cannot be defined in command scripts. Stop.', 169 512); 170 137 171 1; -
branches/GNU/src/gmake/tests/scripts/functions/substitution
r53 r284 1 $description = "The following test creates a makefile to ..."; 1 # -*-perl-*- 2 3 $description = "Test the subst and patsubst functions"; 2 4 3 5 $details = ""; 4 6 5 open(MAKEFILE,"> $makefile"); 7 # Generic patsubst test: test both the function and variable form. 6 8 7 # The Contents of the MAKEFILE ... 9 run_make_test(' 10 foo := a.o b.o c.o 11 bar := $(foo:.o=.c) 12 bar2:= $(foo:%.o=%.c) 13 bar3:= $(patsubst %.c,%.o,x.c.c bar.c) 14 all:;@echo $(bar); echo $(bar2); echo $(bar3)', 15 '', 16 'a.c b.c c.c 17 a.c b.c c.c 18 x.c.o bar.o'); 8 19 9 print MAKEFILE "foo := a.o b.o c.o\n" 10 ."bar := \$(foo:.o=.c)\n" 11 ."bar2:= \$(foo:%.o=%.c)\n" 12 ."bar3:= \$(patsubst %.c,%.o,x.c.c bar.c)\n" 13 ."all:\n" 14 ."\t\@echo \$(bar)\n" 15 ."\t\@echo \$(bar2)\n" 16 ."\t\@echo \$(bar3)\n"; 20 # Patsubst without '%'--shouldn't match because the whole word has to match 21 # in patsubst. Based on a bug report by Markus Mauhart <[email protected]> 17 22 18 # END of Contents of MAKEFILE 23 run_make_test('all:;@echo $(patsubst Foo,Repl,FooFoo)', '', 'FooFoo'); 19 24 20 close(MAKEFILE); 25 # Variable subst where a pattern matches multiple times in a single word. 26 # Based on a bug report by Markus Mauhart <[email protected]> 21 27 22 &run_make_with_options($makefile,"",&get_logfile); 23 24 # Create the answer to what should be produced by this Makefile 25 $answer = "a.c b.c c.c\n" 26 ."a.c b.c c.c\n" 27 ."x.c.o bar.o\n"; 28 29 &compare_output($answer,&get_logfile(1)); 28 run_make_test(' 29 A := fooBARfooBARfoo 30 all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL'); 30 31 31 32 1; -
branches/GNU/src/gmake/tests/scripts/functions/wildcard
r53 r284 86 86 &run_make_with_options($makefile,"clean",&get_logfile); 87 87 88 &compare_output($answer,&get_logfile(1)); 89 90 if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) 91 { 88 if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) { 92 89 $test_passed = 0; 93 90 } 91 92 &compare_output($answer,&get_logfile(1)); 94 93 95 94 -
branches/GNU/src/gmake/tests/scripts/functions/word
r53 r284 1 1 # -*-perl-*- 2 $description = "Test the word, words, and wordlist functions.\n"; 2 $description = "\ 3 Test the word, words, wordlist, firstword, and lastword functions.\n"; 3 4 4 5 $details = "\ … … 88 89 &compare_output($answer, &get_logfile(1)); 89 90 91 92 # TEST #8 -- test $(firstword ) 93 # 94 run_make_test(' 95 void := 96 list := $(void) foo bar baz # 97 98 a := $(word 1,$(list)) 99 b := $(firstword $(list)) 100 101 .PHONY: all 102 103 all: 104 @test "$a" = "$b" && echo $a 105 ', 106 '', 107 'foo'); 108 109 110 # TEST #9 -- test $(lastword ) 111 # 112 run_make_test(' 113 void := 114 list := $(void) foo bar baz # 115 116 a := $(word $(words $(list)),$(list)) 117 b := $(lastword $(list)) 118 119 .PHONY: all 120 121 all: 122 @test "$a" = "$b" && echo $a 123 ', 124 '', 125 'baz'); 126 90 127 # This tells the test driver that the perl test script executed properly. 91 128 1; -
branches/GNU/src/gmake/tests/scripts/misc/general4
r53 r284 7 7 8 8 open(MAKEFILE,"> $makefile"); 9 10 # The contents of the Makefile ...11 12 9 print MAKEFILE <<'EOF'; 13 10 # Make sure that subdirectories built as prerequisites are actually handled … … 22 19 dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@ 23 20 EOF 24 25 21 close(MAKEFILE); 26 22 … … 29 25 &compare_output($answer,&get_logfile(1)); 30 26 27 # Test implicit rules 28 29 &touch('foo.c'); 30 run_make_test('foo: foo.o', 31 'CC="@echo cc" OUTPUT_OPTION=', 32 'cc -c foo.c 33 cc foo.o -o foo'); 34 unlink('foo.c'); 35 36 37 # Test other implicit rule searching 38 39 &touch('bar'); 40 run_make_test(' 41 test.foo: 42 %.foo : baz ; @echo done $< 43 %.foo : bar ; @echo done $< 44 fox: baz 45 ', 46 '', 47 'done bar'); 48 unlink('bar'); 49 31 50 1; -
branches/GNU/src/gmake/tests/scripts/options/dash-B
r53 r284 9 9 is built again."; 10 10 11 open(MAKEFILE,"> $makefile");11 &touch('bar.x'); 12 12 13 print MAKEFILE <<'EOF'; 13 run_make_test(' 14 14 .SUFFIXES: 15 15 … … 20 20 @echo cp $< $@ 21 21 @echo "" > $@ 22 EOF 22 ', 23 '', 'cp bar.x foo'); 23 24 24 close(MAKEFILE); 25 run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'."); 26 run_make_test(undef, '-B', 'cp bar.x foo'); 27 28 # Put the timestamp for foo into the future; it should still be remade. 29 30 utouch(1000, 'foo'); 31 run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'."); 32 run_make_test(undef, '-B', 'cp bar.x foo'); 25 33 26 34 27 &touch('bar.x'); 35 # Clean up 28 36 29 &run_make_with_options($makefile, '', &get_logfile); 30 $answer = "cp bar.x foo\n"; 31 &compare_output($answer, &get_logfile(1)); 32 33 &run_make_with_options($makefile, '', &get_logfile); 34 $answer = "$make_name: Nothing to be done for `all'.\n"; 35 &compare_output($answer, &get_logfile(1)); 36 37 &run_make_with_options($makefile, '-B', &get_logfile); 38 $answer = "cp bar.x foo\n"; 39 &compare_output($answer, &get_logfile(1)); 40 41 unlink('bar.x', 'foo') unless $keep; 37 rmfiles('bar.x', 'foo'); 42 38 43 39 1; -
branches/GNU/src/gmake/tests/scripts/options/dash-C
r53 r284 1 $description = "The following test creates a makefile to test the -C dir \n" 2 ."option in make. This option tells make to change to \n" 3 ."directory dir before reading the makefile."; 1 # -*-perl-*- 4 2 5 $details = "This test is similar to the clean test except that this test\n" 6 ."creates the file to delete in the work directory instead of\n" 7 ."the current directory. Make is called from another directory\n" 8 ."using the -C workdir option so that it can both find the \n" 9 ."makefile and the file to delete in the work directory. "; 3 $description = "Test the -C option to GNU make."; 10 4 11 $example = $workdir . $pathsep . "EXAMPLE_FILE"; 5 $details = "\ 6 This test is similar to the clean test except that this test creates the file 7 to delete in the work directory instead of the current directory. Make is 8 called from another directory using the -C workdir option so that it can both 9 find the makefile and the file to delete in the work directory."; 10 11 $example = $workdir . $pathsep . "EXAMPLE"; 12 12 13 13 open(MAKEFILE,"> $makefile"); 14 15 # The Contents of the MAKEFILE ... 16 17 print MAKEFILE "all: \n"; 18 print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n"; 19 print MAKEFILE "clean: \n"; 20 print MAKEFILE "\t$delete_command EXAMPLE_FILE\n"; 21 22 # END of Contents of MAKEFILE 23 14 print MAKEFILE <<EOF; 15 all: ; \@echo This makefile did not clean the dir ... good 16 clean: ; $delete_command EXAMPLE\$(ext) 17 EOF 24 18 close(MAKEFILE); 25 19 20 # TEST #1 21 # ------- 26 22 &touch($example); 27 23 … … 34 30 chdir $pwd; 35 31 32 if (-f $example) { 33 $test_passed = 0; 34 } 35 36 36 # Create the answer to what should be produced by this Makefile 37 37 $answer = "$make_name: Entering directory `$wpath'\n" 38 . "$delete_command EXAMPLE _FILE\n"38 . "$delete_command EXAMPLE\n" 39 39 . "$make_name: Leaving directory `$wpath'\n"; 40 40 41 41 &compare_output($answer,&get_logfile(1)); 42 42 43 if (-f $example) 44 { 45 $test_passed = 0; 43 44 # TEST #2 45 # ------- 46 # Do it again with trailing "/"; this should work the same 47 48 $example .= "slash"; 49 50 &touch($example); 51 52 &run_make_with_options("${testname}.mk", 53 "-C $workdir/ clean ext=slash", 54 &get_logfile); 55 56 chdir $workdir; 57 $wpath = &get_this_pwd; 58 chdir $pwd; 59 60 if (-f $example) { 61 $test_passed = 0; 46 62 } 47 63 64 # Create the answer to what should be produced by this Makefile 65 $answer = "$make_name: Entering directory `$wpath'\n" 66 . "$delete_command EXAMPLEslash\n" 67 . "$make_name: Leaving directory `$wpath'\n"; 68 69 &compare_output($answer,&get_logfile(1)); 70 48 71 1; -
branches/GNU/src/gmake/tests/scripts/options/dash-k
r53 r284 98 98 &compare_output($answer, &get_logfile(1)); 99 99 100 # TEST -- make sure we keep the error code if we can't create an included 101 # makefile. 102 103 run_make_test('all: ; @echo hi 104 include ifile 105 ifile: no-such-file; @false 106 ', 107 '-k', 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'. 111 hi\n", 112 512); 113 100 114 1; -
branches/GNU/src/gmake/tests/scripts/options/dash-q
r53 r284 4 4 $details = "Try various uses of -q and ensure they all give the correct results.\n"; 5 5 6 open(MAKEFILE, "> $makefile"); 6 # TEST 0 7 7 8 # The Contents of the MAKEFILE ... 9 10 print MAKEFILE <<'EOMAKE'; 8 run_make_test(' 11 9 one: 12 10 two: ; … … 22 20 : foo 23 21 $(.XY) 24 EOMAKE 25 26 close(MAKEFILE); 27 28 # TEST 0 29 30 &run_make_with_options($makefile, "-q one", &get_logfile); 31 $answer = ""; 32 &compare_output($answer, &get_logfile(1)); 22 ', 23 '-q one', ''); 33 24 34 25 # TEST 1 35 26 36 &run_make_with_options($makefile, "-q two", &get_logfile); 37 $answer = ""; 38 &compare_output($answer, &get_logfile(1)); 27 run_make_test(undef, '-q two', ''); 39 28 40 29 # TEST 2 41 30 42 &run_make_with_options($makefile, "-q three", &get_logfile, 256); 43 $answer = ""; 44 &compare_output($answer, &get_logfile(1)); 31 run_make_test(undef, '-q three', '', 256); 45 32 46 33 # TEST 3 47 34 48 &run_make_with_options($makefile, "-q four", &get_logfile); 49 $answer = ""; 50 &compare_output($answer, &get_logfile(1)); 35 run_make_test(undef, '-q four', ''); 51 36 52 37 # TEST 4 53 38 54 &run_make_with_options($makefile, "-q five", &get_logfile); 55 $answer = ""; 56 &compare_output($answer, &get_logfile(1)); 39 run_make_test(undef, '-q five', ''); 57 40 58 41 # TEST 5 59 42 60 &run_make_with_options($makefile, "-q six", &get_logfile); 61 $answer = ""; 62 &compare_output($answer, &get_logfile(1)); 43 run_make_test(undef, '-q six', ''); 63 44 64 45 # TEST 6 65 46 66 &run_make_with_options($makefile, "-q seven", &get_logfile, 256); 67 $answer = ""; 68 &compare_output($answer, &get_logfile(1)); 47 run_make_test(undef, '-q seven', '', 256); 48 49 # TEST 7 : Savannah bug # 7144 50 51 run_make_test(' 52 one:: ; @echo one 53 one:: ; @echo two 54 ', 55 '-q', '', 256); 69 56 70 57 1; -
branches/GNU/src/gmake/tests/scripts/targets/FORCE
r53 r284 1 $description = "The following tests rules without Commands or Dependencies."; 1 $description = "The following tests rules without Commands or Dependencies."; 2 2 3 3 $details = "If the rule ...\n"; … … 18 18 print MAKEFILE ".IGNORE :\n"; 19 19 print MAKEFILE "clean: FORCE\n"; 20 print MAKEFILE "\t$delete_command clean\n"; 20 print MAKEFILE "\t$delete_command clean\n"; 21 21 print MAKEFILE "FORCE:\n"; 22 22 … … 27 27 28 28 # Create a file named "clean". This is the same name as the target clean 29 # and tricks the target into thinking that it is up to date. (Unless you 29 # and tricks the target into thinking that it is up to date. (Unless you 30 30 # use the .PHONY target. 31 31 &touch("clean"); … … 34 34 &run_make_with_options($makefile,"clean",&get_logfile); 35 35 36 &compare_output($answer,&get_logfile(1)); 36 &compare_output($answer,&get_logfile(1)); 37 37 38 if (-f $example)39 {40 $test_passed = 0;41 }42 43 38 1; 44 39 -
branches/GNU/src/gmake/tests/scripts/targets/PHONY
r53 r284 28 28 print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n"; 29 29 print MAKEFILE "clean: \n"; 30 print MAKEFILE "\t$delete_command $example clean\n"; 30 print MAKEFILE "\t$delete_command $example clean\n"; 31 31 32 32 # END of Contents of MAKEFILE … … 37 37 38 38 # Create a file named "clean". This is the same name as the target clean 39 # and tricks the target into thinking that it is up to date. (Unless you 39 # and tricks the target into thinking that it is up to date. (Unless you 40 40 # use the .PHONY target. 41 41 &touch("clean"); … … 44 44 &run_make_with_options($makefile,"clean",&get_logfile); 45 45 46 &compare_output($answer,&get_logfile(1)); 46 if (-f $example) { 47 $test_passed = 0; 48 } 47 49 48 if (-f $example) 49 { 50 $test_passed = 0; 51 } 52 50 &compare_output($answer,&get_logfile(1)); 51 53 52 1; 54 53 -
branches/GNU/src/gmake/tests/scripts/targets/SECONDARY
r53 r284 109 109 unlink('source', 'final', 'intermediate'); 110 110 111 112 # TEST #8 -- test the "global" .SECONDARY, with .PHONY. 113 114 touch('version2'); 115 run_make_test(' 116 .PHONY: version 117 .SECONDARY: 118 version2: version ; @echo GOOD 119 all: version2', 120 'all', 'GOOD'); 121 122 unlink('version2'); 123 111 124 # This tells the test driver that the perl test script executed properly. 112 125 1; -
branches/GNU/src/gmake/tests/scripts/targets/SILENT
r53 r284 23 23 print MAKEFILE ".SILENT : clean\n"; 24 24 print MAKEFILE "clean: \n"; 25 print MAKEFILE "\t$delete_command EXAMPLE_FILE\n"; 25 print MAKEFILE "\t$delete_command EXAMPLE_FILE\n"; 26 26 27 27 # END of Contents of MAKEFILE … … 33 33 $answer = ""; 34 34 &run_make_with_options($makefile,"clean",&get_logfile,0); 35 if (-f $example) { 36 $test_passed = 0; 37 } 38 &compare_output($answer,&get_logfile(1)); 35 39 36 &compare_output($answer,&get_logfile(1));37 if (-f $example)38 {39 $test_passed = 0;40 }41 42 40 1; 43 41 -
branches/GNU/src/gmake/tests/scripts/targets/clean
r53 r284 34 34 $answer = "$delete_command $example\n"; 35 35 &run_make_with_options($makefile,"clean",&get_logfile,0); 36 36 if (-f $example) { 37 $test_passed = 0; 38 } 37 39 &compare_output($answer,&get_logfile(1)) || &error ("abort"); 38 if (-f $example) {39 $test_passed = 0;40 }41 40 42 41 1; -
branches/GNU/src/gmake/tests/scripts/variables/MAKE
r53 r284 1 # -*-perl-*- 2 1 3 $description = "The following test creates a makefile to test MAKE \n" 2 4 ."(very generic)"; … … 27 29 &run_make_with_options($makefile,"",&get_logfile,0); 28 30 29 & delete("foo");31 &rmfiles("foo"); 30 32 # COMPARE RESULTS 31 33 &compare_output($answer,&get_logfile(1)); -
branches/GNU/src/gmake/tests/scripts/variables/MAKELEVEL
r53 r284 1 # -*-perl-mode-*-1 # -*-perl-*- 2 2 3 3 $description = "The following test creates a makefile to test … … 10 10 11 11 print MAKEFILE <<EOF; 12 SHELL = /bin/sh13 12 all: 14 13 \t\@echo MAKELEVEL is \$(MAKELEVEL) -
branches/GNU/src/gmake/tests/scripts/variables/automatic
r53 r284 68 68 69 69 &run_make_with_options($makefile2, "$dir/foo $dir/bar", &get_logfile); 70 $answer = ".x\n$dir/foo.x\n \$.x\n\[email protected]\n$dir.x\nfoo.x\n$dir/bar.x\nbar.x\n";70 $answer = ".x\n$dir/foo.x\nx\n\[email protected]\n$dir.x\nfoo.x\n$dir/bar.x\nbar.x\n"; 71 71 &compare_output($answer, &get_logfile(1)); 72 72 73 73 &run_make_with_options($makefile2, "$dir/x.z $dir/y.z", &get_logfile); 74 $answer = ".x\n$dir/x.z.x\n \$.x\n\[email protected]\n$dir.x\nx.z.x\n.y\n$dir/y.z.y\n\$.y\n\[email protected]\n$dir.y\ny.z.y\n";74 $answer = ".x\n$dir/x.z.x\nx\n\[email protected]\n$dir.x\nx.z.x\n.y\n$dir/y.z.y\n\y\n\[email protected]\n$dir.y\ny.z.y\n"; 75 75 &compare_output($answer, &get_logfile(1)); 76 76 … … 79 79 &compare_output($answer, &get_logfile(1)); 80 80 81 # TEST #3 -- test for Savannah bug #12320. 82 # 83 run_make_test(' 84 .SUFFIXES: .b .src 85 86 mbr.b: mbr.src 87 @echo $* 88 89 mbr.src: ; @: 90 91 ', 92 '', 93 'mbr 94 '); 95 81 96 1; -
branches/GNU/src/gmake/tests/scripts/variables/flavors
r53 r284 72 72 73 73 &run_make_with_options($makefile, "BOGUS=true", &get_logfile, 512); 74 $answer = "$makefile:2 3: *** empty variable name. Stop.\n";74 $answer = "$makefile:24: *** empty variable name. Stop.\n"; 75 75 &compare_output($answer, &get_logfile(1)); 76 76 … … 82 82 &compare_output($answer, &get_logfile(1)); 83 83 84 # Clean up from "old style" testing. If all the above tests are converted to 85 # run_make_test() syntax than this line can be removed. 86 $makefile = undef; 87 88 # ------------------------- 89 # Make sure that prefix characters apply properly to define/endef values. 90 # 91 # There's a bit of oddness here if you try to use a variable to hold the 92 # prefix character for a define. Even though something like this: 93 # 94 # define foo 95 # echo bar 96 # endef 97 # 98 # all: ; $(V)$(foo) 99 # 100 # (where V=@) can be seen by the user to be obviously different than this: 101 # 102 # define foo 103 # $(V)echo bar 104 # endef 105 # 106 # all: ; $(foo) 107 # 108 # and the user thinks it should behave the same as when the "@" is literal 109 # instead of in a variable, that can't happen because by the time make 110 # expands the variables for the command line and sees it begins with a "@" it 111 # can't know anymore whether the prefix character came before the variable 112 # reference or was included in the first line of the variable reference. 113 114 # TEST #5 115 # ------- 116 117 run_make_test(' 118 define FOO 119 $(V1)echo hello 120 $(V2)echo world 121 endef 122 all: ; @$(FOO) 123 ', '', 'hello 124 world'); 125 126 # TEST #6 127 # ------- 128 129 run_make_test(undef, 'V1=@ V2=@', 'hello 130 world'); 131 132 # TEST #7 133 # ------- 134 135 run_make_test(' 136 define FOO 137 $(V1)echo hello 138 $(V2)echo world 139 endef 140 all: ; $(FOO) 141 ', 'V1=@', 'hello 142 echo world 143 world'); 144 145 # TEST #8 146 # ------- 147 148 run_make_test(undef, 'V2=@', 'echo hello 149 hello 150 world'); 151 152 # TEST #9 153 # ------- 154 155 run_make_test(undef, 'V1=@ V2=@', 'hello 156 world'); 157 158 # TEST #10 159 # ------- 160 # Test the basics; a "@" internally to the variable applies to only one line. 161 # A "@" before the variable applies to the entire variable. 162 163 run_make_test(' 164 define FOO 165 @echo hello 166 echo world 167 endef 168 define BAR 169 echo hello 170 echo world 171 endef 172 173 all: foo bar 174 foo: ; $(FOO) 175 bar: ; @$(BAR) 176 ', '', 'hello 177 echo world 178 world 179 hello 180 world 181 '); 84 182 85 183 1; -
branches/GNU/src/gmake/tests/scripts/variables/special
r53 r284 5 5 $details = ""; 6 6 7 $makefile2 = &get_tmpfile; 8 9 10 open(MAKEFILE, "> $makefile"); 11 12 print MAKEFILE <<'EOF'; 7 &run_make_test(' 13 8 14 9 X1 := $(sort $(filter FOO BAR,$(.VARIABLES))) … … 24 19 @echo X2 = $(X2) 25 20 @echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) 26 27 EOF 28 29 close(MAKEFILE); 30 31 # TEST #1 32 # ------- 33 34 &run_make_with_options($makefile, "", &get_logfile); 35 $answer = "X1 =\nX2 = FOO\nLAST = BAR FOO\n"; 36 &compare_output($answer, &get_logfile(1)); 21 ', 22 '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n"); 37 23 38 24 39 25 40 26 # $makefile2 = &get_tmpfile; 41 27 # open(MAKEFILE, "> $makefile2"); 42 28
Note:
See TracChangeset
for help on using the changeset viewer.