66
66
return @data ;
67
67
}
68
68
69
- sub test ($$$$$$$$$) {
70
- my ($name , $test , $t_level , $cmd , $ign , $dry_run , $defines , $include_tags , $exclude_tags ) = @_ ;
69
+ sub test ($$$$$$$$$$ ) {
70
+ my ($name , $test , $t_level , $cmd , $ign , $dry_run , $defines , $include_tags , $exclude_tags , $output_suffix ) = @_ ;
71
71
my ($level_and_tags , $input , $options , $grep_options , @results ) = load(" $test " );
72
72
my @keys = keys %{$defines };
73
73
foreach my $key (@keys ) {
@@ -115,7 +115,12 @@ ($$$$$$$$$)
115
115
116
116
my $descriptor = basename($test );
117
117
my $output = $descriptor ;
118
- $output =~ s /\. [^.]*$/ .out/ ;
118
+ $output =~ s /\. [^.]*$// ;
119
+ if ($output_suffix ) {
120
+ $output .= " -" ;
121
+ $output .= $output_suffix ;
122
+ }
123
+ $output .= " .out" ;
119
124
120
125
if ($output eq $input ) {
121
126
print (" Error in test file -- $test \n " );
@@ -269,7 +274,10 @@ ($$$$)
269
274
test descriptors
270
275
-I <tag> run only tests that have the given secondary tag. Can be repeated.
271
276
-X <tag> exclude tests that have the given secondary tag. Can be repeated.
272
-
277
+ -s <suffix> append <suffix> to all output and log files. Enables concurrent
278
+ testing of the same desc file with different commands or options,
279
+ as runs with different suffixes will operate independently and keep
280
+ independent logs.
273
281
274
282
test.pl expects a test.desc file in each subdirectory. The file test.desc
275
283
follows the format specified below. Any line starting with // will be ignored.
@@ -304,9 +312,9 @@ ($$$$)
304
312
use Getopt::Long qw( :config pass_through bundling) ;
305
313
$main::VERSION = 0.1;
306
314
$Getopt::Std::STANDARD_HELP_VERSION = 1;
307
- our ($opt_c , $opt_i , $opt_j , $opt_n , $opt_p , $opt_h , $opt_C , $opt_T , $opt_F , $opt_K , %defines , @include_tags , @exclude_tags ); # the variables for getopt
315
+ our ($opt_c , $opt_i , $opt_j , $opt_n , $opt_p , $opt_h , $opt_C , $opt_T , $opt_F , $opt_K , $opt_s , %defines , @include_tags , @exclude_tags ); # the variables for getopt
308
316
GetOptions(" D=s" => \%defines , " X=s" => \@exclude_tags , " I=s" => \@include_tags );
309
- getopts(' c:i:j:nphCTFK ' ) or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
317
+ getopts(' c:i:j:nphCTFKs: ' ) or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
310
318
$opt_c or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
311
319
$opt_j = $opt_j || $ENV {' TESTPL_JOBS' } || 0;
312
320
if ($opt_j && $opt_j != 1 && !$has_thread_pool ) {
@@ -321,9 +329,16 @@ ($$$$)
321
329
$t_level += 8 if ($opt_K );
322
330
$t_level += 1 if ($opt_C || 0 == $t_level );
323
331
my $dry_run = $opt_n ;
332
+ my $log_suffix = $opt_s ;
324
333
334
+ my $logfile_name = " tests" ;
335
+ if ($log_suffix ) {
336
+ $logfile_name .= " -" ;
337
+ $logfile_name .= $log_suffix ;
338
+ }
339
+ $logfile_name .= " .log" ;
325
340
326
- open LOG," >tests.log " ;
341
+ open LOG, ( " > " . $logfile_name ) ;
327
342
328
343
print " Loading\n " ;
329
344
my @tests = @ARGV != 0 ? @ARGV : dirs();
349
364
defined ($pool ) or print " Running $files [$_ ]" ;
350
365
my $start_time = time ();
351
366
$failed_skipped = test(
352
- $test , $files [$_ ], $t_level , $opt_c , $opt_i , $dry_run , \%defines , \@include_tags , \@exclude_tags );
367
+ $test , $files [$_ ], $t_level , $opt_c , $opt_i , $dry_run , \%defines , \@include_tags , \@exclude_tags , $log_suffix );
353
368
my $runtime = time () - $start_time ;
354
369
355
370
lock($skips );
0 commit comments