From: Paul Smith Date: Sun, 24 Aug 2025 18:29:11 +0000 (-0400) Subject: * tests/scripts/*: Switch TAB chars to #TAB# markup X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fdcaaed8d7c1a2c749d3bdb96689e3d4c904049a;p=thirdparty%2Fmake.git * tests/scripts/*: Switch TAB chars to #TAB# markup Avoid Emacs local variable settings to disable whitespace cleanup, by creating markup tokens for TAB characters (#TAB#) and space characters (#SPACE#) (for end-of-line spaces). Modify all the tests that use TABs to use the new markup. This requires changing some old-fashioned tests to use the modern run_make_test(). Also remove some of the comments regarding test numbers now that the framework keeps track. --- diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl index 9565deac..4296e302 100644 --- a/tests/run_make_tests.pl +++ b/tests/run_make_tests.pl @@ -165,6 +165,8 @@ sub subst_make_string $makefile and s/#MAKEFILE#/$makefile/g; s/#MAKEPATH#/$mkpath/g; s/#MAKE#/$make_name/g; + s/#TAB#/\t/g; + s/#SPACE#/ /g; s/#PERL#/$perl_name/g; s/#PWD#/$wd/g; s/#HELPER#/$perl_name $helptool/g; diff --git a/tests/scripts/features/comments b/tests/scripts/features/comments index a6458cd6..7cb2c697 100644 --- a/tests/scripts/features/comments +++ b/tests/scripts/features/comments @@ -1,3 +1,5 @@ +# -*-perl-*- + $description = "The following test creates a makefile to test comments\n" ."and comment continuation to the next line using a \n" ."backslash within makefiles."; @@ -15,23 +17,18 @@ open(MAKEFILE,"> $makefile"); # The Contents of the MAKEFILE ... print MAKEFILE <<\EOF; -# Test comment vs semicolon parsing and line continuation -target: # this ; is just a comment \ - @echo This is within a comment. - @echo There should be no errors for this makefile. EOF # END of Contents of MAKEFILE close(MAKEFILE); -&run_make_with_options($makefile,"",&get_logfile); - -# Create the answer to what should be produced by this Makefile -$answer = "There should be no errors for this makefile.\n"; - -# COMPARE RESULTS - -&compare_output($answer,&get_logfile(1)); +run_make_test(q! +# Test comment vs semicolon parsing and line continuation +target: # this ; is just a comment \ +#TAB#@echo This is within a comment.#SPACE# +#TAB#@echo There should be no errors for this makefile. +!, + '', "There should be no errors for this makefile.\n"); 1; diff --git a/tests/scripts/features/conditionals b/tests/scripts/features/conditionals index c8f14215..7cef9308 100644 --- a/tests/scripts/features/conditionals +++ b/tests/scripts/features/conditionals @@ -3,7 +3,7 @@ $description = "Check GNU Make conditionals."; $details = "Attempt various different flavors of GNU Make conditionals."; -run_make_test(' +run_make_test(q! arg1 = first arg2 = second arg3 = third @@ -12,33 +12,33 @@ arg5 = second all: ifeq ($(arg1),$(arg2)) - @echo arg1 equals arg2 +#TAB#@echo arg1 equals arg2 else - @echo arg1 NOT equal arg2 +#TAB#@echo arg1 NOT equal arg2 endif -ifeq \'$(arg2)\' "$(arg5)" - @echo arg2 equals arg5 +ifeq '$(arg2)' "$(arg5)" +#TAB#@echo arg2 equals arg5 else - @echo arg2 NOT equal arg5 +#TAB#@echo arg2 NOT equal arg5 endif -ifneq \'$(arg3)\' \'$(arg4)\' - @echo arg3 NOT equal arg4 +ifneq '$(arg3)' '$(arg4)' +#TAB#@echo arg3 NOT equal arg4 else - @echo arg3 equal arg4 +#TAB#@echo arg3 equal arg4 endif ifndef undefined - @echo variable is undefined +#TAB#@echo variable is undefined else - @echo variable undefined is defined +#TAB#@echo variable undefined is defined endif ifdef arg4 - @echo arg4 is defined +#TAB#@echo arg4 is defined else - @echo arg4 is NOT defined -endif', +#TAB#@echo arg4 is NOT defined +endif!, '', 'arg1 NOT equal arg2 arg2 equals arg5 @@ -49,7 +49,7 @@ arg4 is defined'); # Test expansion of variables inside ifdef. -run_make_test(' +run_make_test(q! foo = 1 FOO = foo @@ -73,14 +73,14 @@ ifdef $(call FUNC,DEF)3 DEF3 = yes endif -all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)', +all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)!, '', 'DEF=yes DEF2=yes DEF3=yes'); # Test all the different "else if..." constructs -run_make_test(' +run_make_test(q! arg1 = first arg2 = second arg3 = third @@ -91,9 +91,9 @@ result = ifeq ($(arg1),$(arg2)) result += arg1 equals arg2 -else ifeq \'$(arg2)\' "$(arg5)" +else ifeq '$(arg2)' "$(arg5)" result += arg2 equals arg5 -else ifneq \'$(arg3)\' \'$(arg3)\' +else ifneq '$(arg3)' '$(arg3)' result += arg3 NOT equal arg4 else ifndef arg5 result += variable is undefined @@ -104,14 +104,14 @@ else endif -all: ; @echo $(result)', +all: ; @echo $(result)!, '', 'success'); # Test some random "else if..." construct nesting -run_make_test(' +run_make_test(q! arg1 = first arg2 = second arg3 = third @@ -120,13 +120,13 @@ arg5 = second ifeq ($(arg1),$(arg2)) $(info failed 1) -else ifeq \'$(arg2)\' "$(arg2)" +else ifeq '$(arg2)' "$(arg2)" ifdef undefined $(info failed 2) else $(info success) endif -else ifneq \'$(arg3)\' \'$(arg3)\' +else ifneq '$(arg3)' '$(arg3)' $(info failed 3) else ifdef arg5 $(info failed 4) @@ -137,20 +137,20 @@ else endif .PHONY: all -all: ; @:', +all: ; @:!, '', 'success'); # SV 47960 : ensure variable assignments in non-taken legs don't cause problems -run_make_test(' +run_make_test(q! ifneq ($(FOO),yes) target: else BAR = bar target: endif - @echo one -', +#TAB#@echo one +!, '', "one\n"); # SV 64085: Ensure recipe prefixed conditionals are never considered @@ -158,7 +158,7 @@ run_make_test(q! blah=1 ifdef blah else - else +#TAB#else endif all:; !, @@ -168,7 +168,7 @@ run_make_test(q! blah=1 ifdef blah else - endif +#TAB#endif endif all:; !, @@ -178,7 +178,7 @@ run_make_test(q! blah=1 ifdef blah else - ifdef blah +#TAB#ifdef blah endif all:; !, @@ -189,7 +189,7 @@ blah=1 all:; foo: ifdef blah - ifdef blah +#TAB#ifdef blah endif !, '', "#MAKE#: 'all' is up to date."); @@ -199,7 +199,7 @@ blah=1 all:; foo: ifdef blah - endif +#TAB#endif endif !, '', "#MAKE#: 'all' is up to date."); @@ -209,7 +209,7 @@ blah=1 all:; foo: ifdef blah - else +#TAB#else else endif !, @@ -255,7 +255,3 @@ all:; # This tells the test driver that the perl test script executed properly. 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/features/order_only b/tests/scripts/features/order_only index 4ebdc2b8..a6b877d0 100644 --- a/tests/scripts/features/order_only +++ b/tests/scripts/features/order_only @@ -5,7 +5,7 @@ $details = "\ Create makefiles with various combinations of normal and order-only prerequisites and ensure they behave properly. Test the \$| variable."; -# TEST #0 -- Basics +# Basics run_make_test(' %r: | baz ; @echo $< $^ $| @@ -14,45 +14,45 @@ foo:;@: baz:;@:', '', "foo foo baz\n"); -# TEST #1 -- First try: the order-only prereqs need to be built. +# First try: the order-only prereqs need to be built. run_make_test(q! foo: bar | baz - @echo '$$^ = $^' - @echo '$$| = $|' - touch $@ +#TAB#@echo '$$^ = $^' +#TAB#@echo '$$| = $|' +#TAB#touch $@ .PHONY: baz bar baz: - touch $@!, +#TAB#touch $@!, '', "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n"); -# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated +# now we do it again: baz is PHONY but foo should _NOT_ be updated run_make_test(undef, '', "touch baz\n"); unlink(qw(foo bar baz)); -# TEST #3 -- Make sure the order-only prereq was promoted to normal. +# Make sure the order-only prereq was promoted to normal. run_make_test(q! foo: bar | baz - @echo '$$^ = $^' - @echo '$$| = $|' - touch $@ +#TAB#@echo '$$^ = $^' +#TAB#@echo '$$| = $|' +#TAB#touch $@ foo: baz .PHONY: baz bar baz: - touch $@!, +#TAB#touch $@!, '', "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"); -# TEST #4 -- now we do it again +# now we do it again run_make_test(undef, '', "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"); @@ -60,21 +60,21 @@ unlink(qw(foo bar baz)); # Test empty normal prereqs -# TEST #5 -- make sure the parser was correct. +# make sure the parser was correct. run_make_test(q! foo:| baz - @echo '$$^ = $^' - @echo '$$| = $|' - touch $@ +#TAB#@echo '$$^ = $^' +#TAB#@echo '$$| = $|' +#TAB#touch $@ .PHONY: baz baz: - touch $@!, +#TAB#touch $@!, '', "touch baz\n\$^ = \n\$| = baz\ntouch foo\n"); -# TEST #6 -- now we do it again: this time foo won't be built +# now we do it again: this time foo won't be built run_make_test(undef, '', "touch baz\n"); @@ -82,29 +82,29 @@ unlink(qw(foo baz)); # Test order-only in pattern rules -# TEST #7 -- make sure the parser was correct. +# make sure the parser was correct. run_make_test(q! %.w : %.x | baz - @echo '$$^ = $^' - @echo '$$| = $|' - touch $@ +#TAB#@echo '$$^ = $^' +#TAB#@echo '$$| = $|' +#TAB#touch $@ all: foo.w .PHONY: baz foo.x baz: - touch $@!, +#TAB#touch $@!, '', "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n"); -# TEST #8 -- now we do it again: this time foo.w won't be built +# now we do it again: this time foo.w won't be built run_make_test(undef, '', "touch baz\n"); unlink(qw(foo.w foo.x baz)); -# TEST #9 -- make sure that $< is set correctly in the face of order-only +# make sure that $< is set correctly in the face of order-only # prerequisites in pattern rules. run_make_test(' diff --git a/tests/scripts/features/patspecific_vars b/tests/scripts/features/patspecific_vars index a530bba1..a7c3c3bc 100644 --- a/tests/scripts/features/patspecific_vars +++ b/tests/scripts/features/patspecific_vars @@ -6,10 +6,9 @@ Create a makefile containing various flavors of pattern-specific variable settings, override and non-override, and using various variable expansion rules, semicolon interference, etc."; -open(MAKEFILE,"> $makefile"); +# basics -print MAKEFILE <<'EOF'; -all: one.x two.x three.x +run_make_test(q!all: one.x two.x three.x FOO = foo BAR = bar BAZ = baz @@ -29,50 +28,34 @@ a%: BBB += ddd %b: AAA += bbb .PHONY: ab ab: ; @echo $(AAA); echo $(BBB) -EOF +!, + "", "one.x: one two baz\ntwo.x: foo four baz\nthree.x: foo four three\n"); -close(MAKEFILE); +# try the override feature +run_make_test(undef, "BAZ=five", + "one.x: one two five\ntwo.x: foo four five\nthree.x: foo four three\n"); -# TEST #1 -- basics +# make sure patterns are inherited properly -&run_make_with_options($makefile, "", &get_logfile); -$answer = "one.x: one two baz\ntwo.x: foo four baz\nthree.x: foo four three\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "four.x", + "baz: foo two baz\nfour.x: foo two baz\n"); +# test multiple patterns matching the same target -# TEST #2 -- try the override feature +run_make_test(undef, "ab", "aaa bbb\nccc ddd\n"); -&run_make_with_options($makefile, "BAZ=five", &get_logfile); -$answer = "one.x: one two five\ntwo.x: foo four five\nthree.x: foo four three\n"; -&compare_output($answer,&get_logfile(1)); +# test pattern-specific exported variables - -# TEST #3 -- make sure patterns are inherited properly - -&run_make_with_options($makefile, "four.x", &get_logfile); -$answer = "baz: foo two baz\nfour.x: foo two baz\n"; -&compare_output($answer,&get_logfile(1)); - - -# TEST #4 -- test multiple patterns matching the same target - -&run_make_with_options($makefile, "ab", &get_logfile); -$answer = "aaa bbb\nccc ddd\n"; -&compare_output($answer,&get_logfile(1)); - -# TEST #5 -- test pattern-specific exported variables -# run_make_test(' /%: export foo := foo /bar: - @echo $(foo) $$foo +#TAB#@echo $(foo) $$foo ', '', 'foo foo'); +# test expansion of pattern-specific simple variables -# TEST #6 -- test expansion of pattern-specific simple variables -# run_make_test(' .PHONY: all @@ -112,15 +95,14 @@ global := new $$t 'normal: global: original $t pattern: inherit: ; pattern: global: original $t pattern: inherit: ;'); +# test expansion of pattern-specific recursive variables -# TEST #7 -- test expansion of pattern-specific recursive variables -# run_make_test(undef, # reuse previous makefile 'rec=1', 'normal: global: new $t pattern: good $t inherit: good $t; pattern: global: new $t pattern: good $t inherit: good $t;'); -# TEST #8: override in pattern-specific variables +# override in pattern-specific variables run_make_test(' a%: override FOO += f1 @@ -131,7 +113,7 @@ ab: ; @echo "$(FOO)" run_make_test(undef, 'FOO=C', "C f1\n"); -# TEST #9: Test shortest stem selection in pattern-specific variables. +# Test shortest stem selection in pattern-specific variables. run_make_test(' %-mt.x: x := two diff --git a/tests/scripts/features/statipattrules b/tests/scripts/features/statipattrules index e3b00acb..a3276594 100644 --- a/tests/scripts/features/statipattrules +++ b/tests/scripts/features/statipattrules @@ -79,8 +79,8 @@ all.foo.bar: %.foo.bar: %.one all.foo.bar: %.bar: %.two all.foo.bar: -> @echo $* -> @echo $^ +>#TAB#@echo $* +>#TAB#@echo $^ .DEFAULT:;@: ', @@ -102,8 +102,8 @@ all.foo.bar: %.foo.bar: %.one $$*-one all.foo.bar: %.bar: %.two $$*-two all.foo.bar: -> @echo $* -> @echo $^ +>#TAB#@echo $* +>#TAB#@echo $^ .DEFAULT:;@: ', diff --git a/tests/scripts/functions/andor b/tests/scripts/functions/andor index 62e0c2e0..806358b4 100644 --- a/tests/scripts/functions/andor +++ b/tests/scripts/functions/andor @@ -12,16 +12,16 @@ f = t = true all: - @echo 1 $(and ,$t) - @echo 2 $(and $t) - @echo 3 $(and $t,) - @echo 4 $(and z,true,$f,false) - @echo 5 $(and $t,$f,$(info bad short-circuit)) - @echo 6 $(and $(call NEQ,a,b),true) - @echo 7 $(and $(call NEQ,a,a),true) - @echo 8 $(and z,true,fal,se) hi - @echo 9 $(and ,true,fal,se)there - @echo 10 $(and $(e) ,$t)', +#TAB#@echo 1 $(and ,$t) +#TAB#@echo 2 $(and $t) +#TAB#@echo 3 $(and $t,) +#TAB#@echo 4 $(and z,true,$f,false) +#TAB#@echo 5 $(and $t,$f,$(info bad short-circuit)) +#TAB#@echo 6 $(and $(call NEQ,a,b),true) +#TAB#@echo 7 $(and $(call NEQ,a,a),true) +#TAB#@echo 8 $(and z,true,fal,se) hi +#TAB#@echo 9 $(and ,true,fal,se)there +#TAB#@echo 10 $(and $(e) ,$t)', '', "1\n2 true\n3\n4\n5\n6 true\n7\n8 se hi\n9 there\n10\n"); @@ -33,17 +33,17 @@ f = t = true all: - @echo 1 $(or , ) - @echo 2 $(or $t) - @echo 3 $(or ,$t) - @echo 4 $(or z,true,$f,false) - @echo 5 $(or $t,$(info bad short-circuit)) - @echo 6 $(or $(info short-circuit),$t) - @echo 7 $(or $(call NEQ,a,b),true) - @echo 8 $(or $(call NEQ,a,a),true) - @echo 9 $(or z,true,fal,se) hi - @echo 10 $(or ,true,fal,se)there - @echo 11 $(or $(e) ,$f)', +#TAB#@echo 1 $(or , ) +#TAB#@echo 2 $(or $t) +#TAB#@echo 3 $(or ,$t) +#TAB#@echo 4 $(or z,true,$f,false) +#TAB#@echo 5 $(or $t,$(info bad short-circuit)) +#TAB#@echo 6 $(or $(info short-circuit),$t) +#TAB#@echo 7 $(or $(call NEQ,a,b),true) +#TAB#@echo 8 $(or $(call NEQ,a,a),true) +#TAB#@echo 9 $(or z,true,fal,se) hi +#TAB#@echo 10 $(or ,true,fal,se)there +#TAB#@echo 11 $(or $(e) ,$f)', '', "short-circuit\n1\n2 true\n3 true\n4 z\n5 true\n6 true\n7 b\n8 true\n9 z hi\n10 truethere\n11\n"); diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call index dc1a6233..3591524b 100644 --- a/tests/scripts/functions/call +++ b/tests/scripts/functions/call @@ -35,7 +35,7 @@ DEP_foo = bar baz quux DEP_baz = quux blarp rest = $(wordlist 2,$(words ${1}),${1}) tclose = $(if $1,$(firstword $1)\ - $(call tclose,$(sort ${DEP_$(firstword $1)} $(call rest,$1)))) +#TAB##TAB#$(call tclose,$(sort ${DEP_$(firstword $1)} $(call rest,$1)))) all: ; @echo '$(call reverse,bar,foo)'; \ echo '$(call map,origin,MAKE reverse map)'; \ @@ -44,7 +44,7 @@ all: ; @echo '$(call reverse,bar,foo)'; \ echo '$(call my-foreach,a,,,)'; \ echo '$(call my-if,a,b,c)'; \ echo '$(call two,bar,baz)'; \ - echo '$(call tclose,foo)'; +#TAB#echo '$(call tclose,foo)'; !, "", "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\nfoo bar baz blarp quux \n"); @@ -67,10 +67,10 @@ level2 = $(call level1,$1,$2,$3) level3 = $(call level2,$1,$2,$3,$4,$5) all: - @echo $(call all,1,2,3,4,5,6,7,8,9,10,11) - @echo $(call level1,1,2,3,4,5,6,7,8) - @echo $(call level2,1,2,3,4,5,6,7,8) - @echo $(call level3,1,2,3,4,5,6,7,8) +#TAB#@echo $(call all,1,2,3,4,5,6,7,8,9,10,11) +#TAB#@echo $(call level1,1,2,3,4,5,6,7,8) +#TAB#@echo $(call level2,1,2,3,4,5,6,7,8) +#TAB#@echo $(call level3,1,2,3,4,5,6,7,8) !, "", "1 2 3 4 5 6 7 8 9\n1 2 3 4 5\n1 2 3\n1 2 3\n"); @@ -78,15 +78,11 @@ all: delete $ENV{X123}; -run_make_test(' +run_make_test(q! tst = $(eval export X123) $(call tst) all: ; @echo "$${X123-not set}" -', +!, '', "\n"); 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/functions/error b/tests/scripts/functions/error index 998afe48..bb97dbf3 100644 --- a/tests/scripts/functions/error +++ b/tests/scripts/functions/error @@ -5,9 +5,9 @@ The following test creates a makefile to test the error function."; $details = ""; -open(MAKEFILE,"> $makefile"); +# Test #1 -print MAKEFILE 'err = $(error Error found!) +run_make_test(q!err = $(error Error found) ifdef ERROR1 $(error error is $(ERROR1)) @@ -23,49 +23,33 @@ endif ifdef ERROR4 all: some; @echo error is $(ERROR4) - @echo $(error error is $(ERROR4)) +#TAB#@echo $(error error is $(ERROR4)) endif some: ; @echo Some stuff testvar: ; @: $(err) -'; - -close(MAKEFILE); - -# Test #1 - -&run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512); -$answer = "$makefile:4: *** error is yes. Stop.\n"; -&compare_output($answer,&get_logfile(1)); +!, + "ERROR1=yes", "#MAKEFILE#:4: *** error is yes. Stop.\n", 512); # Test #2 -&run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512); -$answer = "$makefile:8: *** error is no. Stop.\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "ERROR2=no", "#MAKEFILE#:8: *** error is no. Stop.\n", 512); # Test #3 -&run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512); -$answer = "Some stuff\n$makefile:12: *** error is maybe. Stop.\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "ERROR3=maybe", + "Some stuff\n#MAKEFILE#:12: *** error is maybe. Stop.\n", 512); # Test #4 -&run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512); -$answer = "Some stuff\n$makefile:17: *** error is definitely. Stop.\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "ERROR4=definitely", + "Some stuff\n#MAKEFILE#:17: *** error is definitely. Stop.\n", 512); # Test #5 -&run_make_with_options($makefile, "testvar", &get_logfile, 512); -$answer = "$makefile:22: *** Error found!. Stop.\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "testvar", + "#MAKEFILE#:22: *** Error found. Stop.\n", 512); # This tells the test driver that the perl test script executed properly. 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/functions/eval b/tests/scripts/functions/eval index 4a432fe7..b5a19063 100644 --- a/tests/scripts/functions/eval +++ b/tests/scripts/functions/eval @@ -150,7 +150,7 @@ $(eval $(FOO)) run_make_test(' define FOO all: ; @echo '."'".'he\llo'."'".' - @echo world +#TAB#@echo world endef $(eval $(FOO)) ', '', 'he\llo diff --git a/tests/scripts/functions/sort b/tests/scripts/functions/sort index e6e1343d..724f6f0f 100644 --- a/tests/scripts/functions/sort +++ b/tests/scripts/functions/sort @@ -12,24 +12,24 @@ remove all duplicates\n"; run_make_test(' foo := moon_light days foo1:= jazz -bar := captured -bar2 = boy end, has rise A midnight +bar := captured#SPACE# +bar2 = boy end, has rise A midnight#SPACE# bar3:= $(foo) s1 := _by s2 := _and_a t1 := $(addsuffix $(s1), $(bar) ) t2 := $(addsuffix $(s2), $(foo1) ) -t3 := $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) -t4 := $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) -t5 := $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) -t6 := $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) -t7 := $(t6) $(t6) $(t6) +t3 := $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2)#SPACE# +t4 := $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3)#SPACE# +t5 := $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4)#SPACE# +t6 := $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5)#SPACE# +t7 := $(t6) $(t6) $(t6)#SPACE# p1 := $(addprefix $(foo1), $(s2) ) -blank:= +blank:=#SPACE# all: - @echo $(sort $(bar2) $(foo) $(addsuffix $(s1), $(bar) ) $(t2) $(bar2) $(bar3)) - @echo $(sort $(blank) $(foo) $(bar2) $(t1) $(p1) ) - @echo $(sort $(foo) $(bar2) $(t1) $(t4) $(t5) $(t7) $(t6) ) +#TAB#@echo $(sort $(bar2) $(foo) $(addsuffix $(s1), $(bar) ) $(t2) $(bar2) $(bar3)) +#TAB#@echo $(sort $(blank) $(foo) $(bar2) $(t1) $(p1) ) +#TAB#@echo $(sort $(foo) $(bar2) $(t1) $(t4) $(t5) $(t7) $(t6) ) ', '', 'A boy captured_by days end, has jazz_and_a midnight moon_light rise A boy captured_by days end, has jazz_and_a midnight moon_light rise @@ -45,7 +45,3 @@ all: ; \@echo \$(words \$(sort \$(FOO)))\n", '', "6\n"); 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/functions/strip b/tests/scripts/functions/strip index 8222433f..f7987ef4 100644 --- a/tests/scripts/functions/strip +++ b/tests/scripts/functions/strip @@ -7,18 +7,14 @@ $details = "The make file is built with a list of objects that contain white spa These are then run through the strip command to remove it. This is then verified by echoing the result.\n"; -open(MAKEFILE,"> $makefile"); - -# The Contents of the MAKEFILE ... - -print MAKEFILE <<'EOMAKE'; -TEST1 := "Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING..." +# Zippy the Pinhead quotes... +run_make_test(q!TEST1 := "Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING..." E := -TEST2 := $E try this and this $E +TEST2 := $E try this and#TAB##TAB#this #TAB#$E define TEST3 -and these test out +and these#TAB# test out some @@ -30,28 +26,18 @@ endef .PHONY: all all: - @echo '$(strip $(TEST1) )' - @echo '$(strip $(TEST2) )' - @echo '$(strip $(TEST3) )' - -space: ; @echo '$(strip ) $(strip )' - -EOMAKE - -# END of Contents of MAKEFILE - -close(MAKEFILE); - -&run_make_with_options($makefile,"",&get_logfile); -$answer = "\"Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING...\" +#TAB#@echo '$(strip $(TEST1) )' +#TAB#@echo '$(strip $(TEST2) )' +#TAB#@echo '$(strip $(TEST3) )' +!, + "", "\"Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING...\" try this and this and these test out some blank lines -"; -&compare_output($answer,&get_logfile(1)); - +"); -&run_make_with_options($makefile,"space",&get_logfile); -$answer = " \n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(q! +space: ; @echo '$(strip ) $(strip #TAB# )' +!, + "", " \n"); 1; diff --git a/tests/scripts/functions/warning b/tests/scripts/functions/warning index 16eb83bb..57db2583 100644 --- a/tests/scripts/functions/warning +++ b/tests/scripts/functions/warning @@ -5,10 +5,7 @@ The following test creates a makefile to test the warning function."; $details = ""; -open(MAKEFILE,"> $makefile"); - -print MAKEFILE <<'EOF'; -ifdef WARNING1 +run_make_test(q!ifdef WARNING1 $(warning warning is $(WARNING1)) endif @@ -22,51 +19,34 @@ endif ifdef WARNING4 all: some; @echo hi - @echo there $(warning warning is $(WARNING4)) +#TAB#@echo there $(warning warning is $(WARNING4)) endif some: ; @echo Some stuff +!, + "WARNING1=yes", "#MAKEFILE#:2: warning is yes\nSome stuff\n"); -EOF - -close(MAKEFILE); - -# Test #1 - -&run_make_with_options($makefile, "WARNING1=yes", &get_logfile, 0); -$answer = "$makefile:2: warning is yes\nSome stuff\n"; -&compare_output($answer,&get_logfile(1)); - -# Test #2 - -&run_make_with_options($makefile, "WARNING2=no", &get_logfile, 0); -$answer = "$makefile:6: warning is no\nSome stuff\n"; -&compare_output($answer,&get_logfile(1)); - -# Test #3 - -&run_make_with_options($makefile, "WARNING3=maybe", &get_logfile, 0); -$answer = "Some stuff\n$makefile:10: warning is maybe\nhi\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "WARNING2=no", + "#MAKEFILE#:6: warning is no\nSome stuff\n"); -# Test #4 +run_make_test(undef, "WARNING3=maybe", + "Some stuff\n#MAKEFILE#:10: warning is maybe\nhi\n"); -&run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0); -$answer = "Some stuff\n$makefile:15: warning is definitely\nhi\nthere\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "WARNING4=definitely", + "Some stuff\n#MAKEFILE#:15: warning is definitely\nhi\nthere\n"); # Test linenumber offset run_make_test(q! all: one two - $(warning in $@ line 3) - @true - $(warning in $@ line 5) +#TAB#$(warning in $@ line 3) +#TAB#@true +#TAB#$(warning in $@ line 5) one two: - $(warning in $@ line 8) - @true - $(warning in $@ line 10) +#TAB#$(warning in $@ line 8) +#TAB#@true +#TAB#$(warning in $@ line 10) !, '', "#MAKEFILE#:8: in one line 8 #MAKEFILE#:10: in one line 10 @@ -77,7 +57,3 @@ one two: # This tells the test driver that the perl test script executed properly. 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/misc/general3 b/tests/scripts/misc/general3 index 455027aa..44852851 100644 --- a/tests/scripts/misc/general3 +++ b/tests/scripts/misc/general3 @@ -5,7 +5,7 @@ This tests random features of the parser that need to be supported, and which have either broken at some point in the past or seem likely to break."; -run_make_test(" +run_make_test(q! # We want to allow both empty commands _and_ commands that resolve to empty. EMPTY = @@ -14,18 +14,18 @@ all: a1 a2 a3 a4 a1:; a2: -\t -a3:;\$(EMPTY) +#TAB# +a3:;$(EMPTY) a4: -\t\$(EMPTY) +#TAB#$(EMPTY) -\# Non-empty lines that expand to nothing should also be ignored. -STR = \# Some spaces -TAB = \t \# A TAB and some spaces +# Non-empty lines that expand to nothing should also be ignored. +STR = # Some spaces +TAB = #TAB# # A TAB and some spaces -\$(STR) +$(STR) -\$(STR) \$(TAB)", +$(STR) $(TAB)!, '', "#MAKE#: Nothing to be done for 'all'."); # TEST 2 @@ -47,10 +47,10 @@ $answer = "FOO = foo\n"; # Check semicolons in variable references -run_make_test(' +run_make_test(q! $(if true,$(info true; true)) all: ; @: -', +!, '', 'true; true'); # TEST 4 @@ -59,25 +59,25 @@ all: ; @: # Checks Savannah bug # 1332. # Test the fastpath / no quotes -run_make_test(' +run_make_test(q! all: - @echo foo\ +#TAB#@echo foo\ bar - @echo foo\ - bar - @echo foo\ +#TAB#@echo foo\ +#TAB#bar +#TAB#@echo foo\ bar - @echo foo\ - bar - @echo foo \ +#TAB#@echo foo\ +#TAB# bar +#TAB#@echo foo \ bar - @echo foo \ - bar - @echo foo \ +#TAB#@echo foo \ +#TAB#bar +#TAB#@echo foo \ bar - @echo foo \ - bar -', +#TAB#@echo foo \ +#TAB# bar +!, '', 'foobar foobar foo bar @@ -92,22 +92,22 @@ foo bar'); if ($port_type ne 'W32') { run_make_test(q! all: - @echo 'foo\ +#TAB#@echo 'foo\ bar' - @echo 'foo\ - bar' - @echo 'foo\ +#TAB#@echo 'foo\ +#TAB#bar' +#TAB#@echo 'foo\ bar' - @echo 'foo\ - bar' - @echo 'foo \ +#TAB#@echo 'foo\ +#TAB# bar' +#TAB#@echo 'foo \ bar' - @echo 'foo \ - bar' - @echo 'foo \ +#TAB#@echo 'foo \ +#TAB#bar' +#TAB#@echo 'foo \ bar' - @echo 'foo \ - bar' +#TAB#@echo 'foo \ +#TAB# bar' !, '', 'foo\ bar @@ -128,25 +128,25 @@ foo \ } # Test the fastpath / double quotes -run_make_test(' +run_make_test(q! all: - @echo "foo\ +#TAB#@echo "foo\ bar" - @echo "foo\ - bar" - @echo "foo\ +#TAB#@echo "foo\ +#TAB#bar" +#TAB#@echo "foo\ bar" - @echo "foo\ - bar" - @echo "foo \ +#TAB#@echo "foo\ +#TAB# bar" +#TAB#@echo "foo \ bar" - @echo "foo \ - bar" - @echo "foo \ +#TAB#@echo "foo \ +#TAB#bar" +#TAB#@echo "foo \ bar" - @echo "foo \ - bar" -', +#TAB#@echo "foo \ +#TAB# bar" +!, '', 'foobar foobar foo bar @@ -157,25 +157,25 @@ foo bar foo bar'); # Test the slow path / no quotes -run_make_test(' +run_make_test(q! all: - @echo hi; echo foo\ +#TAB#@echo hi; echo foo\ bar - @echo hi; echo foo\ - bar - @echo hi; echo foo\ +#TAB#@echo hi; echo foo\ +#TAB#bar +#TAB#@echo hi; echo foo\ bar - @echo hi; echo foo\ - bar - @echo hi; echo foo \ +#TAB#@echo hi; echo foo\ +#TAB# bar +#TAB#@echo hi; echo foo \ bar - @echo hi; echo foo \ - bar - @echo hi; echo foo \ +#TAB#@echo hi; echo foo \ +#TAB#bar +#TAB#@echo hi; echo foo \ bar - @echo hi; echo foo \ - bar -', +#TAB#@echo hi; echo foo \ +#TAB# bar +!, '', 'hi foobar hi @@ -195,25 +195,25 @@ foo bar'); # Test the slow path / no quotes. This time we put the slow path # determination _after_ the backslash-newline handling. -run_make_test(' +run_make_test(q! all: - @echo foo\ +#TAB#@echo foo\ bar; echo hi - @echo foo\ - bar; echo hi - @echo foo\ +#TAB#@echo foo\ +#TAB#bar; echo hi +#TAB#@echo foo\ bar; echo hi - @echo foo\ - bar; echo hi - @echo foo \ +#TAB#@echo foo\ +#TAB# bar; echo hi +#TAB#@echo foo \ bar; echo hi - @echo foo \ - bar; echo hi - @echo foo \ +#TAB#@echo foo \ +#TAB#bar; echo hi +#TAB#@echo foo \ bar; echo hi - @echo foo \ - bar; echo hi -', +#TAB#@echo foo \ +#TAB# bar; echo hi +!, '', 'foobar hi foobar @@ -234,22 +234,22 @@ hi'); # Test the slow path / single quotes run_make_test(q! all: - @echo hi; echo 'foo\ +#TAB#@echo hi; echo 'foo\ bar' - @echo hi; echo 'foo\ - bar' - @echo hi; echo 'foo\ +#TAB#@echo hi; echo 'foo\ +#TAB#bar' +#TAB#@echo hi; echo 'foo\ bar' - @echo hi; echo 'foo\ - bar' - @echo hi; echo 'foo \ +#TAB#@echo hi; echo 'foo\ +#TAB# bar' +#TAB#@echo hi; echo 'foo \ bar' - @echo hi; echo 'foo \ - bar' - @echo hi; echo 'foo \ +#TAB#@echo hi; echo 'foo \ +#TAB#bar' +#TAB#@echo hi; echo 'foo \ bar' - @echo hi; echo 'foo \ - bar' +#TAB#@echo hi; echo 'foo \ +#TAB# bar' !, '', 'hi foo\ @@ -277,25 +277,25 @@ foo \ bar'); # Test the slow path / double quotes -run_make_test(' +run_make_test(q! all: - @echo hi; echo "foo\ +#TAB#@echo hi; echo "foo\ bar" - @echo hi; echo "foo\ - bar" - @echo hi; echo "foo\ +#TAB#@echo hi; echo "foo\ +#TAB#bar" +#TAB#@echo hi; echo "foo\ bar" - @echo hi; echo "foo\ - bar" - @echo hi; echo "foo \ +#TAB#@echo hi; echo "foo\ +#TAB# bar" +#TAB#@echo hi; echo "foo \ bar" - @echo hi; echo "foo \ - bar" - @echo hi; echo "foo \ +#TAB#@echo hi; echo "foo \ +#TAB#bar" +#TAB#@echo hi; echo "foo \ bar" - @echo hi; echo "foo \ - bar" -', +#TAB#@echo hi; echo "foo \ +#TAB# bar" +!, '', 'hi foobar hi @@ -341,7 +341,3 @@ if ($port_type ne 'W32') { } 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/options/dash-B b/tests/scripts/options/dash-B index 6a36e8d4..cd334f9d 100644 --- a/tests/scripts/options/dash-B +++ b/tests/scripts/options/dash-B @@ -10,16 +10,16 @@ is built again."; &touch('bar.x'); -run_make_test(' +run_make_test(q! .SUFFIXES: .PHONY: all all: foo foo: bar.x - @echo cp $< $@ - @echo "" > $@ -', +#TAB#@echo cp $< $@ +#TAB#@echo "" > $@ +!, '', 'cp bar.x foo'); run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'."); @@ -39,12 +39,12 @@ rmfiles('bar.x', 'foo'); # Test -B with the re-exec feature: we don't want to re-exec forever # Savannah bug # 7566 -run_make_test(' +run_make_test(q! all: ; @: $(info MAKE_RESTARTS=$(MAKE_RESTARTS)) include foo.x foo.x: ; @touch $@ -', +!, '-B', 'MAKE_RESTARTS= MAKE_RESTARTS=1'); @@ -55,13 +55,13 @@ rmfiles('foo.x'); &touch('blah.x'); -run_make_test(' +run_make_test(q! all: blah.x ; @echo $@ $(info MAKE_RESTARTS=$(MAKE_RESTARTS)) include foo.x foo.x: ; @touch $@ blah.x: ; @echo $@ -', +!, '-B', 'MAKE_RESTARTS= MAKE_RESTARTS=1 blah.x @@ -82,7 +82,3 @@ x.a: x.b ; @echo $? unlink(qw(x.a x.b)); 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/options/dash-W b/tests/scripts/options/dash-W index fe4d2355..1e4d3a2c 100644 --- a/tests/scripts/options/dash-W +++ b/tests/scripts/options/dash-W @@ -4,10 +4,10 @@ $description = "Test make -W (what if) option.\n"; # Basic build -run_make_test(' +run_make_test(q! a.x: b.x a.x b.x: ; echo >> $@ -', +!, '', "echo >> b.x\necho >> a.x"); # Run it again: nothing should happen @@ -34,15 +34,15 @@ rmfiles('a.x', 'b.x'); # First set it up with a normal build -run_make_test(' +run_make_test(q! all: baz.x ; @: include foo.x foo.x: bar.x - @echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@ - @echo "touch $@" +#TAB#@echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@ +#TAB#@echo "touch $@" bar.x: ; echo >> $@ baz.x: bar.x ; @echo "touch $@" -', +!, '', 'echo >> bar.x touch foo.x restarts=1 @@ -66,17 +66,17 @@ mkdir('x-dir', 0777); utouch(-20, 'x-dir/x'); touch('y'); -run_make_test(' +run_make_test(q! y: x ; @echo cp $< $@ -', +!, '-W x-dir/x VPATH=x-dir', 'cp x-dir/x y'); # Make sure ./ stripping doesn't interfere with the match. -run_make_test(' +run_make_test(q! y: x ; @echo cp $< $@ -', +!, '-W ./x-dir/x VPATH=x-dir', 'cp x-dir/x y'); @@ -88,7 +88,3 @@ unlink(qw(y x-dir/x)); rmdir('x-dir'); 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/targets/ONESHELL b/tests/scripts/targets/ONESHELL index 0ae9b5b7..1ea6e178 100644 --- a/tests/scripts/targets/ONESHELL +++ b/tests/scripts/targets/ONESHELL @@ -18,8 +18,8 @@ if ($port_type ne 'W32') { run_make_test(q! .ONESHELL: all: - a=$$$$ - [ 0"$$a" -eq "$$$$" ] || echo fail +#TAB#a=$$$$ +#TAB#[ 0"$$a" -eq "$$$$" ] || echo fail !, '', 'a=$$ [ 0"$a" -eq "$$" ] || echo fail @@ -32,8 +32,8 @@ if ($multi_ok) { .ONESHELL: .SHELLFLAGS = -e -c all: - a=$$$$ - [ 0"$$a" -eq "$$$$" ] || echo fail +#TAB#a=$$$$ +#TAB#[ 0"$$a" -eq "$$$$" ] || echo fail !, '', 'a=$$ [ 0"$a" -eq "$$" ] || echo fail @@ -45,8 +45,8 @@ all: run_make_test(q! .ONESHELL: all: - a=$$$$ - @-+ [ 0"$$a" -eq "$$$$" ] || echo fail +#TAB#a=$$$$ +#TAB#@-+ [ 0"$$a" -eq "$$$$" ] || echo fail !, '', 'a=$$ [ 0"$a" -eq "$$" ] || echo fail @@ -57,8 +57,8 @@ all: run_make_test(q! .ONESHELL: all: - @a=$$$$ - [ 0"$$a" -eq "$$$$" ] || echo fail +#TAB# @a=$$$$ +#TAB# [ 0"$$a" -eq "$$$$" ] || echo fail !, '', ''); @@ -68,8 +68,8 @@ all: run_make_test(q! .ONESHELL: all: - @a=$$$$ - -@ +[ 0"$$a" -eq "$$$$" ] || echo fail +#TAB# @a=$$$$ +#TAB# -@ +[ 0"$$a" -eq "$$$$" ] || echo fail !, '', ''); @@ -83,9 +83,9 @@ if ($port_type ne 'W32') { SHELL = #PERL# .SHELLFLAGS = -e all: -> @$$a=5 -> +7; -> @y=qw(a b c); +>#TAB# @$$a=5 +>#TAB# +7; +>#TAB#@y=qw(a b c); >print "a = $$a, y = (@y)\n"; !, '', "a = 12, y = (a b c)\n"); @@ -137,7 +137,3 @@ all:; @print "it works: $$foo\n" # This tells the test driver that the perl test script executed properly. 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: diff --git a/tests/scripts/variables/MAKE b/tests/scripts/variables/MAKE index dc621606..a9da41e7 100644 --- a/tests/scripts/variables/MAKE +++ b/tests/scripts/variables/MAKE @@ -1,4 +1,4 @@ -# -*-perl-*- +# -*-perl-*- $description = "Test proper behavior of the MAKE variable"; @@ -8,11 +8,11 @@ run_make_test(q! TMP := $(MAKE) MAKE := $(subst X=$(X),,$(MAKE)) all: - @echo $(TMP) - $(MAKE) -f #MAKEFILE# foo +#TAB#@echo $(TMP) +#TAB#$(MAKE) -f #MAKEFILE# foo foo: - @echo $(MAKE) +#TAB#@echo $(MAKE) !, '', "#MAKEPATH#\n#MAKEPATH# -f #MAKEFILE# foo\n" diff --git a/tests/scripts/variables/MAKECMDGOALS b/tests/scripts/variables/MAKECMDGOALS index 879283b0..c3b50f5f 100644 --- a/tests/scripts/variables/MAKECMDGOALS +++ b/tests/scripts/variables/MAKECMDGOALS @@ -6,47 +6,16 @@ $details = "\ We construct a makefile with various targets, all of which print out \$(MAKECMDGOALS), then call it different ways."; -open(MAKEFILE,"> $makefile"); -print MAKEFILE "\ +run_make_test(q! .DEFAULT all: - \@echo \$(MAKECMDGOALS) -"; -close(MAKEFILE); +#TAB#@echo $(MAKECMDGOALS) +!, + '', "\n"); -# TEST #1 - -&run_make_with_options($makefile, - "", - &get_logfile, - 0); -$answer = "\n"; -&compare_output($answer,&get_logfile(1)); - -# TEST #2 - -&run_make_with_options($makefile, - "all", - &get_logfile, - 0); -$answer = "all\n"; -&compare_output($answer,&get_logfile(1)); - - -# TEST #3 - -&run_make_with_options($makefile, - "foo bar baz yaz", - &get_logfile, - 0); -$answer = "foo bar baz yaz\nfoo bar baz yaz\nfoo bar baz yaz\nfoo bar baz yaz\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "all", "all\n"); +run_make_test(undef, "foo bar baz yaz", + "foo bar baz yaz\nfoo bar baz yaz\nfoo bar baz yaz\nfoo bar baz yaz\n"); # This tells the test driver that the perl test script executed properly. 1; - - - - - - diff --git a/tests/scripts/variables/automatic b/tests/scripts/variables/automatic index 771bbda8..d64518d8 100644 --- a/tests/scripts/variables/automatic +++ b/tests/scripts/variables/automatic @@ -9,51 +9,38 @@ use Cwd; $dir = cwd; $dir =~ s,.*/([^/]+)$,../$1,; -open(MAKEFILE, "> $makefile"); -print MAKEFILE "dir = $dir\n"; -print MAKEFILE <<'EOF'; +# simple test +# Touch these into the past +&utouch(-10, qw(foo.x baz.z)); + +run_make_test(q! .SUFFIXES: .SUFFIXES: .x .y .z $(dir)/foo.x : baz.z $(dir)/bar.y baz.z - @echo '$$@ = $@, $$(@D) = $(@D), $$(@F) = $(@F)' - @echo '$$* = $*, $$(*D) = $(*D), $$(*F) = $(*F)' - @echo '$$< = $<, $$( $makefile2"); -print MAKEFILE "dir = $dir\n"; -print MAKEFILE <<'EOF'; +run_make_test(q! .SECONDEXPANSION: .SUFFIXES: .DEFAULT: ; @echo '$@' @@ -63,21 +50,14 @@ $(dir)/foo $(dir)/bar: $@.x $$@.x $$$@.x $$$$@.x $$(@D).x $$(@F).x $(dir)/x.z $(dir)/y.z: $(dir)/%.z : $@.% $$@.% $$$@.% $$$$@.% $$(@D).% $$(@F).% $(dir)/biz: $$(@).x $${@}.x $${@D}.x $${@F}.x -EOF - -close(MAKEFILE); - -&run_make_with_options($makefile2, "$dir/foo $dir/bar", &get_logfile); -$answer = ".x\n$dir/foo.x\nx\n\$@.x\n$dir.x\nfoo.x\n$dir/bar.x\nbar.x\n"; -&compare_output($answer, &get_logfile(1)); +!, + "dir=$dir $dir/foo $dir/bar", + ".x\n$dir/foo.x\nx\n\$@.x\n$dir.x\nfoo.x\n$dir/bar.x\nbar.x\n"); -&run_make_with_options($makefile2, "$dir/x.z $dir/y.z", &get_logfile); -$answer = ".x\n$dir/x.z.x\nx\n\$@.x\n$dir.x\nx.z.x\n.y\n$dir/y.z.y\ny\n\$@.y\n$dir.y\ny.z.y\n"; -&compare_output($answer, &get_logfile(1)); +run_make_test(undef, "dir=$dir $dir/x.z $dir/y.z", + ".x\n$dir/x.z.x\nx\n\$@.x\n$dir.x\nx.z.x\n.y\n$dir/y.z.y\ny\n\$@.y\n$dir.y\ny.z.y\n"); -&run_make_with_options($makefile2, "$dir/biz", &get_logfile); -$answer = "$dir/biz.x\n$dir.x\nbiz.x\n"; -&compare_output($answer, &get_logfile(1)); +run_make_test(undef, "dir=$dir $dir/biz", "$dir/biz.x\n$dir.x\nbiz.x\n"); # TEST #2 -- test for Savannah bug #12320. # @@ -85,7 +65,7 @@ run_make_test(' .SUFFIXES: .b .src mbr.b: mbr.src - @echo $* +#TAB#@echo $* mbr.src: ; @:', '', @@ -99,7 +79,7 @@ run_make_test(' p:=mbr.src mbr.b: $$p - @echo $* +#TAB#@echo $* mbr.src: ; @:', '', @@ -109,7 +89,7 @@ mbr.src: ; @:', run_make_test(' mbr.b: mbr.src - @echo star=$* +#TAB#@echo star=$* mbr.src: ; @:', '', diff --git a/tests/scripts/variables/define b/tests/scripts/variables/define index eecbd8f3..ad978b9e 100644 --- a/tests/scripts/variables/define +++ b/tests/scripts/variables/define @@ -52,10 +52,10 @@ endef FOO = there all: ; $(multi) - $(simple) - $(posix) - $(append) - $(cond) +#TAB#$(simple) +#TAB#$(posix) +#TAB#$(append) +#TAB#$(cond) ', '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n"); @@ -99,11 +99,11 @@ endef FOO = there all: ; $(multi) - $(simple) - $(posix) - $(posixbsd) - $(append) - $(cond) +#TAB#$(simple) +#TAB#$(posix) +#TAB#$(posixbsd) +#TAB#$(append) +#TAB#$(cond) !, '', "echo hi\nhi\nthere\nfoo\nfoo\nfoo\$bar\na\nb\nfirst\n"); diff --git a/tests/scripts/variables/special b/tests/scripts/variables/special index e05f6ab6..c111c1a0 100644 --- a/tests/scripts/variables/special +++ b/tests/scripts/variables/special @@ -4,7 +4,7 @@ $description = "Test special GNU Make variables."; $details = ""; -&run_make_test(' +run_make_test(q! X1 := $(sort $(filter FOO BAR,$(.VARIABLES))) @@ -15,12 +15,12 @@ X2 := $(sort $(filter FOO BAR,$(.VARIABLES))) BAR := bar all: ; @echo X1 = $(X1); echo X2 = $(X2); echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) -', +!, '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n"); # SV 45728: Test that undefining a variable is reflected properly -&run_make_test(' +run_make_test(q! FOO := foo BAR := bar $(info one: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) @@ -28,7 +28,7 @@ undefine BAR BAZ := baz $(info two: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) all:;@: -', +!, '', "one: BAR FOO\ntwo: BAZ FOO\n"); # $makefile2 = &get_tmpfile; @@ -39,9 +39,9 @@ all:;@: # X1 := $(sort $(.TARGETS)) # all: foo -# @echo X1 = $(X1) -# @echo X2 = $(X2) -# @echo LAST = $(sort $(.TARGETS)) +##TAB#@echo X1 = $(X1) +##TAB#@echo X2 = $(X2) +##TAB#@echo LAST = $(sort $(.TARGETS)) # X2 := $(sort $(.TARGETS)) @@ -59,46 +59,46 @@ all:;@: # &compare_output($answer, &get_logfile(1)); # Test the .RECIPEPREFIX variable -&run_make_test(' +run_make_test(q! define foo : foo-one\ foo-two : foo-three - : foo-four +#TAB#: foo-four endef orig: ; : orig-one - : orig-two \ +#TAB#: orig-two \ orig-three \ - orig-four \ - orig-five \\\\ - : orig-six - $(foo) +#TAB#orig-four \ +#TAB##TAB#orig-five \\\\ +#TAB#: orig-six +#TAB#$(foo) .RECIPEPREFIX = > test: ; : test-one >: test-two \ test-three \ >test-four \ -> test-five \\\\ +>#TAB#test-five \\\\ >: test-six >$(foo) .RECIPEPREFIX = reset: ; : reset-one - : reset-two \ +#TAB#: reset-two \ reset-three \ - reset-four \ - reset-five \\\\ - : reset-six - $(foo) -', +#TAB#reset-four \ +#TAB##TAB#reset-five \\\\ +#TAB#: reset-six +#TAB#$(foo) +!, 'orig test reset', ': orig-one : orig-two \ orig-three \ orig-four \ - orig-five \\\\ +#TAB#orig-five \\\\ : orig-six : foo-one foo-two : foo-three @@ -107,7 +107,7 @@ orig-four \ : test-two \ test-three \ test-four \ - test-five \\\\ +#TAB#test-five \\\\ : test-six : foo-one foo-two : foo-three @@ -116,14 +116,10 @@ test-four \ : reset-two \ reset-three \ reset-four \ - reset-five \\\\ +#TAB#reset-five \\\\ : reset-six : foo-one foo-two : foo-three : foo-four'); 1; - -### Local Variables: -### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) -### End: