diff options
Diffstat (limited to 'tests/scripts')
-rw-r--r-- | tests/scripts/features/echoing | 9 | ||||
-rw-r--r-- | tests/scripts/features/errors | 25 | ||||
-rw-r--r-- | tests/scripts/features/include | 33 | ||||
-rw-r--r-- | tests/scripts/features/order_only | 11 | ||||
-rw-r--r-- | tests/scripts/functions/wildcard | 7 | ||||
-rw-r--r-- | tests/scripts/options/dash-C | 9 | ||||
-rw-r--r-- | tests/scripts/options/dash-k | 14 | ||||
-rw-r--r-- | tests/scripts/targets/FORCE | 13 | ||||
-rw-r--r-- | tests/scripts/targets/PHONY | 15 | ||||
-rw-r--r-- | tests/scripts/targets/SILENT | 12 | ||||
-rw-r--r-- | tests/scripts/targets/clean | 5 | ||||
-rw-r--r-- | tests/scripts/variables/special | 22 |
12 files changed, 95 insertions, 80 deletions
diff --git a/tests/scripts/features/echoing b/tests/scripts/features/echoing index ed1e862..2e366cd 100644 --- a/tests/scripts/features/echoing +++ b/tests/scripts/features/echoing @@ -54,13 +54,10 @@ $answer = "echo This makefile did not clean the dir... good\n" # ------- &run_make_with_options($makefile,"clean",&get_logfile,0); -$answer = ""; -&compare_output($answer,&get_logfile(1)); - -if (-f $example) -{ - $test_passed = 0; +if (-f $example) { + $test_passed = 0; } +&compare_output('',&get_logfile(1)); # TEST #3 # ------- diff --git a/tests/scripts/features/errors b/tests/scripts/features/errors index a39064f..253f50f 100644 --- a/tests/scripts/features/errors +++ b/tests/scripts/features/errors @@ -52,6 +52,13 @@ $answer = "$delete_command cleanit\n" &run_make_with_options($makefile,"",&get_logfile); +# If make acted as planned, it should ignore the error from the first +# command in the target and execute the second which deletes the file "foo" +# This file, therefore, should not exist if the test PASSES. +if (-f "foo") { + $test_passed = 0; +} + # The output for this on VOS is too hard to replicate, so we only check it # on unix. if (!$vos) @@ -59,14 +66,6 @@ if (!$vos) &compare_output($answer,&get_logfile(1)); } -# If make acted as planned, it should ignore the error from the first -# command in the target and execute the second which deletes the file "foo" -# This file, therefore, should not exist if the test PASSES. -if (-f "foo") -{ - $test_passed = 0; -} - &touch("foo"); @@ -80,14 +79,12 @@ $answer = "$delete_command cleanit\n" &run_make_with_options($makefile,"clean2 -i",&get_logfile); -if (!$vos) -{ - &compare_output($answer,&get_logfile(1)); +if (-f "foo") { + $test_passed = 0; } -if (-f "foo") -{ - $test_passed = 0; +if (!$vos) { + &compare_output($answer,&get_logfile(1)); } 1; diff --git a/tests/scripts/features/include b/tests/scripts/features/include index 60f4482..5f20ad8 100644 --- a/tests/scripts/features/include +++ b/tests/scripts/features/include @@ -2,7 +2,8 @@ $description = "Test various forms of the GNU make `include' command."; -$details = "Test include, -include, sinclude and various regressions involving them. +$details = "\ +Test include, -include, sinclude and various regressions involving them. Test extra whitespace at the end of the include, multiple -includes and sincludes (should not give an error) and make sure that errors are reported for targets that were also -included."; @@ -46,16 +47,36 @@ $answer = "There should be no errors for this makefile.\n"; $answer = "This is another included makefile\n"; &compare_output($answer, &get_logfile(1)); +$makefile = undef; + # Try to build the "error" target; this will fail since we don't know # how to create makeit.mk, but we should also get a message (even though # the -include suppressed it during the makefile read phase, we should # see one during the makefile run phase). -# The fix to this caused more problems than the error, so I removed it. -# pds -- 22 Jan 2000 +run_make_test + (' +-include foo.mk +error: foo.mk ; @echo $@ +', + '', + "#MAKE#: *** No rule to make target `foo.mk', needed by `error'. Stop.\n", + 512 + ); + +# Make sure that target-specific variables don't impact things. This could +# happen because a file record is created when a target-specific variable is +# set. + +run_make_test + (' +bar.mk: foo := baz +-include bar.mk +hello: ; @echo hello +', + '', + "hello\n" + ); -#&run_make_with_options($makefile, "error", &get_logfile, 512); -#$answer = "$make_name: *** No rule to make target `makeit.mk', needed by `error'.\n"; -#&compare_output($answer, &get_logfile(1)); 1; diff --git a/tests/scripts/features/order_only b/tests/scripts/features/order_only index ac0d538..82a7253 100644 --- a/tests/scripts/features/order_only +++ b/tests/scripts/features/order_only @@ -144,4 +144,15 @@ $answer = "touch baz\n"; unlink(qw(foo.w foo.x baz)); +# TEST #9 -- make sure that $< is set correctly in the face of order-only +# prerequisites in pattern rules. + +run_make_test(' +%r: | baz ; @echo $< $^ $| +bar: foo +foo:;@: +baz:;@: +', '', "foo foo baz\n"); + + 1; diff --git a/tests/scripts/functions/wildcard b/tests/scripts/functions/wildcard index 0f79acc..5e5a5ff 100644 --- a/tests/scripts/functions/wildcard +++ b/tests/scripts/functions/wildcard @@ -85,13 +85,12 @@ else &run_make_with_options($makefile,"clean",&get_logfile); -&compare_output($answer,&get_logfile(1)); - -if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) -{ +if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) { $test_passed = 0; } +&compare_output($answer,&get_logfile(1)); + 1; diff --git a/tests/scripts/options/dash-C b/tests/scripts/options/dash-C index 3f2b3a1..f31238f 100644 --- a/tests/scripts/options/dash-C +++ b/tests/scripts/options/dash-C @@ -33,6 +33,10 @@ chdir $workdir; $wpath = &get_this_pwd; chdir $pwd; +if (-f $example) { + $test_passed = 0; +} + # Create the answer to what should be produced by this Makefile $answer = "$make_name: Entering directory `$wpath'\n" . "$delete_command EXAMPLE_FILE\n" @@ -40,9 +44,4 @@ $answer = "$make_name: Entering directory `$wpath'\n" &compare_output($answer,&get_logfile(1)); -if (-f $example) -{ - $test_passed = 0; -} - 1; diff --git a/tests/scripts/options/dash-k b/tests/scripts/options/dash-k index fe5689e..d87a786 100644 --- a/tests/scripts/options/dash-k +++ b/tests/scripts/options/dash-k @@ -97,4 +97,18 @@ $make_name: Target `all' not remade because of errors.\n"; &compare_output($answer, &get_logfile(1)); +# TEST -- make sure we keep the error code if we can't create an included +# makefile. + +run_make_test('all: ; @echo hi +include ifile +ifile: no-such-file; @false +', + '-k', + "#MAKEFILE#:2: ifile: No such file or directory +#MAKE#: *** No rule to make target `no-such-file', needed by `ifile'. +#MAKE#: Failed to remake makefile `ifile'. +hi\n", + 512); + 1; diff --git a/tests/scripts/targets/FORCE b/tests/scripts/targets/FORCE index 90ee48d..befb326 100644 --- a/tests/scripts/targets/FORCE +++ b/tests/scripts/targets/FORCE @@ -1,4 +1,4 @@ -$description = "The following tests rules without Commands or Dependencies."; +$description = "The following tests rules without Commands or Dependencies."; $details = "If the rule ...\n"; @@ -17,7 +17,7 @@ open(MAKEFILE,"> $makefile"); print MAKEFILE ".IGNORE :\n"; print MAKEFILE "clean: FORCE\n"; -print MAKEFILE "\t$delete_command clean\n"; +print MAKEFILE "\t$delete_command clean\n"; print MAKEFILE "FORCE:\n"; # END of Contents of MAKEFILE @@ -26,20 +26,15 @@ close(MAKEFILE); # Create a file named "clean". This is the same name as the target clean -# and tricks the target into thinking that it is up to date. (Unless you +# and tricks the target into thinking that it is up to date. (Unless you # use the .PHONY target. &touch("clean"); $answer = "$delete_command clean\n"; &run_make_with_options($makefile,"clean",&get_logfile); -&compare_output($answer,&get_logfile(1)); +&compare_output($answer,&get_logfile(1)); -if (-f $example) -{ - $test_passed = 0; -} - 1; diff --git a/tests/scripts/targets/PHONY b/tests/scripts/targets/PHONY index 14d5ae1..dd46b3f 100644 --- a/tests/scripts/targets/PHONY +++ b/tests/scripts/targets/PHONY @@ -27,7 +27,7 @@ print MAKEFILE ".PHONY : clean \n"; print MAKEFILE "all: \n"; print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n"; print MAKEFILE "clean: \n"; -print MAKEFILE "\t$delete_command $example clean\n"; +print MAKEFILE "\t$delete_command $example clean\n"; # END of Contents of MAKEFILE @@ -36,20 +36,19 @@ close(MAKEFILE); &touch($example); # Create a file named "clean". This is the same name as the target clean -# and tricks the target into thinking that it is up to date. (Unless you +# and tricks the target into thinking that it is up to date. (Unless you # use the .PHONY target. &touch("clean"); $answer = "$delete_command $example clean\n"; &run_make_with_options($makefile,"clean",&get_logfile); -&compare_output($answer,&get_logfile(1)); - -if (-f $example) -{ - $test_passed = 0; +if (-f $example) { + $test_passed = 0; } - + +&compare_output($answer,&get_logfile(1)); + 1; diff --git a/tests/scripts/targets/SILENT b/tests/scripts/targets/SILENT index 375cad4..5f9a1db 100644 --- a/tests/scripts/targets/SILENT +++ b/tests/scripts/targets/SILENT @@ -22,7 +22,7 @@ open(MAKEFILE,"> $makefile"); print MAKEFILE ".SILENT : clean\n"; print MAKEFILE "clean: \n"; -print MAKEFILE "\t$delete_command EXAMPLE_FILE\n"; +print MAKEFILE "\t$delete_command EXAMPLE_FILE\n"; # END of Contents of MAKEFILE @@ -32,13 +32,11 @@ close(MAKEFILE); $answer = ""; &run_make_with_options($makefile,"clean",&get_logfile,0); - -&compare_output($answer,&get_logfile(1)); -if (-f $example) -{ - $test_passed = 0; +if (-f $example) { + $test_passed = 0; } - +&compare_output($answer,&get_logfile(1)); + 1; diff --git a/tests/scripts/targets/clean b/tests/scripts/targets/clean index 69f4fd1..b32c976 100644 --- a/tests/scripts/targets/clean +++ b/tests/scripts/targets/clean @@ -33,11 +33,10 @@ $answer = "This makefile did not clean the dir... good\n"; $answer = "$delete_command $example\n"; &run_make_with_options($makefile,"clean",&get_logfile,0); - -&compare_output($answer,&get_logfile(1)) || &error ("abort"); if (-f $example) { - $test_passed = 0; + $test_passed = 0; } +&compare_output($answer,&get_logfile(1)) || &error ("abort"); 1; diff --git a/tests/scripts/variables/special b/tests/scripts/variables/special index 58c8655..77b355c 100644 --- a/tests/scripts/variables/special +++ b/tests/scripts/variables/special @@ -4,12 +4,7 @@ $description = "Test special GNU make variables."; $details = ""; -$makefile2 = &get_tmpfile; - - -open(MAKEFILE, "> $makefile"); - -print MAKEFILE <<'EOF'; +&run_make_test(' X1 := $(sort $(filter FOO BAR,$(.VARIABLES))) @@ -23,21 +18,12 @@ all: @echo X1 = $(X1) @echo X2 = $(X2) @echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) - -EOF - -close(MAKEFILE); - -# TEST #1 -# ------- - -&run_make_with_options($makefile, "", &get_logfile); -$answer = "X1 =\nX2 = FOO\nLAST = BAR FOO\n"; -&compare_output($answer, &get_logfile(1)); - +', + '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n"); +# $makefile2 = &get_tmpfile; # open(MAKEFILE, "> $makefile2"); # print MAKEFILE <<'EOF'; |