diff options
Diffstat (limited to 'tests/scripts/options')
-rw-r--r-- | tests/scripts/options/dash-B | 4 | ||||
-rw-r--r-- | tests/scripts/options/dash-C | 8 | ||||
-rw-r--r-- | tests/scripts/options/dash-I | 4 | ||||
-rw-r--r-- | tests/scripts/options/dash-W | 4 | ||||
-rw-r--r-- | tests/scripts/options/dash-k | 11 | ||||
-rw-r--r-- | tests/scripts/options/dash-n | 80 | ||||
-rw-r--r-- | tests/scripts/options/eval | 10 | ||||
-rw-r--r-- | tests/scripts/options/print-directory | 33 | ||||
-rw-r--r-- | tests/scripts/options/symlinks | 10 | ||||
-rw-r--r-- | tests/scripts/options/warn-undefined-variables | 4 |
10 files changed, 121 insertions, 47 deletions
diff --git a/tests/scripts/options/dash-B b/tests/scripts/options/dash-B index e36842e..9c708b7 100644 --- a/tests/scripts/options/dash-B +++ b/tests/scripts/options/dash-B @@ -22,13 +22,13 @@ foo: bar.x ', '', 'cp bar.x foo'); -run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'."); +run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'."); run_make_test(undef, '-B', 'cp bar.x foo'); # Put the timestamp for foo into the future; it should still be remade. utouch(1000, 'foo'); -run_make_test(undef, '', "#MAKE#: Nothing to be done for `all'."); +run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'."); run_make_test(undef, '-B', 'cp bar.x foo'); # Clean up diff --git a/tests/scripts/options/dash-C b/tests/scripts/options/dash-C index 5864ffd..42d0a8b 100644 --- a/tests/scripts/options/dash-C +++ b/tests/scripts/options/dash-C @@ -34,9 +34,9 @@ if (-f $example) { } # Create the answer to what should be produced by this Makefile -$answer = "$make_name: Entering directory `$wpath'\n" +$answer = "$make_name: Entering directory '$wpath'\n" . "$delete_command EXAMPLE\n" - . "$make_name: Leaving directory `$wpath'\n"; + . "$make_name: Leaving directory '$wpath'\n"; &compare_output($answer,&get_logfile(1)); @@ -62,9 +62,9 @@ if (-f $example) { } # Create the answer to what should be produced by this Makefile -$answer = "$make_name: Entering directory `$wpath'\n" +$answer = "$make_name: Entering directory '$wpath'\n" . "$delete_command EXAMPLEslash\n" - . "$make_name: Leaving directory `$wpath'\n"; + . "$make_name: Leaving directory '$wpath'\n"; &compare_output($answer,&get_logfile(1)); diff --git a/tests/scripts/options/dash-I b/tests/scripts/options/dash-I index 8dc5d9b..d47a8d8 100644 --- a/tests/scripts/options/dash-I +++ b/tests/scripts/options/dash-I @@ -51,9 +51,9 @@ $answer = "This is another included makefile\n"; $answer = "$mkpath ANOTHER -f $makefile -${make_name}[1]: Entering directory `$pwd' +${make_name}[1]: Entering directory '$pwd' This is another included makefile -${make_name}[1]: Leaving directory `$pwd'\n"; +${make_name}[1]: Leaving directory '$pwd'\n"; &run_make_with_options($makefile,"-I $workdir recurse",&get_logfile); &compare_output($answer,&get_logfile(1)); diff --git a/tests/scripts/options/dash-W b/tests/scripts/options/dash-W index d3fde87..20b9f74 100644 --- a/tests/scripts/options/dash-W +++ b/tests/scripts/options/dash-W @@ -12,7 +12,7 @@ a.x b.x: ; echo >> $@ # Run it again: nothing should happen -run_make_test(undef, '', "#MAKE#: `a.x' is up to date."); +run_make_test(undef, '', "#MAKE#: 'a.x' is up to date."); # Now run it with -W b.x: should rebuild a.x @@ -21,7 +21,7 @@ run_make_test(undef, '-W b.x', 'echo >> a.x'); # Put the timestamp for a.x into the future; it should still be remade. utouch(1000, 'a.x'); -run_make_test(undef, '', "#MAKE#: `a.x' is up to date."); +run_make_test(undef, '', "#MAKE#: 'a.x' is up to date."); run_make_test(undef, '-W b.x', 'echo >> a.x'); # Clean up diff --git a/tests/scripts/options/dash-k b/tests/scripts/options/dash-k index d87a786..e784e0d 100644 --- a/tests/scripts/options/dash-k +++ b/tests/scripts/options/dash-k @@ -57,10 +57,10 @@ else { # Create the answer to what should be produced by this Makefile $answer = "cc -c main.c -$make_name: *** No rule to make target `kbd.c', needed by `kbd.o'. +$make_name: *** No rule to make target 'kbd.c', needed by 'kbd.o'. cc -c commands.c cc -c display.c -$make_name: Target `edit' not remade because of errors.\n"; +$make_name: Target 'edit' not remade because of errors.\n"; # COMPARE RESULTS @@ -92,8 +92,9 @@ close(MAKEFILE); &run_make_with_options($makefile2, "-k", &get_logfile, $error_code); $answer = "exit 1 +$makefile2:9: recipe for target 'foo.o' failed $make_name: *** [foo.o] Error 1 -$make_name: Target `all' not remade because of errors.\n"; +$make_name: Target 'all' not remade because of errors.\n"; &compare_output($answer, &get_logfile(1)); @@ -106,8 +107,8 @@ 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'. +#MAKE#: *** No rule to make target 'no-such-file', needed by 'ifile'. +#MAKE#: Failed to remake makefile 'ifile'. hi\n", 512); diff --git a/tests/scripts/options/dash-n b/tests/scripts/options/dash-n index de19f42..dfed419 100644 --- a/tests/scripts/options/dash-n +++ b/tests/scripts/options/dash-n @@ -3,37 +3,24 @@ $description = "Test the -n option.\n"; $details = "Try various uses of -n and ensure they all give the correct results.\n"; -open(MAKEFILE, "> $makefile"); - -# The Contents of the MAKEFILE ... - -print MAKEFILE <<'EOMAKE'; +touch('orig'); +run_make_test(q! final: intermediate ; echo >> $@ intermediate: orig ; echo >> $@ - -EOMAKE - -close(MAKEFILE); - -&touch('orig'); - -# TEST 0 - -&run_make_with_options($makefile, "", &get_logfile); -$answer = "echo >> intermediate\necho >> final\n"; -&compare_output($answer, &get_logfile(1)); +!, + '', "echo >> intermediate\necho >> final\n"); # TEST 1 -&run_make_with_options($makefile, "-Worig -n", &get_logfile); -$answer = "echo >> intermediate\necho >> final\n"; -&compare_output($answer, &get_logfile(1)); +run_make_test(undef, '-Worig -n', "echo >> intermediate\necho >> final\n"); -unlink('orig', 'intermediate', 'final'); +rmfiles(qw(orig intermediate final)); # We consider the actual updated timestamp of targets with all -# recursive commands, even with -n. +# recursive commands, even with -n. Switching this to the new model +# is non-trivial because we use a trick below to change the log content +# before we compare it ... $makefile2 = &get_tmpfile; @@ -56,15 +43,58 @@ close(MAKEFILE); # TEST 2 &run_make_with_options($makefile2, "", &get_logfile); -$answer = "$make_name: `a' is up to date.\n"; +$answer = "$make_name: 'a' is up to date.\n"; &compare_output($answer, &get_logfile(1)); # TEST 3 &run_make_with_options($makefile2, "-n", &get_logfile); -$answer = "$make_name: `a' is up to date.\n"; +$answer = "$make_name: 'a' is up to date.\n"; +&compare_output($answer, &get_logfile(1)); + +# TEST 4 + +unlink(qw(a b)); + +&run_make_with_options($makefile2, "-t -n", &get_logfile); + +open(DASH_N_LOG, ">>" . &get_logfile(1)); +print DASH_N_LOG "a exists but should not!\n" if -e 'a'; +print DASH_N_LOG "b exists but should not!\n" if -e 'b'; +close(DASH_N_LOG); + +&compare_output("touch b\ntouch a\n", &get_logfile(1)); + +# CLEANUP + +unlink(qw(a b c)); + +# Ensure -n continues to be included with recursive/re-execed make +# See Savannah bug #38051 + +$topmake = &get_tmpfile; +$submake = &get_tmpfile; + +open(MAKEFILE, "> $topmake"); +print MAKEFILE <<"EOF"; +foo: ; \@\$(MAKE) -f "$submake" bar +EOF +close(MAKEFILE); + + +# The bar target should print what would happen, but not actually run +open(MAKEFILE, "> $submake"); +print MAKEFILE <<'EOF'; +inc: ; touch $@ +-include inc +bar: ; @echo $(strip $(MAKEFLAGS)) +EOF +close(MAKEFILE); + +&run_make_with_options($topmake, '-n --no-print-directory', &get_logfile); +$answer = "$make_path -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n"; &compare_output($answer, &get_logfile(1)); -unlink('a', 'b', 'c'); +unlink('inc'); 1; diff --git a/tests/scripts/options/eval b/tests/scripts/options/eval index 06a035c..0f82409 100644 --- a/tests/scripts/options/eval +++ b/tests/scripts/options/eval @@ -16,4 +16,14 @@ recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!, run_make_test(undef, '--no-print-directory --eval=\$\(info\ eval\) recurse', "eval\neval\nall\nrecurse"); +# Make sure that --eval is handled correctly during restarting +run_make_test(q! +all: ; @echo $@ +-include gen.mk +gen.mk: ; @echo > $@ +!, + '--eval=\$\(info\ eval\)', "eval\neval\nall"); + +unlink('gen.mk'); + 1; diff --git a/tests/scripts/options/print-directory b/tests/scripts/options/print-directory new file mode 100644 index 0000000..a05bbee --- /dev/null +++ b/tests/scripts/options/print-directory @@ -0,0 +1,33 @@ +# -*-perl-*- + +$description = "Test the -w option to GNU make."; + +# Simple test without -w +run_make_test(q! +all: ; @echo hi +!, + "", "hi\n"); + +# Simple test with -w +run_make_test(undef, "-w", + "#MAKE#: Entering directory '#PWD#'\nhi\n#MAKE#: Leaving directory '#PWD#'\n"); + +# Test makefile rebuild to ensure no enter/leave +run_make_test(q! +include foo +all: ;@: +foo: ; touch foo +!, + "", "#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n"); +unlink('foo'); + +# Test makefile rebuild with -w +run_make_test(q! +include foo +all: ;@: +foo: ; touch foo +!, + "-w", "#MAKE#: Entering directory '#PWD#'\n#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n#MAKE#: Leaving directory '#PWD#'\n"); +unlink('foo'); + +1; diff --git a/tests/scripts/options/symlinks b/tests/scripts/options/symlinks index 40d2564..a1bfce0 100644 --- a/tests/scripts/options/symlinks +++ b/tests/scripts/options/symlinks @@ -26,7 +26,7 @@ if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) { # Without -L, nothing should happen # With -L, it should update targ run_make_test('targ: sym ; @echo make $@ from $<', '', - "#MAKE#: `targ' is up to date."); + "#MAKE#: 'targ' is up to date."); run_make_test(undef, '-L', "make targ from sym"); # Now update dep; in all cases targ should be out of date. @@ -36,8 +36,8 @@ if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) { # Now update targ; in all cases targ should be up to date. &touch('targ'); - run_make_test(undef, '', "#MAKE#: `targ' is up to date."); - run_make_test(undef, '-L', "#MAKE#: `targ' is up to date."); + run_make_test(undef, '', "#MAKE#: 'targ' is up to date."); + run_make_test(undef, '-L', "#MAKE#: 'targ' is up to date."); # Add in a new link between sym and dep. Be sure it's newer than targ. sleep(1); @@ -46,7 +46,7 @@ if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) { # Without -L, nothing should happen # With -L, it should update targ - run_make_test(undef, '', "#MAKE#: `targ' is up to date."); + run_make_test(undef, '', "#MAKE#: 'targ' is up to date."); run_make_test(undef, '-L', "make targ from sym"); rmfiles('targ', 'dep', 'sym', 'dep1'); @@ -56,7 +56,7 @@ if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) { symlink("../$dirname/dep", 'sym'); run_make_test('targ: sym ; @echo make $@ from $<', '', - "#MAKE#: *** No rule to make target `sym', needed by `targ'. Stop.", 512); + "#MAKE#: *** No rule to make target 'sym', needed by 'targ'. Stop.", 512); run_make_test('targ: sym ; @echo make $@ from $<', '-L', 'make targ from sym'); diff --git a/tests/scripts/options/warn-undefined-variables b/tests/scripts/options/warn-undefined-variables index 34bfaea..ce15507 100644 --- a/tests/scripts/options/warn-undefined-variables +++ b/tests/scripts/options/warn-undefined-variables @@ -18,8 +18,8 @@ all: ; @echo ref $(EREF) $(UREF)', # With --warn-undefined-variables, it should warn me run_make_test(undef, '--warn-undefined-variables', - "#MAKEFILE#:7: warning: undefined variable `UNDEFINED' -#MAKEFILE#:9: warning: undefined variable `UNDEFINED' + "#MAKEFILE#:7: warning: undefined variable 'UNDEFINED' +#MAKEFILE#:9: warning: undefined variable 'UNDEFINED' ref"); 1; |