diff options
Diffstat (limited to 'tests/scripts/functions')
-rw-r--r-- | tests/scripts/functions/call | 13 | ||||
-rw-r--r-- | tests/scripts/functions/sort | 98 | ||||
-rw-r--r-- | tests/scripts/functions/wildcard | 12 |
3 files changed, 54 insertions, 69 deletions
diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call index 98f1d921..f3c54708 100644 --- a/tests/scripts/functions/call +++ b/tests/scripts/functions/call @@ -38,7 +38,7 @@ two = $(call one,$(1),foo,$(2)) DEP_foo = bar baz quux DEP_baz = quux blarp rest = $(wordlist 2,$(words ${1}),${1}) -tclose = $(if $1,$(firstword $1)\ +tclose = $(if $1,$(firstword $1) \ $(call tclose,$(sort ${DEP_$(firstword $1)} $(call rest,$1)))) all: ; @echo '$(call reverse,bar,foo)'; \ @@ -96,15 +96,4 @@ close(MAKEFILE); $answer = "1 2 3 4 5 6 7 8 9\n1 2 3 4 5\n1 2 3\n1 2 3\n"; &compare_output($answer,&get_logfile(1)); -# Ensure that variables are defined in global scope even in a $(call ...) - -delete $ENV{X123}; - -run_make_test(' -tst = $(eval export X123) -$(call tst) -all: ; @echo "$${X123-not set}" -', - '', "\n"); - 1; diff --git a/tests/scripts/functions/sort b/tests/scripts/functions/sort index b5589103..d472102d 100644 --- a/tests/scripts/functions/sort +++ b/tests/scripts/functions/sort @@ -1,47 +1,55 @@ -# -*-perl-*- - -$description = "The following test creates a makefile to verify -the ability of make to sort lists of object. Sort -will also remove any duplicate entries. This will also -be tested."; - -$details = "The make file is built with a list of object in a random order -and includes some duplicates. Make should sort all of the elements -remove all duplicates\n"; - -run_make_test(' -foo := moon_light days -foo1:= jazz -bar := captured -bar2 = boy end, has rise A midnight -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) -p1 := $(addprefix $(foo1), $(s2) ) -blank:= -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) ) -', - '', '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 -A boy captured_by days end, has jazz_and_a midnight moon_light rise -'); - - -# Test with non-space/tab whitespace. Note that you can't see the -# original bug except using valgrind. - -run_make_test("FOO = a b\tc\rd\fe \f \f \f \f \ff -all: ; \@echo \$(words \$(sort \$(FOO)))\n", - '', "5\n"); +$description = "The following test creates a makefile to verify\n" + ."the ability of make to sort lists of object. Sort\n" + ."will also remove any duplicate entries. This will also\n" + ."be tested."; + +$details = "The make file is built with a list of object in a random order\n" + ."and includes some duplicates. Make should sort all of the elements\n" + ."remove all duplicates\n"; + +open(MAKEFILE,"> $makefile"); + +# The Contents of the MAKEFILE ... + +print MAKEFILE "foo := moon_light days \n" + ."foo1:= jazz\n" + ."bar := captured \n" + ."bar2 = boy end, has rise A midnight \n" + ."bar3:= \$(foo)\n" + ."s1 := _by\n" + ."s2 := _and_a\n" + ."t1 := \$(addsuffix \$(s1), \$(bar) )\n" + ."t2 := \$(addsuffix \$(s2), \$(foo1) )\n" + ."t3 := \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \n" + ."t4 := \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \n" + ."t5 := \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \n" + ."t6 := \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \n" + ."t7 := \$(t6) \$(t6) \$(t6) \n" + ."p1 := \$(addprefix \$(foo1), \$(s2) )\n" + ."blank:= \n" + ."all:\n" + ."\t\@echo \$(sort \$(bar2) \$(foo) \$(addsuffix \$(s1), \$(bar) ) \$(t2) \$(bar2) \$(bar3))\n" + ."\t\@echo \$(sort \$(blank) \$(foo) \$(bar2) \$(t1) \$(p1) )\n" + ."\t\@echo \$(sort \$(foo) \$(bar2) \$(t1) \$(t4) \$(t5) \$(t7) \$(t6) )\n"; + + +# 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 = "A boy captured_by days end, has jazz_and_a midnight moon_light rise\n" + ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n" + ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"; + +&compare_output($answer,&get_logfile(1)); 1; + + + + + + diff --git a/tests/scripts/functions/wildcard b/tests/scripts/functions/wildcard index bcd84ad7..2841f5d5 100644 --- a/tests/scripts/functions/wildcard +++ b/tests/scripts/functions/wildcard @@ -88,16 +88,4 @@ all: ; @echo $(wildcard xz--y*.7) !, '', "\n"); -# TEST #5: wildcard used to verify file existence - -touch('xxx.yyy'); - -run_make_test(q!exists: ; @echo file=$(wildcard xxx.yyy)!, - '', "file=xxx.yyy\n"); - -unlink('xxx.yyy'); - -run_make_test(q!exists: ; @echo file=$(wildcard xxx.yyy)!, - '', "file=\n"); - 1; |