Changeset 2591 for trunk/src/kmk/tests
- Timestamp:
- Jun 17, 2012, 10:45:31 PM (13 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 35 edited
- 9 copied
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/ChangeLog
r1993 r2591 1 2010-07-28 Paul Smith <psmith@gnu.org> 2 3 * scripts/targets/POSIX: Compatibility issues with Solaris (and 4 Tru64?); "false" returns different exit codes, and set -x shows 5 output with extra whitespace. Run the commands by hand first to 6 find out what the real shell would do, then compare what make does. 7 * scripts/variables/SHELL: Ditto. 8 9 2010-07-12 Paul Smith <psmith@gnu.org> 10 11 * test_driver.pl: Add a new $perl_name containing the path to Perl. 12 * run_make_tests.pl (run_make_test): Replace the special string 13 #PERL# in a makefile etc. with the path the Perl executable so 14 makefiles can use it. 15 16 * scripts/targets/ONESHELL: Add a new set of regression tests for 17 the .ONESHELL feature. 18 19 2010-07-06 Paul Smith <psmith@gnu.org> 20 21 * scripts/variables/SHELL: Test the new .SHELLFLAGS variable. 22 23 * scripts/targets/POSIX: New file. Test the .POSIX special target. 24 Verify that enabling .POSIX changes the shell flags to set -e. 25 26 2010-07-01 Paul Smith <psmith@gnu.org> 27 28 * scripts/features/recursion: Add a space to separate command-line 29 args. Fixes Savannah bug #29968. 30 31 2009-11-12 Boris Kolpackov <boris@codesynthesis.com> 32 33 * scripts/features/vpath3: Test for the new library search 34 behavior. 35 36 2009-10-06 Boris Kolpackov <boris@codesynthesis.com> 37 38 * scripts/features/se_explicit: Enable the test for now fixed 39 Savannah bug 25780. 40 41 2009-10-06 Boris Kolpackov <boris@codesynthesis.com> 42 43 * scripts/variables/undefine: Tests for the new undefine feature. 44 45 2009-10-03 Paul Smith <psmith@gnu.org> 46 47 * scripts/features/parallelism: Test for open Savannah bug #26846. 48 49 * scripts/variables/MAKE: Rewrite for new run_make_test() format. 50 51 * scripts/variables/MAKEFLAGS: Created. 52 Add test for Savannah bug #2216 (still open). 53 54 * scripts/features/include: Test for Savannah bug #102 (still open). 55 56 2009-09-30 Boris Kolpackov <boris@codesynthesis.com> 57 58 * scripts/features/include: Add diagnostics issuing tests for 59 cases where targets have been updated and failed with the 60 dontcare flag. Savannah bugs #15110, #25493, #12686, #17740. 61 62 2009-09-28 Paul Smith <psmith@gnu.org> 63 64 * scripts/functions/shell: Add regression test for Savannah bug 65 #20513 (still open). 66 67 * scripts/features/se_explicit: Add regression tests for Savannah 68 bug #25780 (still open). 69 70 * run_make_tests.pl (valid_option): Add a new flag, -all([-_]?tests)? 71 that runs tests we know will fail. This allows us to add 72 regression tests to the test suite for bugs that haven't been 73 fixed yet. 74 75 2009-09-28 Boris Kolpackov <boris@codesynthesis.com> 76 77 * scripts/features/patspecific_vars: Add a test for the shortest 78 stem first order. 79 80 * scripts/features/patternrules: Add a test for the shortest stem 81 first order. 82 83 2009-09-24 Paul Smith <psmith@gnu.org> 84 85 * scripts/features/se_implicit: Add a test for order-only 86 secondary expansion prerequisites. 87 88 2009-09-23 Paul Smith <psmith@gnu.org> 89 90 * scripts/features/patternrules: Test that we can remove pattern 91 rules, both single and multiple prerequisites. Savannah bug #18622. 92 93 * scripts/features/echoing: Rework for run_make_test(). 94 95 2009-06-14 Paul Smith <psmith@gnu.org> 96 97 * scripts/features/vpath: Verify we don't get bogus circular 98 dependency warnings if we choose a different file via vpath during 99 update. Savannah bug #13529. 100 101 2009-06-13 Paul Smith <psmith@gnu.org> 102 103 * scripts/variables/MAKEFILES: Verify that MAKEFILES included 104 files (and files included by them) don't set the default goal. 105 Savannah bug #13401. 106 107 * scripts/functions/wildcard: Test that wildcards with 108 non-existent glob matchers return empty. 109 110 2009-06-09 Paul Smith <psmith@gnu.org> 111 112 * scripts/options/dash-B: Test the $? works correctly with -B. 113 Savannah bug #17825. 114 115 * scripts/features/patternrules: Test that dependencies of 116 "also_make" targets are created properly. Savannah bug #19108. 117 118 * test_driver.pl (compare_output): Create a "run" file for failed 119 tests containing the command that was run. 120 (get_runfile): New function. 121 122 * run_make_tests.pl (valid_option): Enhanced support for valgrind: 123 allow memcheck and massif tools. 124 125 * scripts/features/patternrules: Have to comment out a line in the 126 first test due to backing out a change that broke the implicit 127 rule search algorithm. Savannah bug #17752. 128 * scripts/misc/general4: Remove a test that is redundant with 129 patternrules. 130 131 * scripts/features/parallelism: Add a test for re-exec with 132 jobserver master override. Savannah bug #18124. 133 134 2009-06-08 Paul Smith <psmith@gnu.org> 135 136 * scripts/features/targetvars: Add a test for continued target 137 vars after a semicolon. Savannah bug #17521. 138 139 2009-06-07 Paul Smith <psmith@gnu.org> 140 141 * scripts/features/se_explicit: Make sure we catch defining 142 prereqs during snap_deps(). Savannah bug #24622. 143 144 * scripts/variables/automatic: Check prereq ordering when the 145 target with the recipe has no prereqs. Savannah bug #21198. 146 147 * scripts/variables/LIBPATTERNS: Add a new set of test for 148 $(.LIBPATTERNS) (previously untested!) 149 150 2009-06-04 Paul Smith <psmith@gnu.org> 151 152 * scripts/variables/SHELL: The export target-specific SHELL test 153 has an incorrect known-good-value. 154 155 * scripts/misc/general4: Check for whitespace (ffeed, vtab, etc.) 156 157 * scripts/features/se_explicit: Add tests for Savannah bug #24588. 158 159 2009-05-31 Paul Smith <psmith@gnu.org> 160 161 * scripts/variables/DEFAULT_GOAL: Add tests for Savannah bug #25697. 162 163 * scripts/features/targetvars: Add tests of overrides for Savannah 164 bug #26207. 165 * scripts/features/patspecific_vars: Ditto. 166 167 * scripts/features/patternrules: Add a test for Savannah bug #26593. 168 169 2009-05-30 Paul Smith <psmith@gnu.org> 170 171 * scripts/variables/flavors: Update with new variable flavor tests. 172 * scripts/variables/define: Create a new set of tests for 173 define/endef and move those aspects of the flavors suite here. 174 175 2009-05-25 Paul Smith <psmith@gnu.org> 176 177 * scripts/features/targetvars: Ditto. 178 179 * scripts/features/export: Test new variable parsing abilities. 180 181 2009-02-23 Ramon Garcia <ramon.garcia.f@gmail.com> 182 183 * scripts/variables/private: Create a new suite of tests for 'private'. 184 1 185 2007-11-04 Paul Smith <psmith@gnu.org> 2 186 … … 881 1065 882 1066 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 883 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.1067 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 884 1068 This file is part of GNU Make. 885 1069 -
trunk/src/kmk/tests/NEWS
r1993 r2591 165 165 ------------------------------------------------------------------------------- 166 166 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 167 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.167 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 168 168 This file is part of GNU Make. 169 169 -
trunk/src/kmk/tests/README
r1993 r2591 9 9 ----------------------------------------------------------------------------- 10 10 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 11 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.11 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 12 12 This file is part of GNU Make. 13 13 -
trunk/src/kmk/tests/mkshadow
r1993 r2591 5 5 # 6 6 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 7 # 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 7 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 8 # Foundation, Inc. 8 9 # This file is part of GNU Make. 9 10 # -
trunk/src/kmk/tests/run_make_tests.pl
r1993 r2591 13 13 14 14 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 15 # 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 15 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 16 # Foundation, Inc. 16 17 # This file is part of GNU Make. 17 18 # … … 29 30 # this program. If not, see <http://www.gnu.org/licenses/>. 30 31 32 31 33 $valgrind = 0; # invoke make with valgrind 32 $valgrind_args = '--num-callers=15 --tool=memcheck --leak-check=full'; 34 $valgrind_args = ''; 35 $memcheck_args = '--num-callers=15 --tool=memcheck --leak-check=full'; 36 $massif_args = '--num-callers=15 --tool=massif --alloc-fn=xmalloc --alloc-fn=xcalloc --alloc-fn=xrealloc --alloc-fn=xstrdup --alloc-fn=xstrndup'; 33 37 $pure_log = undef; 38 39 $command_string = ''; 40 41 $all_tests = 0; 34 42 35 43 require "test_driver.pl"; … … 44 52 local($option) = @_; 45 53 46 if ($option =~ /^-make([-_]?path)?$/) 47 { 48 $make_path = shift @argv; 49 if (!-f $make_path) 50 { 51 print "$option $make_path: Not found.\n"; 52 exit 0; 53 } 54 return 1; 55 } 56 57 if ($option =~ /^-valgrind$/i) { 58 $valgrind = 1; 59 return 1; 54 if ($option =~ /^-make([-_]?path)?$/i) { 55 $make_path = shift @argv; 56 if (!-f $make_path) { 57 print "$option $make_path: Not found.\n"; 58 exit 0; 59 } 60 return 1; 61 } 62 63 if ($option =~ /^-all([-_]?tests)?$/i) { 64 $all_tests = 1; 65 return 1; 66 } 67 68 if ($option =~ /^-(valgrind|memcheck)$/i) { 69 $valgrind = 1; 70 $valgrind_args = $memcheck_args; 71 return 1; 72 } 73 74 if ($option =~ /^-massif$/i) { 75 $valgrind = 1; 76 $valgrind_args = $massif_args; 77 return 1; 60 78 } 61 79 … … 106 124 $makestring =~ s/#MAKEPATH#/$mkpath/g; 107 125 $makestring =~ s/#MAKE#/$make_name/g; 126 $makestring =~ s/#PERL#/$perl_name/g; 108 127 $makestring =~ s/#PWD#/$pwd/g; 109 128 … … 120 139 $answer =~ s/#MAKEPATH#/$mkpath/g; 121 140 $answer =~ s/#MAKE#/$make_name/g; 141 $answer =~ s/#PERL#/$perl_name/g; 122 142 $answer =~ s/#PWD#/$pwd/g; 123 143 … … 149 169 } 150 170 171 $command_string = "$command\n"; 172 151 173 if ($valgrind) { 152 174 print VALGRIND "\n\nExecuting: $command\n"; … … 156 178 { 157 179 my $old_timeout = $test_timeout; 158 $test_timeout = $timeout if $timeout; 180 $timeout and $test_timeout = $timeout; 181 182 # If valgrind is enabled, turn off the timeout check 183 $valgrind and $test_timeout = 0; 159 184 160 185 $code = &run_command_with_output($logname,$command); … … 184 209 print "Error running $make_path (expected $expected_code; got $code): $command\n"; 185 210 $test_passed = 0; 211 $runf = &get_runfile; 212 &create_file (&get_runfile, $command_string); 186 213 # If it's a SIGINT, stop here 187 214 if ($code & 127) { 188 215 print STDERR "\nCaught signal ".($code & 127)."!\n"; 189 exit($code);216 ($code & 127) == 2 and exit($code); 190 217 } 191 218 return 0; … … 196 223 } 197 224 198 1;225 return 1; 199 226 } 200 227 … … 202 229 { 203 230 &print_standard_usage ("run_make_tests", 204 "[-make_path make_pathname] [- valgrind]",);231 "[-make_path make_pathname] [-memcheck] [-massif]",); 205 232 } 206 233 207 234 sub print_help 208 235 { 209 &print_standard_help ("-make_path", 210 "\tYou may specify the pathname of the copy of make to run."); 236 &print_standard_help ( 237 "-make_path", 238 "\tYou may specify the pathname of the copy of make to run.", 239 "-valgrind", 240 "-memcheck", 241 "\tRun the test suite under valgrind's memcheck tool.", 242 "\tChange the default valgrind args with the VALGRIND_ARGS env var.", 243 "-massif", 244 "\tRun the test suite under valgrind's massif toool.", 245 "\tChange the default valgrind args with the VALGRIND_ARGS env var." 246 ); 211 247 } 212 248 … … 336 372 337 373 if ($valgrind) { 374 my $args = $valgrind_args; 338 375 open(VALGRIND, "> valgrind.out") 339 376 || die "Cannot open valgrind.out: $!\n"; 340 377 # -q --leak-check=yes 341 exists $ENV{VALGRIND_ARGS} and $ valgrind_args = $ENV{VALGRIND_ARGS};342 $make_path = "valgrind --log-fd=".fileno(VALGRIND)." $ valgrind_args $make_path";378 exists $ENV{VALGRIND_ARGS} and $args = $ENV{VALGRIND_ARGS}; 379 $make_path = "valgrind --log-fd=".fileno(VALGRIND)." $args $make_path"; 343 380 # F_SETFD is 2 344 381 fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n"; -
trunk/src/kmk/tests/scripts/features/echoing
r969 r2591 1 $description = "The following test creates a makefile to test command \n" 2 ."echoing. It tests that when a command line starts with \n" 3 ."a '\@', the echoing of that line is suppressed. It also \n" 4 ."tests the -n option which tells make to ONLY echo the \n" 5 ."commands and no execution happens. In this case, even \n" 6 ."the commands with '\@' are printed. Lastly, it tests the \n" 7 ."-s flag which tells make to prevent all echoing, as if \n" 8 ."all commands started with a '\@'."; 1 # -*-perl-*- 2 $description = "The following test creates a makefile to test command 3 echoing. It tests that when a command line starts with 4 a '\@', the echoing of that line is suppressed. It also 5 tests the -n option which tells make to ONLY echo the 6 commands and no execution happens. In this case, even 7 the commands with '\@' are printed. Lastly, it tests the 8 -s flag which tells make to prevent all echoing, as if 9 all commands started with a '\@'."; 9 10 10 $details = "This test is similar to the 'clean' test except that a '\@' has \n"11 ."been placed in front of the delete command line. Four tests \n" 12 ."are run here. First, make is run normally and the first echo\n" 13 ."command should be executed. In this case there is no '\@' so \n" 14 ."we should expect make to display the command AND display the \n" 15 ."echoed message. Secondly, make is run with the clean target, \n" 16 ."but since there is a '\@' at the beginning of the command, we\n" 17 ."expect no output; just the deletion of a file which we check \n" 18 ."for. Third, we give the clean target again except this time\n" 19 ."we give make the -n option. We now expect the command to be \n" 20 ."displayed but not to be executed. In this case we need only \n" 21 ."to check the output since an error message would be displayed\n" 22 ."if it actually tried to run the delete command again and the \n" 23 ."file didn't exist. Lastly, we run the first test again with \n" 24 ."the -s option and check that make did not echo the echo \n" 25 ."command before printing the message.";11 $details = "This test is similar to the 'clean' test except that a '\@' has 12 been placed in front of the delete command line. Four tests 13 are run here. First, make is run normally and the first echo 14 command should be executed. In this case there is no '\@' so 15 we should expect make to display the command AND display the 16 echoed message. Secondly, make is run with the clean target, 17 but since there is a '\@' at the beginning of the command, we 18 expect no output; just the deletion of a file which we check 19 for. Third, we give the clean target again except this time 20 we give make the -n option. We now expect the command to be 21 displayed but not to be executed. In this case we need only 22 to check the output since an error message would be displayed 23 if it actually tried to run the delete command again and the 24 file didn't exist. Lastly, we run the first test again with 25 the -s option and check that make did not echo the echo 26 command before printing the message.\n"; 26 27 27 28 $example = "EXAMPLE_FILE"; 28 29 29 open(MAKEFILE,"> $makefile"); 30 31 # The Contents of the MAKEFILE ... 32 33 print MAKEFILE "all: \n"; 34 print MAKEFILE "\techo This makefile did not clean the dir... good\n"; 35 print MAKEFILE "clean: \n"; 36 print MAKEFILE "\t\@$delete_command $example\n"; 37 38 # END of Contents of MAKEFILE 39 40 close(MAKEFILE); 41 42 &touch($example); 30 touch($example); 43 31 44 32 # TEST #1 45 33 # ------- 46 34 47 &run_make_with_options($makefile,"",&get_logfile,0); 48 $answer = "echo This makefile did not clean the dir... good\n" 49 ."This makefile did not clean the dir... good\n"; 50 &compare_output($answer,&get_logfile(1)); 51 35 run_make_test(" 36 all: 37 \techo This makefile did not clean the dir... good 38 clean: 39 \t\@$delete_command $example\n", 40 '', 'echo This makefile did not clean the dir... good 41 This makefile did not clean the dir... good'); 52 42 53 43 # TEST #2 54 44 # ------- 55 45 56 &run_make_with_options($makefile,"clean",&get_logfile,0);46 run_make_test(undef, 'clean', ''); 57 47 if (-f $example) { 58 48 $test_passed = 0; 49 unlink($example); 59 50 } 60 &compare_output('',&get_logfile(1));61 51 62 52 # TEST #3 63 53 # ------- 64 54 65 &run_make_with_options($makefile,"-n clean",&get_logfile,0); 66 $answer = "$delete_command $example\n"; 67 &compare_output($answer,&get_logfile(1)); 55 run_make_test(undef, '-n clean', "$delete_command $example\n"); 68 56 69 57 … … 71 59 # ------- 72 60 73 &run_make_with_options($makefile,"-s",&get_logfile,0); 74 $answer = "This makefile did not clean the dir... good\n"; 75 &compare_output($answer,&get_logfile(1)); 61 run_make_test(undef, '-s', "This makefile did not clean the dir... good\n"); 76 62 77 63 78 64 1; 79 80 81 82 83 84 85 86 87 -
trunk/src/kmk/tests/scripts/features/export
r969 r2591 7 7 # about that here. 8 8 9 open(MAKEFILE,"> $makefile"); 10 11 # The Contents of the MAKEFILE ... 12 13 print MAKEFILE <<'EOMAKE'; 14 9 &run_make_test(' 15 10 FOO = foo 16 11 BAR = bar … … 41 36 @echo "FOO=$(FOO) BAR=$(BAR) BAZ=$(BAZ) BOZ=$(BOZ) BITZ=$(BITZ) BOTZ=$(BOTZ)" 42 37 @echo "FOO=$$FOO BAR=$$BAR BAZ=$$BAZ BOZ=$$BOZ BITZ=$$BITZ BOTZ=$$BOTZ" 43 44 EOMAKE 45 46 close(MAKEFILE); 47 48 # TEST 0: basics 49 50 &run_make_with_options($makefile,"",&get_logfile,0); 51 52 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 53 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 54 55 &compare_output($answer,&get_logfile(1)); 38 ', 39 '', "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 40 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 56 41 57 42 # TEST 1: make sure vars inherited from the parent are exported … … 59 44 $extraENV{FOO} = 1; 60 45 61 &run_make_with_options($makefile,"",&get_logfile,0); 62 63 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 64 FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 65 66 &compare_output($answer,&get_logfile(1)); 46 &run_make_test(undef, '', "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 47 FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 67 48 68 49 # TEST 2: global export. Explicit unexport takes precedence. 69 50 70 &run_make_with_options($makefile,"EXPORT_ALL=1",&get_logfile,0); 71 72 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 73 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 74 75 &compare_output($answer,&get_logfile(1)); 51 run_make_test(undef, "EXPORT_ALL=1" , 52 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 53 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 76 54 77 55 # TEST 3: global unexport. Explicit export takes precedence. 78 56 79 &run_make_with_options($makefile,"UNEXPORT_ALL=1",&get_logfile,0); 80 81 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 82 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 83 84 &compare_output($answer,&get_logfile(1)); 57 &run_make_test(undef, "UNEXPORT_ALL=1", 58 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 59 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 85 60 86 61 # TEST 4: both: in the above makefile the unexport comes last so that rules. 87 62 88 &run_make_with_options($makefile,"EXPORT_ALL=1 UNEXPORT_ALL=1",&get_logfile,0); 89 90 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 91 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 92 93 &compare_output($answer,&get_logfile(1)); 63 &run_make_test(undef, "EXPORT_ALL=1 UNEXPORT_ALL=1", 64 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 65 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 94 66 95 67 # TEST 5: test the pseudo target. 96 68 97 &run_make_with_options($makefile,"EXPORT_ALL_PSEUDO=1",&get_logfile,0); 98 99 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 100 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 101 102 &compare_output($answer,&get_logfile(1)); 103 69 &run_make_test(undef, "EXPORT_ALL_PSEUDO=1", 70 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 71 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 104 72 105 73 # TEST 6: Test the expansion of variables inside export 106 74 107 $makefile2 = &get_tmpfile; 108 109 open(MAKEFILE, "> $makefile2"); 110 111 print MAKEFILE <<'EOF'; 112 75 &run_make_test(' 113 76 foo = f-ok 114 77 bar = b-ok … … 126 89 @echo foo=$(foo) bar=$(bar) 127 90 @echo foo=$$foo bar=$$bar 128 129 EOF 130 131 close(MAKEFILE); 132 133 &run_make_with_options($makefile2,"",&get_logfile,0); 134 $answer = "foo=f-ok bar=b-ok\nfoo=f-ok bar=b-ok\n"; 135 &compare_output($answer,&get_logfile(1)); 136 91 ', 92 "", "foo=f-ok bar=b-ok\nfoo=f-ok bar=b-ok\n"); 137 93 138 94 # TEST 7: Test the expansion of variables inside unexport 139 95 140 $makefile3 = &get_tmpfile; 141 142 open(MAKEFILE, "> $makefile3"); 143 144 print MAKEFILE <<'EOF'; 145 96 &run_make_test(' 146 97 foo = f-ok 147 98 bar = b-ok … … 161 112 @echo foo=$(foo) bar=$(bar) 162 113 @echo foo=$$foo bar=$$bar 163 164 EOF 165 166 close(MAKEFILE); 167 168 &run_make_with_options($makefile3,"",&get_logfile,0); 169 $answer = "foo=f-ok bar=b-ok\nfoo= bar=\n"; 170 &compare_output($answer,&get_logfile(1)); 171 114 ', 115 '', "foo=f-ok bar=b-ok\nfoo= bar=\n"); 172 116 173 117 # TEST 7: Test exporting multiple variables on the same line 174 118 175 $makefile4 = &get_tmpfile; 176 177 open(MAKEFILE, "> $makefile4"); 178 179 print MAKEFILE <<'EOF'; 180 119 &run_make_test(' 181 120 A = a 182 121 B = b … … 197 136 198 137 all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J 199 EOF 200 201 close(MAKEFILE); 202 203 &run_make_with_options($makefile4,"",&get_logfile,0); 204 $answer = "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n"; 205 &compare_output($answer,&get_logfile(1)); 206 138 ', 139 '', "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n"); 207 140 208 141 # TEST 8: Test unexporting multiple variables on the same line 209 142 210 $makefile5 = &get_tmpfile;143 @extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); 211 144 212 open(MAKEFILE, "> $makefile5"); 213 214 print MAKEFILE <<'EOF'; 215 145 &run_make_test(' 216 146 A = a 217 147 B = b … … 232 162 233 163 all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J 234 EOF 164 ', 165 '', "A= B= C= D= E= F= G= H= I= J=\n"); 235 166 236 close(MAKEFILE); 167 # TEST 9: Check setting a variable named "export" 237 168 238 @extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); 169 &run_make_test(' 170 export = 123 171 export export 172 export export = 456 173 a: ; @echo "\$$(export)=$(export) / \$$export=$$export" 174 ', 175 '', "\$(export)=456 / \$export=456\n"); 239 176 240 &run_make_with_options($makefile5,"",&get_logfile,0); 241 $answer = "A= B= C= D= E= F= G= H= I= J=\n"; 242 &compare_output($answer,&get_logfile(1)); 177 # TEST 9: Check "export" as a target 243 178 179 &run_make_test(' 180 a: export 181 export: ; @echo "$@" 182 ', 183 '', "export\n"); 244 184 245 185 # This tells the test driver that the perl test script executed properly. -
trunk/src/kmk/tests/scripts/features/include
r969 r2591 91 91 ', '', ''); 92 92 93 1;94 95 93 96 94 # Make sure that we don't die when the command fails but we dontcare. … … 118 116 sinclude', '', ''); 119 117 118 119 # Test that the diagnostics is issued even if the target has been 120 # tried before with the dontcare flag (direct dependency case). 121 # 122 run_make_test(' 123 -include foo 124 125 all: bar 126 127 foo: baz 128 bar: baz 129 ', 130 '', 131 "#MAKE#: *** No rule to make target `baz', needed by `bar'. Stop.\n", 132 512); 133 134 # Test that the diagnostics is issued even if the target has been 135 # tried before with the dontcare flag (indirect dependency case). 136 # 137 run_make_test(' 138 -include foo 139 140 all: bar 141 142 foo: baz 143 bar: baz 144 baz: end 145 ', 146 '', 147 "#MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n", 148 512); 149 150 # Test that the diagnostics is issued even if the target has been 151 # tried before with the dontcare flag (include/-include case). 152 # 153 run_make_test(' 154 include bar 155 -include foo 156 157 all: 158 159 foo: baz 160 bar: baz 161 baz: end 162 ', 163 '', 164 "#MAKEFILE#:2: bar: No such file or directory 165 #MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n", 166 512); 167 168 if ($all_tests) { 169 # Test that include of a rebuild-able file doesn't show a warning 170 # Savannah bug #102 171 run_make_test(q! 172 include foo 173 foo: ; @echo foo = bar > $@ 174 !, 175 '', "#MAKE#: `foo' is up to date.\n"); 176 rmfiles('foo'); 177 } 178 120 179 1; -
trunk/src/kmk/tests/scripts/features/override
r969 r2591 1 $description = "The following test creates a makefile to ..."; 1 # -*-perl-*- 2 3 $description = "Test the override directive on variable assignments."; 2 4 3 5 $details = ""; 4 6 5 open(MAKEFILE,"> $makefile"); 7 # TEST 0: Basic override 6 8 7 # The Contents of the MAKEFILE ... 9 run_make_test(' 10 X = start 11 override recur = $(X) 12 override simple := $(X) 13 X = end 14 all: ; @echo "$(recur) $(simple)" 15 ', 16 'recur=I simple=J', "end start\n"); 8 17 9 print MAKEFILE "override define foo\n" 10 ."\@echo First comes the definition.\n" 11 ."\@echo Then comes the override.\n" 12 ."endef\n" 13 ."all: \n" 14 ."\t\$(foo)\n"; 18 # TEST 1: Override with append 15 19 16 # END of Contents of MAKEFILE 20 run_make_test(' 21 X += X1 22 override X += X2 23 override Y += Y1 24 Y += Y2 25 all: ; @echo "$(X) $(Y)" 26 ', 27 '', "X1 X2 Y1\n"); 17 28 18 close(MAKEFILE); 29 # TEST 2: Override with append to the command line 19 30 20 &run_make_with_options($makefile,"foo=Hello",&get_logfile);31 run_make_test(undef, 'X=C Y=C', "C X2 C Y1\n"); 21 32 22 # Create the answer to what should be produced by this Makefile 23 $answer = "First comes the definition.\n" 24 ."Then comes the override.\n"; 33 # Test override of define/endef 25 34 26 &compare_output($answer,&get_logfile(1)); 35 run_make_test(' 36 override define foo 37 @echo First comes the definition. 38 @echo Then comes the override. 39 endef 40 all: ; $(foo) 41 ', 42 'foo=Hello', "First comes the definition.\nThen comes the override.\n"); 43 27 44 28 45 1; 29 30 31 32 33 34 -
trunk/src/kmk/tests/scripts/features/parallelism
r2186 r2591 44 44 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"); 45 45 46 unlink('1.inc', '2.inc');46 rmfiles(qw(1.inc 2.inc)); 47 47 48 48 … … 63 63 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"); 64 64 65 unlink('1.inc', '2.inc');65 rmfiles(qw(1.inc 2.inc)); 66 66 67 67 # Grant Taylor reports a problem where tokens can be lost (not written back … … 153 153 .PHONY: phony 154 154 phony: ; : phony', '-rR -j', ': phony'); 155 unlink('target'); 156 155 rmfiles('target'); 156 157 # TEST #10: Don't put --jobserver-fds into a re-exec'd MAKEFLAGS. 158 # We can't test this directly because there's no way a makefile can 159 # show the value of MAKEFLAGS we were re-exec'd with. We can intuit it 160 # by looking for "disabling jobserver mode" warnings; we should only 161 # get one from the original invocation and none from the re-exec. 162 # See Savannah bug #18124 163 164 run_make_test(q! 165 -include inc.mk 166 recur: 167 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 168 @rm -f inc.mk 169 @$(MAKE) -j2 -f #MAKEFILE# all 170 all: 171 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 172 @echo $@ 173 inc.mk: 174 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 175 @echo 'FOO = bar' > $@ 176 !, 177 '--no-print-directory -j2', "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n"); 178 179 rmfiles('inc.mk'); 180 181 if ($all_tests) { 182 # Implicit files aren't properly recreated during parallel builds 183 # Savannah bug #26864 184 185 # The first run works fine 186 run_make_test(q! 187 %.bar: %.x foo.y ; cat $^ > $@ 188 %.x: ; touch $@ 189 foo.y: foo.y.in ; cp $< $@ 190 foo.y.in: ; touch $@ 191 !, 192 '-j2 main.bar', 193 "touch foo.y.in 194 touch main.x 195 cp foo.y.in foo.y 196 cat main.x foo.y > main.bar 197 rm main.x"); 198 199 # Now we touch the .in file and make sure it still works 200 touch('foo.y.in'); 201 202 run_make_test(undef, '-j2 main.bar', "cp foo.y.in foo.y 203 touch main.x 204 cat main.x foo.y > main.bar 205 rm main.x"); 206 207 # Clean up 208 rmfiles(qw(foo.y foo.y.in main.bar)); 209 } 210 211 if ($all_tests) { 212 # Jobserver FD handling is messed up in some way. 213 # Savannah bug #28189 214 # It doesn't look like that bug anymore but this is the code it runs 215 216 run_make_test(q! 217 ifdef EXTRA 218 vpath %.dst / 219 xxx.dst: ; true 220 yyy.dst: ; true 221 endif 222 223 M := $(MAKE) 224 xx: ; $M --no-print-directory -j2 -f $(MAKEFILE_LIST) xxx.dst yyy.dst EXTRA=1 225 !, 226 '-j2', 227 '#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode. 228 true 229 true 230 '); 231 } 157 232 158 233 # Make sure that all jobserver FDs are closed if we need to re-exec the … … 183 258 # 'bar'); 184 259 185 # unlink('dependfile', 'output');260 # rmfiles(qw(dependfile output)); 186 261 187 262 … … 189 264 # run_make_test(undef, '-j2 recurse INCL=false', 'bar'); 190 265 191 # unlink('dependfile', 'output');266 # rmfiles(qw(dependfile output)); 192 267 193 268 1; -
trunk/src/kmk/tests/scripts/features/patspecific_vars
r2173 r2591 121 121 pattrn: global: new $t pattern: good $t inherit: good $t;'); 122 122 123 # TEST #8: override in pattern-specific variables 124 125 run_make_test(' 126 a%: override FOO += f1 127 a%: FOO += f2 128 ab: ; @echo "$(FOO)" 129 ', 130 '', "f1\n"); 131 132 run_make_test(undef, 'FOO=C', "C f1\n"); 133 134 # TEST #9: Test shortest stem selection in pattern-specific variables. 135 136 run_make_test(' 137 %-mt.x: x := two 138 %.x: x := one 139 140 all: foo.x foo-mt.x 141 142 foo.x: ;@echo $x 143 foo-mt.x: ;@echo $x 144 ', 145 '', 146 "one\ntwo"); 123 147 124 148 1; -
trunk/src/kmk/tests/scripts/features/patternrules
- Property svn:keywords deleted
r1952 r2591 16 16 # 17 17 18 run_make_test( '18 run_make_test(q! 19 19 .PHONY: all 20 20 21 21 all: case.1 case.2 case.3 22 a: void 22 23 # We can't have this, due to "Implicit Rule Search Algorithm" step 5c 24 #xxx: void 23 25 24 26 # 1 - existing file … … 42 44 43 45 3.implicit-phony: 44 ', 45 '', 46 ''); 46 !, '', ''); 47 47 48 48 # TEST #1: make sure files that are built via implicit rules are marked … … 150 150 unlink('foo.in', 'foo.h', 'foo.c', 'foo.o'); 151 151 152 # TEST #5: make sure both prefix and suffix patterns work with multiple 153 # target patterns (Savannah bug #26593). 154 # 155 run_make_test(' 156 all: foo.s1 foo.s2 p1.foo p2.foo 157 158 p1.% p2.%: %.orig 159 @echo $@ 160 %.s1 %.s2: %.orig 161 @echo $@ 162 163 .PHONY: foo.orig 164 ', 165 '', "foo.s1\np1.foo\n"); 166 167 # TEST 6: Make sure that non-target files are still eligible to be created 168 # as part of implicit rule chaining. Savannah bug #17752. 169 170 run_make_test(q! 171 BIN = xyz 172 COPY = $(BIN).cp 173 SRC = $(BIN).c 174 allbroken: $(COPY) $(BIN) ; @echo ok 175 $(SRC): ; @echo 'main(){}' > $@ 176 %.cp: % ; @cp $< $@ 177 % : %.c ; @cp $< $@ 178 clean: ; @rm -rf $(SRC) $(COPY) $(BIN) 179 !, 180 '', "ok\n"); 181 182 unlink(qw(xyz xyz.cp xyz.c)); 183 184 # TEST 7: Make sure that all prereqs of all "also_make" targets get created 185 # before any of the things that depend on any of them. Savannah bug #19108. 186 187 run_make_test(q! 188 final: x ; @echo $@ 189 x: x.t1 x.t2 ; @echo $@ 190 x.t2: dep 191 dep: ; @echo $@ 192 %.t1 %.t2: ; @echo $*.t1 ; echo $*.t2 193 !, 194 '', "dep\nx.t1\nx.t2\nx\nfinal\n"); 195 196 197 # TEST 8: Verify we can remove pattern rules. Savannah bug #18622. 198 199 my @f = (qw(foo.w foo.ch)); 200 touch(@f); 201 202 run_make_test(q! 203 CWEAVE := : 204 205 # Disable builtin rules 206 %.tex : %.w 207 %.tex : %.w %.ch 208 !, 209 'foo.tex', 210 "#MAKE#: *** No rule to make target `foo.tex'. Stop.", 512); 211 212 unlink(@f); 213 214 # TEST #9: Test shortest stem selection in pattern rules. 215 216 run_make_test(' 217 %.x: ;@echo one 218 %-mt.x: ;@echo two 219 220 all: foo.x foo-mt.x 221 ', 222 '', 223 "one\ntwo"); 224 225 1; 226 152 227 # This tells the test driver that the perl test script executed properly. 153 228 1; -
trunk/src/kmk/tests/scripts/features/recursion
r1956 r2591 17 17 @echo THE END 18 18 ', 19 ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),19 ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')), 20 20 ($vos 21 21 ? "#MAKE#: Entering directory `#PWD#' -
trunk/src/kmk/tests/scripts/features/se_explicit
- Property svn:keywords deleted
r1981 r2591 27 27 # TEST #1: automatic variables. 28 28 # 29 run_make_test( '29 run_make_test(q! 30 30 .SECONDEXPANSION: 31 .DEFAULT: ; @echo $@31 .DEFAULT: ; @echo '$@' 32 32 33 33 foo: bar baz … … 42 42 $$*.6 43 43 44 ',44 !, 45 45 '-j1', 46 46 'bar … … 63 63 # Test #2: target/pattern -specific variables. 64 64 # 65 run_make_test( '65 run_make_test(q! 66 66 .SECONDEXPANSION: 67 .DEFAULT: ; @echo $@67 .DEFAULT: ; @echo '$@' 68 68 69 69 foo.x: $$a $$b … … 72 72 73 73 %.x: b := baz 74 75 ', 74 !, 76 75 '', 77 76 'bar … … 82 81 # Test #3: order of prerequisites. 83 82 # 84 run_make_test( '83 run_make_test(q! 85 84 .SECONDEXPANSION: 86 .DEFAULT: ; @echo $@85 .DEFAULT: ; @echo '$@' 87 86 88 87 all: foo bar baz 89 88 90 89 # Subtest #1 91 #92 90 foo: foo.1; @: 93 94 91 foo: foo.2 95 96 92 foo: foo.3 97 93 98 99 94 # Subtest #2 100 #101 95 bar: bar.2 102 103 96 bar: bar.1; @: 104 105 97 bar: bar.3 106 98 107 108 99 # Subtest #3 109 #110 100 baz: baz.1 111 112 101 baz: baz.2 113 114 102 baz: ; @: 115 116 ', 103 !, 117 104 '-j1', 118 105 'foo.1 … … 126 113 '); 127 114 115 # TEST #4: eval in a context where there is no reading_file 116 run_make_test(q! 117 .SECONDEXPANSION: 118 all : $$(eval $$(info test)) 119 !, 120 '', "test\n#MAKE#: Nothing to be done for `all'.\n"); 121 122 # TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new 123 # target/prereq relationships. 124 125 run_make_test(q! 126 .SECONDEXPANSION: 127 proj1.exe : proj1.o $$(eval $$(test)) 128 define test 129 proj1.o : proj1.c 130 proj1.c: proj1.h 131 endef 132 !, 133 '', "#MAKE#: *** prerequisites cannot be defined in recipes. Stop.\n", 512); 134 135 136 # Automatic $$+ variable expansion issue. Savannah bug #25780 137 run_make_test(q! 138 all : foo foo 139 .SECONDEXPANSION: 140 all : $$+ ; @echo '$+' 141 foo : ; 142 !, 143 '', "foo foo foo foo\n"); 144 145 146 # Automatic $$+ variable expansion issue. Savannah bug #25780 147 run_make_test(q! 148 all : bar bar 149 bar : ; 150 q%x : ; 151 .SECONDEXPANSION: 152 a%l: q1x $$+ q2x ; @echo '$+' 153 !, 154 '', "q1x bar bar q2x bar bar\n"); 155 156 128 157 # This tells the test driver that the perl test script executed properly. 129 158 1; -
trunk/src/kmk/tests/scripts/features/se_implicit
- Property svn:keywords deleted
r1982 r2591 12 12 # Test #1: automatic variables. 13 13 # 14 run_make_test( '15 .SECONDEXPANSION: 16 .DEFAULT: ; @echo $@14 run_make_test(q! 15 .SECONDEXPANSION: 16 .DEFAULT: ; @echo '$@' 17 17 18 18 foo.a: bar baz … … 38 38 5.buz \ 39 39 6.a: 40 @echo $@41 42 ',40 @echo '$@' 41 42 !, 43 43 '-j1', 44 44 '1.foo.a … … 61 61 # Test #2: target/pattern -specific variables. 62 62 # 63 run_make_test( '63 run_make_test(q! 64 64 .SECONDEXPANSION: 65 65 foo.x: … … 72 72 %.x: x_b := baz 73 73 74 bar baz: ; @echo $@ 75 76 ', 77 '', 78 'bar 79 baz 80 '); 74 bar baz: ; @echo '$@' 75 !, 76 '', "bar\nbaz\n"); 81 77 82 78 83 79 # Test #3: order of prerequisites. 84 80 # 85 run_make_test( '86 .SECONDEXPANSION: 87 .DEFAULT: ; @echo $@81 run_make_test(q! 82 .SECONDEXPANSION: 83 .DEFAULT: ; @echo '$@' 88 84 89 85 all: foo bar baz … … 98 94 foo: foo.3 99 95 100 foo.1: ; @echo $@96 foo.1: ; @echo '$@' 101 97 102 98 … … 109 105 bar: bar.3 110 106 111 bar.1: ; @echo $@107 bar.1: ; @echo '$@' 112 108 113 109 … … 119 115 120 116 %az: ; @: 121 122 ', 123 '-j1', 117 !, 118 '-j1', 124 119 'foo.1 125 120 foo.2 … … 135 130 # Test #4: stem splitting logic. 136 131 # 137 run_make_test( '132 run_make_test(q! 138 133 .SECONDEXPANSION: 139 134 $(dir)/tmp/bar.o: 140 135 141 $(dir)/tmp/foo/bar.c: ; @echo $@142 $(dir)/tmp/bar/bar.c: ; @echo $@143 foo.h: ; @echo $@136 $(dir)/tmp/foo/bar.c: ; @echo '$@' 137 $(dir)/tmp/bar/bar.c: ; @echo '$@' 138 foo.h: ; @echo '$@' 144 139 145 140 %.o: $$(addsuffix /%.c,foo bar) foo.h 146 @echo $@: {$<} $^ 147 148 ', 149 "dir=$dir", 150 "$dir/tmp/foo/bar.c 141 @echo '$@: {$<} $^' 142 !, 143 "dir=$dir", "$dir/tmp/foo/bar.c 151 144 $dir/tmp/bar/bar.c 152 145 foo.h … … 157 150 # Test #5: stem splitting logic and order-only prerequisites. 158 151 # 159 run_make_test( '152 run_make_test(q! 160 153 .SECONDEXPANSION: 161 154 $(dir)/tmp/foo.o: $(dir)/tmp/foo.c 162 $(dir)/tmp/foo.c: ; @echo $@163 bar.h: ; @echo $@155 $(dir)/tmp/foo.c: ; @echo '$@' 156 bar.h: ; @echo '$@' 164 157 165 158 %.o: %.c|bar.h 166 @echo $@: {$<} {$|} $^ 167 168 ', 169 "dir=$dir", 170 "$dir/tmp/foo.c 159 @echo '$@: {$<} {$|} $^' 160 161 !, 162 "dir=$dir", "$dir/tmp/foo.c 171 163 bar.h 172 164 $dir/tmp/foo.o: {$dir/tmp/foo.c} {bar.h} $dir/tmp/foo.c … … 176 168 # Test #6: lack of implicit prerequisites. 177 169 # 178 run_make_test( '170 run_make_test(q! 179 171 .SECONDEXPANSION: 180 172 foo.o: foo.c 181 foo.c: ; @echo $@173 foo.c: ; @echo '$@' 182 174 183 175 %.o: 184 @echo $@: {$<} $^ 185 186 ', 187 '', 188 'foo.c 189 foo.o: {foo.c} foo.c 190 '); 176 @echo '$@: {$<} $^' 177 !, 178 '', "foo.c\nfoo.o: {foo.c} foo.c\n"); 179 191 180 192 181 # Test #7: Test stem from the middle of the name. 193 182 # 194 run_make_test( '183 run_make_test(q! 195 184 .SECONDEXPANSION: 196 185 foobarbaz: 197 186 198 187 foo%baz: % $$*.1 199 @echo $*188 @echo '$*' 200 189 201 190 bar bar.1: 202 @echo $@ 203 204 ', 205 '', 206 'bar 207 bar.1 208 bar 209 '); 191 @echo '$@' 192 !, 193 '', "bar\nbar.1\nbar\n"); 194 210 195 211 196 # Test #8: Make sure stem triple-expansion does not happen. 212 197 # 213 run_make_test( '198 run_make_test(q! 214 199 .SECONDEXPANSION: 215 200 foo$$bar: 216 201 217 202 f%r: % $$*.1 218 @echo \'$*\'203 @echo '$*' 219 204 220 205 oo$$ba oo$$ba.1: 221 @echo \'$@\' 222 223 ', 224 '', 225 'oo$ba 206 @echo '$@' 207 !, 208 '', 'oo$ba 226 209 oo$ba.1 227 210 oo$ba 228 211 '); 229 212 213 # Test #9: Check the value of $^ 214 run_make_test(q! 215 .SECONDEXPANSION: 216 217 %.so: | $$(extra) ; @echo $^ 218 219 foo.so: extra := foo.o 220 foo.so: 221 foo.o: 222 !, 223 '', "\n"); 230 224 231 225 # This tells the test driver that the perl test script executed properly. -
trunk/src/kmk/tests/scripts/features/se_statpat
- Property svn:keywords deleted
r1983 r2591 6 6 # Test #1: automatic variables. 7 7 # 8 run_make_test(' 8 # bird: Had to add -j1 here earlier... 9 run_make_test(q! 9 10 .SECONDEXPANSION: 10 .DEFAULT: ; @echo $@11 .DEFAULT: ; @echo '$@' 11 12 12 13 foo.a foo.b: foo.%: bar.% baz.% 13 14 14 foo.a foo.b: foo.%: biz.% | buz.% 15 15 … … 20 20 $$|.5 \ 21 21 $$*.6 22 23 ', 24 '-j1', 25 'bar.a 22 !, 23 '', 'bar.a 26 24 baz.a 27 25 biz.a … … 42 40 # Test #2: target/pattern -specific variables. 43 41 # 44 run_make_test( '42 run_make_test(q! 45 43 .SECONDEXPANSION: 46 .DEFAULT: ; @echo $@44 .DEFAULT: ; @echo '$@' 47 45 48 46 foo.x foo.y: foo.%: $$(%_a) $$($$*_b) … … 51 49 52 50 %.x: x_b := baz 53 54 55 ', 56 '', 57 'bar 58 baz 59 '); 51 !, 52 '', "bar\nbaz\n"); 60 53 61 54 62 55 # Test #3: order of prerequisites. 63 56 # 64 run_make_test(' 57 # bird: Had to add -j1 here earlier... 58 run_make_test(q! 65 59 .SECONDEXPANSION: 66 .DEFAULT: ; @echo $@60 .DEFAULT: ; @echo '$@' 67 61 68 62 all: foo.a bar.a baz.a 69 63 70 64 # Subtest #1 71 #72 65 foo.a foo.b: foo.%: foo.%.1; @: 73 74 66 foo.a foo.b: foo.%: foo.%.2 75 76 67 foo.a foo.b: foo.%: foo.%.3 77 68 78 69 79 70 # Subtest #2 80 #81 71 bar.a bar.b: bar.%: bar.%.2 82 83 72 bar.a bar.b: bar.%: bar.%.1; @: 84 85 73 bar.a bar.b: bar.%: bar.%.3 86 74 87 75 88 76 # Subtest #3 89 #90 77 baz.a baz.b: baz.%: baz.%.1 91 92 78 baz.a baz.b: baz.%: baz.%.2 93 94 79 baz.a baz.b: ; @: 95 96 ', 97 '-j1', 98 'foo.a.1 80 !, 81 '', 'foo.a.1 99 82 foo.a.2 100 83 foo.a.3 … … 109 92 # Test #4: Make sure stem triple-expansion does not happen. 110 93 # 111 run_make_test( '94 run_make_test(q! 112 95 .SECONDEXPANSION: 113 96 foo$$bar: f%r: % $$*.1 114 @echo \'$*\'97 @echo '$*' 115 98 116 99 oo$$ba oo$$ba.1: 117 @echo \'$@\' 118 119 ', 120 '', 121 'oo$ba 100 @echo '$@' 101 !, 102 '', 'oo$ba 122 103 oo$ba.1 123 104 oo$ba -
trunk/src/kmk/tests/scripts/features/targetvars
r2165 r2591 7 7 rules, semicolon interference, etc."; 8 8 9 open(MAKEFILE,"> $makefile"); 10 11 print MAKEFILE <<'EOF'; 9 run_make_test(' 12 10 SHELL = /bin/sh 13 11 export FOO = foo … … 18 16 three: ; BAR=1000 19 17 @echo $(FOO) $(BAR) 20 # Some things that shouldn 't be target vars18 # Some things that shouldn not be target vars 21 19 funk : override 22 20 funk : override adelic … … 25 23 four:FOO=x 26 24 four:VAR$(FOO)=ok 27 four: ; @echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)'25 four: ; @echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)" 28 26 five:FOO=x 29 27 five six : VAR$(FOO)=good 30 five six: ;@echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)'28 five six: ;@echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)" 31 29 # Test per-target variable inheritance 32 30 seven: eight … … 42 40 # Test = escaping 43 41 EQ = = 44 ten: one \=two45 ten: one \=two42 ten: one$(EQ)two 43 ten: one $(EQ) two 46 44 ten one$(EQ)two $(EQ):;@echo $@ 47 45 .PHONY: one two three four five six seven eight nine ten $(EQ) one$(EQ)two … … 55 53 foo.r : RVAR += rvar 56 54 foo.t : TVAR := $(QVAR) 57 EOF 58 59 close(MAKEFILE); 60 61 # TEST #1 62 63 &run_make_with_options($makefile, "-j1 one two three", &get_logfile); 64 $answer = "one bar\nfoo two\nBAR=1000\nfoo bar\n"; 65 &compare_output($answer,&get_logfile(1)); 55 ', 56 "one two three", "one bar\nfoo two\nBAR=1000\nfoo bar\n"); 66 57 67 58 # TEST #2 68 59 69 &run_make_with_options($makefile, "-j1 one two FOO=1 BAR=2", &get_logfile); 70 $answer = "one 2\n1 2\n"; 71 &compare_output($answer,&get_logfile(1)); 60 run_make_test(undef, "one two FOO=1 BAR=2", "one 2\n1 2\n"); 72 61 73 62 # TEST #3 74 63 75 &run_make_with_options($makefile, "-j1 four", &get_logfile); 76 $answer = "x ok ok\n"; 77 &compare_output($answer,&get_logfile(1)); 64 run_make_test(undef, "four", "x ok ok\n"); 78 65 79 66 # TEST #4 80 67 81 &run_make_with_options($makefile, "-j1 seven", &get_logfile); 82 $answer = "eight: seven eight\nseven: seven seven\n"; 83 &compare_output($answer,&get_logfile(1)); 68 run_make_test(undef, "seven", "eight: seven eight\nseven: seven seven\n"); 84 69 85 70 # TEST #5 86 71 87 &run_make_with_options($makefile, "-j1 nine", &get_logfile); 88 $answer = "wallace bar wallace bar\n"; 89 &compare_output($answer,&get_logfile(1)); 72 run_make_test(undef, "nine", "wallace bar wallace bar\n"); 90 73 91 74 # TEST #5-a 92 75 93 &run_make_with_options($makefile, "-j1 nine-a", &get_logfile); 94 $answer = "baz\n"; 95 &compare_output($answer,&get_logfile(1)); 76 run_make_test(undef, "nine-a", "baz\n"); 96 77 97 78 # TEST #6 98 79 99 &run_make_with_options($makefile, "-j1 ten", &get_logfile); 100 $answer = "one=two\none bar\n=\nfoo two\nten\n"; 101 &compare_output($answer,&get_logfile(1)); 80 run_make_test(undef, "ten", "one=two\none bar\n=\nfoo two\nten\n"); 102 81 103 82 # TEST #6 104 83 105 &run_make_with_options($makefile, "-j1 foo.q bar.q", &get_logfile); 106 $answer = "qvar = rvar\nqvar =\n"; 107 &compare_output($answer,&get_logfile(1)); 84 run_make_test(undef, "foo.q bar.q", "qvar = rvar\nqvar =\n"); 108 85 109 86 # TEST #7 110 87 111 &run_make_with_options($makefile, "-j1 foo.t bar.s", &get_logfile); 112 $answer = "qvar = qvar\nqvar =\n"; 113 &compare_output($answer,&get_logfile(1)); 88 run_make_test(undef, "foo.t bar.s", "qvar = qvar\nqvar =\n"); 114 89 115 90 … … 117 92 # For PR/1378: Target-specific vars don't inherit correctly 118 93 119 $makefile2 = &get_tmpfile; 120 121 open(MAKEFILE,"> $makefile2"); 122 print MAKEFILE <<'EOF'; 94 run_make_test(' 123 95 foo: FOO = foo 124 96 bar: BAR = bar … … 126 98 bar: baz 127 99 baz: ; @echo $(FOO) $(BAR) 128 EOF 129 close(MAKEFILE); 130 131 &run_make_with_options("$makefile2", "", &get_logfile); 132 $answer = "foo bar\n"; 133 &compare_output($answer, &get_logfile(1)); 100 ', "", "foo bar\n"); 134 101 135 102 # TEST #9 … … 137 104 # Also PR/1831 138 105 139 $makefile3 = &get_tmpfile; 140 141 open(MAKEFILE,"> $makefile3"); 142 print MAKEFILE <<'EOF'; 106 run_make_test(' 143 107 .PHONY: all one 144 108 all: FOO += baz … … 150 114 one: FOO += boz 151 115 one: ; @echo $(FOO) 152 EOF 153 close(MAKEFILE); 154 155 &run_make_with_options("$makefile3", "", &get_logfile); 156 $answer = "bar baz biz boz\nbar baz\n"; 157 &compare_output($answer, &get_logfile(1)); 116 ', 117 '', "bar baz biz boz\nbar baz\n"); 158 118 159 119 # Test #10 160 120 161 &run_make_with_options("$makefile3", "one", &get_logfile); 162 $answer = "bar biz boz\n"; 163 &compare_output($answer, &get_logfile(1)); 121 run_make_test(undef, 'one', "bar biz boz\n"); 164 122 165 123 # Test #11 166 124 # PR/1709: Test semicolons in target-specific variable values 167 125 168 $makefile4 = &get_tmpfile; 169 170 open(MAKEFILE, "> $makefile4"); 171 print MAKEFILE <<'EOF'; 126 run_make_test(' 172 127 foo : FOO = ; ok 173 foo : ; @echo '$(FOO)' 174 EOF 175 close(MAKEFILE); 176 177 &run_make_with_options("$makefile4", "", &get_logfile); 178 $answer = "; ok\n"; 179 &compare_output($answer, &get_logfile(1)); 128 foo : ; @echo "$(FOO)" 129 ', 130 '', "; ok\n"); 180 131 181 132 # Test #12 … … 183 134 # I nailed it this time :-/. 184 135 185 $makefile5 = &get_tmpfile; 186 187 open(MAKEFILE, "> $makefile5"); 188 print MAKEFILE <<'EOF'; 136 run_make_test(' 189 137 .PHONY: a 190 138 … … 196 144 a: BLAH := bar 197 145 a: COMMAND += snafu $(BLAH) 198 EOF 199 close(MAKEFILE); 200 201 &run_make_with_options("$makefile5", "", &get_logfile); 202 $answer = "bar snafu bar\n"; 203 &compare_output($answer, &get_logfile(1)); 146 ', 147 '', "bar snafu bar\n"); 204 148 205 149 # Test #13 206 150 # Test double-colon rules with target-specific variable values 207 151 208 $makefile6 = &get_tmpfile; 209 210 open(MAKEFILE, "> $makefile6"); 211 print MAKEFILE <<'EOF'; 152 run_make_test(' 212 153 W = bad 213 154 X = bad … … 225 166 fo% : Z = pat 226 167 endif 227 228 EOF 229 close(MAKEFILE); 230 231 &run_make_with_options("$makefile6", "foo", &get_logfile); 232 $answer = "ok ok foo nopat\nok ok foo nopat\n"; 233 &compare_output($answer, &get_logfile(1)); 168 ', 169 'foo', "ok ok foo nopat\nok ok foo nopat\n"); 234 170 235 171 # Test #14 … … 237 173 # inheritance 238 174 239 &run_make_with_options("$makefile6", "bar", &get_logfile); 240 $answer = "ok ok bar nopat\nok ok bar nopat\n"; 241 &compare_output($answer, &get_logfile(1)); 175 run_make_test(undef, 'bar', "ok ok bar nopat\nok ok bar nopat\n"); 242 176 243 177 # Test #15 244 178 # Test double-colon rules with pattern-specific variable values 245 179 246 &run_make_with_options("$makefile6", "foo PATTERN=yes", &get_logfile); 247 $answer = "ok ok foo pat\nok ok foo pat\n"; 248 &compare_output($answer, &get_logfile(1)); 249 180 run_make_test(undef, 'foo PATTERN=yes', "ok ok foo pat\nok ok foo pat\n"); 250 181 251 182 # Test #16 … … 253 184 # (> make default buffer length) 254 185 255 $makefile7 = &get_tmpfile; 256 257 open(MAKEFILE, "> $makefile7"); 258 print MAKEFILE <<'EOF'; 186 run_make_test(' 259 187 base_metals_fmd_reports.sun5 base_metals_fmd_reports CreateRealPositions CreateMarginFunds deals_changed_since : BUILD_OBJ=$(shell if [ -f "build_information.generate" ]; then echo "$(OBJ_DIR)/build_information.o"; else echo "no build information"; fi ) 260 188 261 189 deals_changed_since: ; @echo $(BUILD_OBJ) 262 263 EOF 264 close(MAKEFILE); 265 266 &run_make_with_options("$makefile7", '', &get_logfile); 267 $answer = "no build information\n"; 268 &compare_output($answer, &get_logfile(1)); 190 ', 191 '', "no build information\n"); 269 192 270 193 # TEST #17 … … 287 210 .INTERMEDIATE: foo.x rules.mk 288 211 ', 289 '-I t1', 290 'MYVAR= FOOVAR=bar ALLVAR=xxx'); 212 '-I t1', 'MYVAR= FOOVAR=bar ALLVAR=xxx'); 291 213 292 214 rmfiles('t1/rules.mk'); … … 298 220 # double-expansion. See Savannah bug #15913. 299 221 300 run_make_test( "301 VAR := \$\$FOO222 run_make_test(' 223 VAR := $$FOO 302 224 foo: VAR += BAR 303 foo: ; \@echo '\$(VAR)'", 304 '', 305 '$FOO BAR'); 225 foo: ; @echo '."'".'$(VAR)'."'".' 226 ', 227 '', '$FOO BAR'); 228 229 # TEST #19: Override with append variables 230 231 run_make_test(' 232 a: override FOO += f1 233 a: FOO += f2 234 a: ; @echo "$(FOO)" 235 ', 236 '', "f1\n"); 237 238 run_make_test(undef, 'FOO=C', "C f1\n"); 239 240 # TEST #20: Check for continuation after semicolons 241 242 run_make_test(q! 243 a: A = 'hello; \ 244 world' 245 a: ; @echo $(A) 246 !, 247 '', "hello; world\n"); 248 249 # TEST #19: Test define/endef variables as target-specific vars 250 251 # run_make_test(' 252 # define b 253 # @echo global 254 # endef 255 # a: define b 256 # @echo local 257 # endef 258 259 # a: ; $(b) 260 # ', 261 # '', "local\n"); 306 262 307 263 1; -
trunk/src/kmk/tests/scripts/features/vpath
r2162 r2591 1 # -*-perl-*- 2 1 3 $description = "The following test creates a makefile to test the \n" 2 4 ."vpath directive which allows you to specify a search \n" … … 61 63 } 62 64 65 # TEST 2: after vpath lookup ensure we don't get incorrect circular dependency 66 # warnings due to change of struct file ptr. Savannah bug #13529. 67 68 mkdir('vpath-d', 0777); 69 70 run_make_test(q! 71 vpath %.te vpath-d/ 72 .SECONDARY: 73 default: vpath-d/a vpath-d/b 74 vpath-d/a: fail.te 75 vpath-d/b : fail.te 76 vpath-d/fail.te: 77 !, 78 '', "#MAKE#: Nothing to be done for `default'.\n"); 79 80 rmdir('vpath-d'); 81 63 82 1; -
trunk/src/kmk/tests/scripts/functions/abspath
- Property svn:keywords deleted
-
trunk/src/kmk/tests/scripts/functions/realpath
- Property svn:keywords deleted
-
trunk/src/kmk/tests/scripts/functions/shell
r969 r2591 12 12 13 13 14 # Test unescaped comment characters in shells. Savannah bug #20513 15 if ($all_tests) { 16 run_make_test(q! 17 FOO := $(shell echo '#') 18 foo: ; echo '$(FOO)' 19 !, 20 '', "#\n"); 21 } 22 14 23 # Test shells inside exported environment variables. 15 24 # This is the test that fails if we try to put make exported variables into -
trunk/src/kmk/tests/scripts/functions/wildcard
r969 r2591 82 82 &compare_output($answer,&get_logfile(1)); 83 83 84 # TEST #4: Verify that failed wildcards don't return the pattern 85 86 run_make_test(q! 87 all: ; @echo $(wildcard xz--y*.7) 88 !, 89 '', "\n"); 84 90 85 91 1; 86 87 88 89 90 91 92 93 94 -
trunk/src/kmk/tests/scripts/misc/general4
r1963 r2591 30 30 !$is_kmk ? 0 : 512); 31 31 unlink('foo.c'); 32 33 34 # Test other implicit rule searching35 36 &touch('bar');37 run_make_test('38 test.foo:39 %.foo : baz ; @echo done $<40 %.foo : bar ; @echo done $<41 fox: baz42 ',43 '',44 'done bar');45 unlink('bar');46 32 47 33 … … 84 70 '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n"); 85 71 72 # Test odd whitespace at the beginning of a line 73 74 run_make_test(" 75 all: 76 \f 77 78 \\ 79 \f \\ 80 \013 \\ 81 all: ; \@echo hi 82 ", 83 '', "hi\n"); 84 86 85 1; -
trunk/src/kmk/tests/scripts/options/dash-B
r969 r2591 71 71 rmfiles('foo.x', 'blah.x'); 72 72 73 # Test that $? is set properly with -B; all prerequisites will be newer! 74 75 utouch(-10, 'x.b'); 76 touch('x.a'); 77 78 run_make_test(q! 79 x.a: x.b ; @echo $? 80 !, 81 '-B', "x.b\n"); 82 83 unlink(qw(x.a x.b)); 84 73 85 1; -
trunk/src/kmk/tests/scripts/options/symlinks
- Property svn:keywords deleted
-
trunk/src/kmk/tests/scripts/variables/DEFAULT_GOAL
- Property svn:keywords deleted
r969 r2591 74 74 'foo'); 75 75 76 # TEST #5: .DEFAULT_GOAL containing just whitespace (Savannah bug #25697) 77 78 run_make_test(' 79 N = 80 .DEFAULT_GOAL = $N $N # Just whitespace 81 82 foo: ; @echo "boo" 83 ', 84 '', "#MAKE#: *** No targets. Stop.\n", 512); 76 85 77 86 # This tells the test driver that the perl test script executed properly. -
trunk/src/kmk/tests/scripts/variables/MAKE
r969 r2591 1 1 # -*-perl-*- 2 2 3 $description = "The following test creates a makefile to test MAKE \n" 4 ."(very generic)"; 3 $description = "Test proper behavior of the MAKE variable"; 5 4 6 5 $details = "DETAILS"; 7 6 8 open(MAKEFILE,"> $makefile"); 7 run_make_test(q! 8 TMP := $(MAKE) 9 MAKE := $(subst X=$(X),,$(MAKE)) 10 all: 11 @echo $(TMP) 12 $(MAKE) -f #MAKEFILE# foo 9 13 10 # The Contents of the MAKEFILE ... 14 foo: 15 @echo $(MAKE) 16 !, 17 '', 18 "#MAKEPATH#\n#MAKEPATH# -f #MAKEFILE# foo\n" 19 . "#MAKE#[1]: Entering directory `#PWD#'\n" 20 . "#MAKEPATH#\n#MAKE#[1]: Leaving directory `#PWD#'\n"); 11 21 12 print MAKEFILE "TMP := \$(MAKE)\n"; 13 print MAKEFILE "MAKE := \$(subst X=\$(X),,\$(MAKE))\n\n"; 14 print MAKEFILE "all:\n"; 15 print MAKEFILE "\t\@echo \$(TMP)\n"; 16 print MAKEFILE "\t\$(MAKE) -f $makefile foo\n\n"; 17 print MAKEFILE "foo:\n"; 18 print MAKEFILE "\t\@echo \$(MAKE)\n"; 19 20 # END of Contents of MAKEFILE 21 22 close(MAKEFILE); 23 24 # Create the answer to what should be produced by this Makefile 25 $answer = "$mkpath\n$mkpath -f $makefile foo\n" 26 . "${make_name}[1]: Entering directory `$pwd'\n" 27 . "$mkpath\n${make_name}[1]: Leaving directory `$pwd'\n"; 28 29 &run_make_with_options($makefile,"",&get_logfile,0); 30 31 &rmfiles("foo"); 32 # COMPARE RESULTS 33 &compare_output($answer,&get_logfile(1)); 22 rmfiles("foo"); 34 23 35 24 1; -
trunk/src/kmk/tests/scripts/variables/MAKEFILES
r969 r2591 32 32 &compare_output($answer,&get_logfile(1)); 33 33 34 # TEST 2: Verify that included makefiles don't set the default goal. 35 # See Savannah bug #13401. 36 37 create_file('xx-inc.mk', ' 38 include_goal: ; @echo $@ 39 include xx-ind.mk 40 '); 41 42 create_file('xx-ind.mk', ' 43 indirect_goal: ; @echo $@ 44 '); 45 46 run_make_test(q! 47 top: ; @echo $@ 48 !, 49 'MAKEFILES=xx-inc.mk', "top\n"); 50 51 unlink(qw(xx-inc.mk xx-ind.mk)); 52 34 53 1; -
trunk/src/kmk/tests/scripts/variables/MFILE_LIST
- Property svn:keywords deleted
-
trunk/src/kmk/tests/scripts/variables/SHELL
- Property svn:keywords deleted
r1969 r2591 50 50 $extraENV{SHELL} = $mshell; 51 51 52 # bird: This was wrong, see Savannah bug #24655. Fixed in kBuild. 53 run_make_test("all: export SHELL := /./$mshell\n".' 54 all:;@echo "$(SHELL) $$SHELL" 55 ', '', "/./$mshell /./$mshell"); 52 # bird: This was wrong at some point, see Savannah bug #24655. Was first fixed in kBuild. 53 run_make_test(" 54 SHELL := /././$mshell 55 one: two 56 two: export SHELL := /./$mshell\n".' 57 one two:;@echo "$@: $(SHELL) $$SHELL" 58 ', '', "two: /./$mshell /./$mshell\none: /././$mshell $mshell\n"); 59 60 # Test .SHELLFLAGS 61 62 # We don't know the output here: on Solaris for example, every line printed 63 # by the shell in -x mode has a trailing space (!!) 64 my $script = 'true; true'; 65 my $flags = '-xc'; 66 my $out = `/bin/sh $flags '$script' 2>&1`; 67 68 run_make_test(qq! 69 .SHELLFLAGS = $flags 70 all: ; \@$script 71 !, 72 '', $out); 73 74 # We can't just use "false" because on different systems it provides a 75 # different exit code--once again Solaris: false exits with 255 not 1 76 $script = 'true; false; true'; 77 $flags = '-xec'; 78 $out = `/bin/sh $flags '$script' 2>&1`; 79 my $err = $? >> 8; 80 81 run_make_test(qq! 82 .SHELLFLAGS = $flags 83 all: ; \@$script 84 !, 85 '', "$out#MAKE#: *** [all] Error $err\n", 512); 56 86 57 87 1; -
trunk/src/kmk/tests/scripts/variables/automatic
r1984 r2591 108 108 unlink('foo'); 109 109 110 # TEST #4: ensure prereq ordering is correct when the commmand target has none 111 # See Savannah bug #21198 112 113 run_make_test(' 114 all : A B 115 all : ; @echo $@ -- $^ -- $< 116 all : C D 117 all : E F 118 A B C D E F G H : ; @: 119 ', 120 '', "all -- A B C D E F -- A\n"); 121 110 122 1; -
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; -
trunk/src/kmk/tests/test_driver.pl
r1993 r2591 7 7 # 8 8 # Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 9 # 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 9 # 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 10 # Foundation, Inc. 10 11 # This file is part of GNU Make. 11 12 # … … 30 31 # variables and then calls &toplevel, which does all the real work. 31 32 32 # $Id: test_driver.pl,v 1. 24 2007/11/04 21:54:02psmith Exp $33 # $Id: test_driver.pl,v 1.30 2010/07/28 05:39:50 psmith Exp $ 33 34 34 35 … … 54 55 $test_timeout = 5; 55 56 57 # Path to Perl 58 $perl_name = $^X; 56 59 57 60 # %makeENV is the cleaned-out environment. … … 239 242 { 240 243 # Set up an initial value. In perl5 we can do it the easy way. 241 #242 244 $osname = defined($^O) ? $^O : ''; 245 246 # Find a path to Perl 243 247 244 248 # See if the filesystem supports long file names with multiple … … 276 280 if ($osname =~ /not found/i) 277 281 { 278 $osname = "(something unixy with no uname)";282 $osname = "(something posixy with no uname)"; 279 283 } 280 284 elsif ($@ ne "" || $?) … … 283 287 if ($@ ne "" || $?) 284 288 { 285 $osname = "(something unixy)";289 $osname = "(something posixy)"; 286 290 } 287 291 } … … 460 464 $diffext = 'd'; 461 465 $baseext = 'b'; 466 $runext = 'r'; 462 467 $extext = ''; 463 468 } else { … … 465 470 $diffext = 'diff'; 466 471 $baseext = 'base'; 472 $runext = 'run'; 467 473 $extext = '.'; 468 474 } … … 470 476 $diff_filename = "$testpath.$diffext"; 471 477 $base_filename = "$testpath.$baseext"; 478 $run_filename = "$testpath.$runext"; 472 479 $tmp_filename = "$testpath.$tmpfilesuffix"; 473 480 … … 483 490 $tests_run = 0; 484 491 $tests_passed = 0; 492 485 493 $code = do $perl_testname; 486 494 … … 716 724 717 725 &create_file (&get_basefile, $answer); 726 &create_file (&get_runfile, $command_string); 718 727 719 728 print "\nCreating Difference File ...\n" if $debug; … … 723 732 local($command) = "diff -c " . &get_basefile . " " . $logfile; 724 733 &run_command_with_output(&get_difffile,$command); 734 } else { 735 &rmfiles (); 725 736 } 726 737 … … 816 827 local $SIG{ALRM} = sub { die "timeout\n"; }; 817 828 alarm $test_timeout; 818 $code = system @_;829 $code = system(@_); 819 830 alarm 0; 820 831 }; … … 853 864 my $filename = shift; 854 865 855 print "\nrun_command_with_output($filename ): @_\n" if $debug;866 print "\nrun_command_with_output($filename,$runname): @_\n" if $debug; 856 867 &attach_default_output ($filename); 857 868 my $code = _run_command(@_); … … 1226 1237 } 1227 1238 1239 # This subroutine returns a command filename with a number appended 1240 # to the end corresponding to how many logfiles (and thus command files) 1241 # have been created in the current running test. 1242 1243 sub get_runfile 1244 { 1245 return ($run_filename . &num_suffix ($num_of_logfiles)); 1246 } 1247 1228 1248 # just like logfile, only a generic tmp filename for use by the test. 1229 1249 # they are automatically cleaned up unless -keep was used, or the test fails.
Note:
See TracChangeset
for help on using the changeset viewer.