5959 return @data ;
6060}
6161
62- sub test ($$$$$) {
63- my ($name , $test , $t_level , $cmd , $ign ) = @_ ;
62+ sub test ($$$$$$ ) {
63+ my ($name , $test , $t_level , $cmd , $ign , $dry_run ) = @_ ;
6464 my ($level , $input , $options , $grep_options , @results ) = load(" $test " );
6565
6666 # If the 4th line is activate-multi-line-match we enable multi-line checks
@@ -106,6 +106,11 @@ ($$$$$)
106106
107107 my $failed = 2;
108108 if ($level & $t_level ) {
109+
110+ if ($dry_run ) {
111+ return 0;
112+ }
113+
109114 $failed = run($name , $input , $cmd , $options , $output );
110115
111116 if (!$failed ) {
@@ -211,6 +216,7 @@ ($$$$)
211216 -c CMD run tests on CMD - required option
212217 -i <regex> options in test.desc matching the specified perl regex are ignored
213218 -j <num> run <num> tests in parallel (requires Thread::Pool::Simple)
219+ -n dry-run: print the tests that would be run, but don't actually run them
214220 -h show this help and exit
215221 -C core: run all essential tests (default if none of C/T/F/K are given)
216222 -T thorough: run expensive tests
@@ -249,9 +255,9 @@ ($$$$)
249255use Getopt::Std;
250256$main::VERSION = 0.1;
251257$Getopt::Std::STANDARD_HELP_VERSION = 1;
252- our ($opt_c , $opt_i , $opt_j , $opt_h , $opt_C , $opt_T , $opt_F , $opt_K ); # the variables for getopt
258+ our ($opt_c , $opt_i , $opt_j , $opt_n , $ opt_h , $opt_C , $opt_T , $opt_F , $opt_K ); # the variables for getopt
253259$opt_j = 0;
254- getopts(' c:i:j:hCTFK ' ) or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
260+ getopts(' c:i:j:nhCTFK ' ) or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
255261$opt_c or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
256262(!$opt_j || $has_thread_pool ) or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
257263$opt_h and &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
@@ -260,7 +266,7 @@ ($$$$)
260266$t_level += 4 if ($opt_F );
261267$t_level += 8 if ($opt_K );
262268$t_level += 1 if ($opt_C || 0 == $t_level );
263-
269+ my $dry_run = $opt_n ;
264270
265271
266272open LOG," >tests.log" ;
287293 my @files = glob " $test /*.desc" ;
288294 for (0..$#files ){
289295 defined ($pool ) or print " Running $files [$_ ]" ;
290- $failed_skipped = test($test , $files [$_ ], $t_level , $opt_c , $opt_i );
296+ $failed_skipped = test($test , $files [$_ ], $t_level , $opt_c , $opt_i , $dry_run );
291297
292298 lock($skips );
293299 defined ($pool ) and print " Running $test $files [$_ ]" ;
0 commit comments