59
59
return @data ;
60
60
}
61
61
62
- sub test ($$$$$) {
63
- my ($name , $test , $t_level , $cmd , $ign ) = @_ ;
62
+ sub test ($$$$$$ ) {
63
+ my ($name , $test , $t_level , $cmd , $ign , $dry_run ) = @_ ;
64
64
my ($level , $input , $options , $grep_options , @results ) = load(" $test " );
65
65
66
66
# If the 4th line is activate-multi-line-match we enable multi-line checks
@@ -106,6 +106,11 @@ ($$$$$)
106
106
107
107
my $failed = 2;
108
108
if ($level & $t_level ) {
109
+
110
+ if ($dry_run ) {
111
+ return 0;
112
+ }
113
+
109
114
$failed = run($name , $input , $cmd , $options , $output );
110
115
111
116
if (!$failed ) {
@@ -211,6 +216,7 @@ ($$$$)
211
216
-c CMD run tests on CMD - required option
212
217
-i <regex> options in test.desc matching the specified perl regex are ignored
213
218
-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
214
220
-h show this help and exit
215
221
-C core: run all essential tests (default if none of C/T/F/K are given)
216
222
-T thorough: run expensive tests
@@ -249,9 +255,9 @@ ($$$$)
249
255
use Getopt::Std;
250
256
$main::VERSION = 0.1;
251
257
$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
253
259
$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 , " " );
255
261
$opt_c or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
256
262
(!$opt_j || $has_thread_pool ) or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
257
263
$opt_h and &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
@@ -260,7 +266,7 @@ ($$$$)
260
266
$t_level += 4 if ($opt_F );
261
267
$t_level += 8 if ($opt_K );
262
268
$t_level += 1 if ($opt_C || 0 == $t_level );
263
-
269
+ my $dry_run = $opt_n ;
264
270
265
271
266
272
open LOG," >tests.log" ;
287
293
my @files = glob " $test /*.desc" ;
288
294
for (0..$#files ){
289
295
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 );
291
297
292
298
lock($skips );
293
299
defined ($pool ) and print " Running $test $files [$_ ]" ;
0 commit comments