Changeset 3140 for trunk/src/kmk/tests/scripts/variables
- Timestamp:
- Mar 14, 2018, 10:28:10 PM (7 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 11 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
-
Property svn:mergeinfo
set to
/vendor/gnumake/current merged eligible
-
Property svn:mergeinfo
set to
-
trunk/src/kmk/tests/scripts/variables/DEFAULT_GOAL
r2591 r3140 43 43 ', 44 44 '', 45 '#MAKE#: *** No rule to make target `foo\'. Stop.',45 "#MAKE#: *** No rule to make target 'foo'. Stop.", 46 46 512); 47 47 -
trunk/src/kmk/tests/scripts/variables/LIBPATTERNS
r2591 r3140 21 21 all: -lfoo ; @echo "build $@ from $<" 22 22 ', 23 '', "#MAKE#: .LIBPATTERNS element `mtest_foo.a' is not a pattern23 '', "#MAKE#: .LIBPATTERNS element 'mtest_foo.a' is not a pattern 24 24 build all from mtest_foo.a\n"); 25 25 -
trunk/src/kmk/tests/scripts/variables/MAKE
r2591 r3140 17 17 '', 18 18 "#MAKEPATH#\n#MAKEPATH# -f #MAKEFILE# foo\n" 19 . "#MAKE#[1]: Entering directory `#PWD#'\n"20 . "#MAKEPATH#\n#MAKE#[1]: Leaving directory `#PWD#'\n");19 . "#MAKE#[1]: Entering directory '#PWD#'\n" 20 . "#MAKEPATH#\n#MAKE#[1]: Leaving directory '#PWD#'\n"); 21 21 22 22 rmfiles("foo"); -
trunk/src/kmk/tests/scripts/variables/MAKEFLAGS
r2591 r3140 1 # 1 # -*-perl-*- 2 2 3 3 $description = "Test proper behavior of MAKEFLAGS"; … … 9 9 all: ; @echo $(MAKEFLAGS) 10 10 !, 11 '-e -r -R', ' Rre');11 '-e -r -R', 'erR'); 12 12 13 13 # Long arguments mean everything is prefixed with "-" … … 15 15 all: ; @echo $(MAKEFLAGS) 16 16 !, 17 '--no-print-directory -e -r -R', '--no-print-directory -Rre'); 17 '--no-print-directory -e -r -R --trace', "#MAKEFILE#:2: target 'all' does not exist 18 echo erR --trace --no-print-directory 19 erR --trace --no-print-directory"); 18 20 19 21 20 if ($all_tests) { 21 # Recursive invocations of make should accumulate MAKEFLAGS values. 22 # Savannah bug #2216 23 run_make_test(q! 22 # Recursive invocations of make should accumulate MAKEFLAGS values. 23 # Savannah bug #2216 24 run_make_test(q! 24 25 MSG = Fails 25 26 all: … … 27 28 @MSG=Works $(MAKE) -e -f #MAKEFILE# jump 28 29 jump: 29 @echo '$@ : MAKEFLAGS=$(MAKEFLAGS)'30 @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)' 30 31 @$(MAKE) -f #MAKEFILE# print 31 32 print: 32 @echo '$@: MAKEFLAGS=$(MAKEFLAGS)' 33 @echo $(MSG) 33 @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)' 34 34 .PHONY: all jump print 35 35 !, 36 36 '--no-print-directory', 37 37 'all: MAKEFLAGS= --no-print-directory 38 jump: MAKEFLAGS= --no-print-directory -e 39 print: MAKEFLAGS= --no-print-directory -e 40 Works'); 41 } 38 jump Works: MAKEFLAGS=e --no-print-directory 39 print Works: MAKEFLAGS=e --no-print-directory'); 42 40 43 41 1; 42 43 ### Local Variables: 44 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 45 ### End: -
trunk/src/kmk/tests/scripts/variables/MAKE_RESTARTS
r969 r3140 12 12 ', 13 13 '', 'MAKE_RESTARTS= 14 #MAKEFILE#:4: foo.x: No such file or directory15 14 MAKE_RESTARTS=1'); 16 15 … … 27 26 ', 28 27 '', 'MAKE_RESTARTS= 29 #MAKEFILE#:4: foo.x: No such file or directory30 28 MAKE_RESTARTS=1 31 foo.x:1: bar.x: No such file or directory32 29 MAKE_RESTARTS=2'); 33 30 … … 48 45 ', 49 46 '', "MAKE_RESTARTS= 50 #MAKEFILE#:8: foo.x: No such file or directory51 47 MAKE_RESTARTS=1 52 foo.x:1: bar.x: No such file or directory53 48 MAKE_RESTARTS=2 54 49 recurse MAKE_RESTARTS= 50 #MAKE#[1]: Entering directory '#PWD#' 55 51 MAKE_RESTARTS= 56 #MAKE#[1]: Entering directory `#PWD#'57 52 all MAKE_RESTARTS= 58 #MAKE#[1]: Leaving directory `#PWD#'");53 #MAKE#[1]: Leaving directory '#PWD#'"); 59 54 60 55 rmfiles('foo.x', 'bar.x'); 61 56 62 57 1; 58 59 ### Local Variables: 60 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 61 ### End: -
trunk/src/kmk/tests/scripts/variables/SHELL
r2591 r3140 72 72 '', $out); 73 73 74 # Do it again but add spaces to SHELLFLAGS 75 76 # Some shells (*shakes fist at Solaris*) cannot handle multiple flags in 77 # separate arguments. 78 my $t = `/bin/sh -e -c true 2>/dev/null`; 79 my $multi_ok = $? == 0; 80 81 if ($multi_ok) { 82 $flags = '-x -c'; 83 run_make_test(qq! 84 .SHELLFLAGS = $flags 85 all: ; \@$script 86 !, 87 '', $out); 88 } 89 74 90 # We can't just use "false" because on different systems it provides a 75 91 # different exit code--once again Solaris: false exits with 255 not 1 … … 83 99 all: ; \@$script 84 100 !, 85 '', "$out#MAKE#: *** [ all] Error $err\n", 512);101 '', "$out#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512); 86 102 87 103 1; -
trunk/src/kmk/tests/scripts/variables/define
r2591 r3140 31 31 endef 32 32 33 define posix ::= 34 @echo $(FOO) 35 endef 36 33 37 append = @echo a 34 38 … … 50 54 all: ; $(multi) 51 55 $(simple) 56 $(posix) 52 57 $(append) 53 58 $(cond) 54 59 ', 55 '', "echo hi\nhi\nthere\nfoo\na\nb\nfirst\n"); 60 '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n"); 61 62 # TEST 1a: Various new-style define/endef, with no spaces 63 64 run_make_test(' 65 FOO = foo 66 67 define multi= 68 echo hi 69 @echo $(FOO) 70 endef # this is the end 71 72 define simple:= 73 @echo $(FOO) 74 endef 75 76 define posix::= 77 @echo $(FOO) 78 endef 79 80 append = @echo a 81 82 define append+= 83 84 @echo b 85 endef 86 87 define cond?= # this is a conditional 88 @echo first 89 endef 90 91 define cond?= 92 @echo second 93 endef 94 95 FOO = there 96 97 all: ; $(multi) 98 $(simple) 99 $(posix) 100 $(append) 101 $(cond) 102 ', 103 '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n"); 56 104 57 105 # TEST 2: define in true section of conditional (containing conditional) … … 113 161 all: ; @echo ok 114 162 ', 115 '', "#MAKEFILE#:3: extraneous text after `define' directive\nok\n");163 '', "#MAKEFILE#:3: extraneous text after 'define' directive\nok\n"); 116 164 117 165 # TEST 7: NEGATIVE: extra text after endef … … 124 172 all: ; @echo ok 125 173 ', 126 '', "#MAKEFILE#:5: extraneous text after `endef' directive\nok\n");174 '', "#MAKEFILE#:5: extraneous text after 'endef' directive\nok\n"); 127 175 128 176 # TEST 8: NEGATIVE: missing endef … … 135 183 endef$(NAME) 136 184 ', 137 '', "#MAKEFILE#:4: *** missing `endef', unterminated `define'. Stop.\n", 512);185 '', "#MAKEFILE#:4: *** missing 'endef', unterminated 'define'. Stop.\n", 512); 138 186 139 187 # ------------------------- -
trunk/src/kmk/tests/scripts/variables/flavors
r2591 r3140 74 74 '', "Hello\n"); 75 75 76 # TEST 6: Simple using POSIX syntax 77 run_make_test(' 78 bar = Goodbye 79 foo ::= $(bar) 80 bar = ${ugh} 81 ugh = Hello 82 all: ; @echo $(foo) 83 ', 84 '', "Goodbye\n"); 85 86 # TEST 7: POSIX syntax no spaces 87 run_make_test(' 88 bar = Goodbye 89 foo::=$(bar) 90 bar = ${ugh} 91 ugh = Hello 92 all: ; @echo $(foo) 93 ', 94 '', "Goodbye\n"); 95 76 96 1; -
trunk/src/kmk/tests/scripts/variables/private
r2591 r3140 76 76 '', "b=a\na=a\n"); 77 77 78 # 9: make sure private suppresses inheritance 79 run_make_test(q! 80 DEFS = FOO 81 all: bar1 82 bar1: private DEFS += 1 83 bar3: private DEFS += 3 84 bar1: bar2 85 bar2: bar3 86 bar1 bar2 bar3: ; @echo '$@: $(DEFS)' 87 !, 88 '', "bar3: FOO 3\nbar2: FOO\nbar1: FOO 1\n"); 89 90 # 10: Test append with pattern-specific variables and private 91 92 run_make_test(q! 93 IA = global 94 PA = global 95 PS = global 96 S = global 97 PS = global 98 SV = global 99 b%: IA += b% 100 b%: private PA += b% 101 b%: private PS = b% 102 bar: all 103 bar: IA += bar 104 bar: private PA += bar 105 bar: private PS = bar 106 a%: IA += a% 107 a%: private PA += a% 108 a%: private PS = a% 109 all: IA += all 110 all: private PA += all 111 all: private PS = all 112 113 bar all: ; @echo '$@: IA=$(IA)'; echo '$@: PA=$(PA)'; echo '$@: PS=$(PS)' 114 !, 115 '', "all: IA=global b% bar a% all 116 all: PA=global a% all 117 all: PS=all 118 bar: IA=global b% bar 119 bar: PA=global b% bar 120 bar: PS=bar\n"); 121 78 122 1; -
trunk/src/kmk/tests/scripts/variables/special
r2000 r3140 15 15 BAR := bar 16 16 17 all: 18 @echo X1 = $(X1) 19 @echo X2 = $(X2) 20 @echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) 17 all: ; @echo X1 = $(X1); echo X2 = $(X2); echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) 21 18 ', 22 19 '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n"); 23 20 21 # SV 45728: Test that undefining a variable is reflected properly 24 22 23 &run_make_test(' 24 FOO := foo 25 BAR := bar 26 $(info one: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) 27 undefine BAR 28 BAZ := baz 29 $(info two: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) 30 all:;@: 31 ', 32 '', "one: BAR FOO\ntwo: BAZ FOO\n"); 25 33 26 34 # $makefile2 = &get_tmpfile; … … 32 40 33 41 # all: foo 34 # 35 # 36 # 42 # @echo X1 = $(X1) 43 # @echo X2 = $(X2) 44 # @echo LAST = $(sort $(.TARGETS)) 37 45 38 46 # X2 := $(sort $(.TARGETS)) … … 55 63 &run_make_test(' 56 64 define foo 57 : foo-one 65 : foo-one\ 58 66 foo-two 59 67 : foo-three … … 116 124 : foo-four'); 117 125 126 # Test that the "did you mean TAB" message is printed properly 127 128 run_make_test(q! 129 $x. 130 !, 131 '', '#MAKEFILE#:2: *** missing separator. Stop.', 512); 132 133 run_make_test(q! 134 foo: 135 bar 136 !, 137 '', '#MAKEFILE#:3: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.', 512); 138 139 run_make_test(q! 140 .RECIPEPREFIX = : 141 foo: 142 bar 143 !, 144 '', '#MAKEFILE#:4: *** missing separator. Stop.', 512); 145 118 146 1; 147 148 ### Local Variables: 149 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) 150 ### End:
Note:
See TracChangeset
for help on using the changeset viewer.