6666 return @data ;
6767}
6868
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 ) = @_ ;
7171 my ($level_and_tags , $input , $options , $grep_options , @results ) = load(" $test " );
7272 my @keys = keys %{$defines };
7373 foreach my $key (@keys ) {
@@ -115,7 +115,12 @@ ($$$$$$$$$)
115115
116116 my $descriptor = basename($test );
117117 my $output = $descriptor ;
118- $output =~ s /\. [^.]*$/ .out/ ;
118+ $output =~ s /\. [^.]*$// ;
119+ if ($output_suffix ) {
120+ $output .= " -" ;
121+ $output .= $output_suffix ;
122+ }
123+ $output .= " .out" ;
119124
120125 if ($output eq $input ) {
121126 print (" Error in test file -- $test \n " );
@@ -269,7 +274,10 @@ ($$$$)
269274 test descriptors
270275 -I <tag> run only tests that have the given secondary tag. Can be repeated.
271276 -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.
273281
274282test.pl expects a test.desc file in each subdirectory. The file test.desc
275283follows the format specified below. Any line starting with // will be ignored.
@@ -304,9 +312,9 @@ ($$$$)
304312use Getopt::Long qw( :config pass_through bundling) ;
305313$main::VERSION = 0.1;
306314$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
308316GetOptions(" 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 , " " );
310318$opt_c or &main::HELP_MESSAGE(\*STDOUT , " " , $main::VERSION , " " );
311319$opt_j = $opt_j || $ENV {' TESTPL_JOBS' } || 0;
312320if ($opt_j && $opt_j != 1 && !$has_thread_pool ) {
@@ -321,9 +329,16 @@ ($$$$)
321329$t_level += 8 if ($opt_K );
322330$t_level += 1 if ($opt_C || 0 == $t_level );
323331my $dry_run = $opt_n ;
332+ my $log_suffix = $opt_s ;
324333
334+ my $logfile_name = " tests" ;
335+ if ($log_suffix ) {
336+ $logfile_name .= " -" ;
337+ $logfile_name .= $log_suffix ;
338+ }
339+ $logfile_name .= " .log" ;
325340
326- open LOG," >tests.log " ;
341+ open LOG, ( " > " . $logfile_name ) ;
327342
328343print " Loading\n " ;
329344my @tests = @ARGV != 0 ? @ARGV : dirs();
349364 defined ($pool ) or print " Running $files [$_ ]" ;
350365 my $start_time = time ();
351366 $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 );
353368 my $runtime = time () - $start_time ;
354369
355370 lock($skips );
0 commit comments