Changeset 2591 in kBuild for trunk/src/kmk/tests/scripts/variables/flavors
- Timestamp:
- Jun 17, 2012 8:45:31 PM (12 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
- Property svn:ignore
-
old new 13 13 stamp-* 14 14 makebook* 15 15 16 .*gdbinit 17 .gdb_history 18 16 19 *.dep 17 20 *.dvi … … 31 34 *.pg 32 35 *.pgs 36 33 37 README 34 38 README.DOS 35 39 README.W32 40 README.OS2 36 41 aclocal.m4 37 42 autom4te.cache … … 52 57 config.h.W32 53 58 config.h-vms 59 54 60 loadavg 55 61 loadavg.c 56 62 make 63 57 64 .deps 58 65 .dep_segment 66 ID 67 TAGS 68 59 69 _* 60 70 sun4 … … 72 82 sol2 73 83 i486-linux 84 74 85 customs 86 75 87 install-sh 76 88 mkinstalldirs 89 90 .directive.asc
-
- Property svn:ignore
-
trunk/src/kmk/tests
- Property svn:ignore
--- +++
- Property svn:ignore
-
trunk/src/kmk/tests/scripts/variables/flavors
r1970 r2591 5 5 $details = ""; 6 6 7 open(MAKEFILE, "> $makefile"); 7 # TEST 0: Recursive 8 8 9 # The Contents of the MAKEFILE ... 10 11 print MAKEFILE <<'EOF'; 9 run_make_test(' 10 ugh = Goodbye 12 11 foo = $(bar) 13 12 bar = ${ugh} 14 13 ugh = Hello 14 all: ; @echo $(foo) 15 ', 16 '', "Hello\n"); 15 17 16 all: multi ; @echo $(foo) 17 18 multi: ; $(multi) 19 20 x := foo 21 y := $(x) bar 22 x := later 23 24 nullstring := 25 space := $(nullstring) $(nullstring) 26 27 next: ; @echo $x$(space)$y 28 29 define multi 30 @echo hi 31 echo there 32 endef 33 34 ifdef BOGUS 35 define 36 @echo error 37 endef 38 endif 39 40 define outer 41 define inner 42 A = B 43 endef 44 endef 45 46 $(eval $(outer)) 47 48 outer: ; @echo $(inner) 49 50 EOF 51 52 # END of Contents of MAKEFILE 53 54 close(MAKEFILE); 55 56 # TEST #1 57 # ------- 58 59 &run_make_with_options($makefile, "", &get_logfile); 60 $answer = "hi\necho there\nthere\nHello\n"; 61 &compare_output($answer, &get_logfile(1)); 62 63 # TEST #2 64 # ------- 65 66 &run_make_with_options($makefile, "next", &get_logfile); 67 $answer = "later foo bar\n"; 68 &compare_output($answer, &get_logfile(1)); 69 70 # TEST #3 71 # ------- 72 73 &run_make_with_options($makefile, "BOGUS=true", &get_logfile, 512); 74 $answer = "$makefile:24: *** empty variable name. Stop.\n"; 75 &compare_output($answer, &get_logfile(1)); 76 77 # TEST #4 78 # ------- 79 80 &run_make_with_options($makefile, "outer", &get_logfile); 81 $answer = "A = B\n"; 82 &compare_output($answer, &get_logfile(1)); 83 84 # Clean up from "old style" testing. If all the above tests are converted to 85 # run_make_test() syntax than this line can be removed. 86 $makefile = undef; 87 88 # ------------------------- 89 # Make sure that prefix characters apply properly to define/endef values. 90 # 91 # There's a bit of oddness here if you try to use a variable to hold the 92 # prefix character for a define. Even though something like this: 93 # 94 # define foo 95 # echo bar 96 # endef 97 # 98 # all: ; $(V)$(foo) 99 # 100 # (where V=@) can be seen by the user to be obviously different than this: 101 # 102 # define foo 103 # $(V)echo bar 104 # endef 105 # 106 # all: ; $(foo) 107 # 108 # and the user thinks it should behave the same as when the "@" is literal 109 # instead of in a variable, that can't happen because by the time make 110 # expands the variables for the command line and sees it begins with a "@" it 111 # can't know anymore whether the prefix character came before the variable 112 # reference or was included in the first line of the variable reference. 113 114 # TEST #5 115 # ------- 18 # TEST 1: Simple 116 19 117 20 run_make_test(' 118 define FOO 119 $(V1)echo hello 120 $(V2)echo world 121 endef 122 all: ; @ $(FOO)123 ', '', 'hello124 world');21 bar = Goodbye 22 foo := $(bar) 23 bar = ${ugh} 24 ugh = Hello 25 all: ; @echo $(foo) 26 ', 27 '', "Goodbye\n"); 125 28 126 # TEST #6 127 # ------- 128 129 run_make_test(undef, 'V1=@ V2=@', 'hello 130 world'); 131 132 # TEST #7 133 # ------- 29 # TEST 2: Append to recursive 134 30 135 31 run_make_test(' 136 define FOO 137 $(V1)echo hello 138 $(V2)echo world 139 endef 140 all: ; $(FOO) 141 ', 'V1=@', 'hello 142 echo world 143 world');32 foo = Hello 33 ugh = Goodbye 34 foo += $(bar) 35 bar = ${ugh} 36 ugh = Hello 37 all: ; @echo $(foo) 38 ', 39 '', "Hello Hello\n"); 144 40 145 # TEST #8 146 # ------- 147 148 run_make_test(undef, 'V2=@', 'echo hello 149 hello 150 world'); 151 152 # TEST #9 153 # ------- 154 155 run_make_test(undef, 'V1=@ V2=@', 'hello 156 world'); 157 158 # TEST #10 159 # ------- 160 # Test the basics; a "@" internally to the variable applies to only one line. 161 # A "@" before the variable applies to the entire variable. 41 # TEST 3: Append to simple 162 42 163 43 run_make_test(' 164 define FOO 165 @echo hello 166 echo world 167 endef 168 define BAR 169 echo hello 170 echo world 171 endef 44 foo := Hello 45 ugh = Goodbye 46 bar = ${ugh} 47 foo += $(bar) 48 ugh = Hello 49 all: ; @echo $(foo) 50 ', 51 '', "Hello Goodbye\n"); 172 52 173 all: foo bar 174 foo: ; $(FOO) 175 bar: ; @$(BAR) 176 ', '-j1', 'hello 177 echo world 178 world 179 hello 180 world 181 '); 53 # TEST 4: Conditional pre-set 54 55 run_make_test(' 56 foo = Hello 57 ugh = Goodbye 58 bar = ${ugh} 59 foo ?= $(bar) 60 ugh = Hello 61 all: ; @echo $(foo) 62 ', 63 '', "Hello\n"); 64 65 # TEST 5: Conditional unset 66 67 run_make_test(' 68 ugh = Goodbye 69 bar = ${ugh} 70 foo ?= $(bar) 71 ugh = Hello 72 all: ; @echo $(foo) 73 ', 74 '', "Hello\n"); 182 75 183 76 1;
Note:
See TracChangeset
for help on using the changeset viewer.

