Changeset 2591 in kBuild for trunk/src/kmk/tests/run_make_tests.pl
- 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/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";
Note:
See TracChangeset
for help on using the changeset viewer.

