@@ -194,7 +194,7 @@ sub get_affecting_tests($$$);
194
194
sub combine_info_files ($$);
195
195
sub merge_checksums ($$$);
196
196
sub combine_info_entries ($$$);
197
- sub apply_prefix ($$ );
197
+ sub apply_prefix ($@ );
198
198
sub system_no_output ($@);
199
199
sub read_config ($);
200
200
sub apply_config ($);
@@ -212,6 +212,7 @@ sub get_br_found_and_hit($);
212
212
sub warn_handler ($);
213
213
sub die_handler ($);
214
214
sub parse_ignore_errors (@);
215
+ sub parse_dir_prefix (@);
215
216
sub rate ($$;$$$);
216
217
217
218
@@ -259,7 +260,8 @@ sub gen_png($$$@);
259
260
260
261
# Global variables & initialization
261
262
our %info_data ; # Hash containing all data from .info file
262
- our $dir_prefix ; # Prefix to remove from all sub directories
263
+ our @opt_dir_prefix ; # Array of prefixes to remove from all sub directories
264
+ our @dir_prefix ;
263
265
our %test_description ; # Hash containing test descriptions if available
264
266
our $date = get_date_string();
265
267
@@ -402,7 +404,7 @@ if (!GetOptions("output-directory|o=s" => \$output_directory,
402
404
" keep-descriptions|k" => \$keep_descriptions ,
403
405
" css-file|c=s" => \$css_filename ,
404
406
" baseline-file|b=s" => \$base_filename ,
405
- " prefix|p=s" => \$dir_prefix ,
407
+ " prefix|p=s" => \@opt_dir_prefix ,
406
408
" num-spaces=i" => \$tab_size ,
407
409
" no-prefix" => \$no_prefix ,
408
410
" no-sourceview" => \$no_sourceview ,
@@ -466,6 +468,9 @@ if ($version)
466
468
# Determine which errors the user wants us to ignore
467
469
parse_ignore_errors(@opt_ignore_errors );
468
470
471
+ # Split the list of prefixes if needed
472
+ parse_dir_prefix(@opt_dir_prefix );
473
+
469
474
# Check for info filename
470
475
if (!@info_filenames )
471
476
{
@@ -519,11 +524,11 @@ if ($no_sourceview && defined($frames))
519
524
}
520
525
521
526
# Issue a warning if --no-prefix is enabled together with --prefix
522
- if ($no_prefix && defined ( $ dir_prefix) )
527
+ if ($no_prefix && @ dir_prefix )
523
528
{
524
529
warn (" WARNING: option --prefix disabled because --no-prefix was " .
525
530
" specified!\n " );
526
- $ dir_prefix = undef ;
531
+ @ dir_prefix = undef ;
527
532
}
528
533
529
534
@fileview_sortlist = ($SORT_FILE );
@@ -869,14 +874,16 @@ sub gen_html()
869
874
# User requested that we leave filenames alone
870
875
info(" User asked not to remove filename prefix\n " );
871
876
}
872
- elsif (!defined ( $ dir_prefix) )
877
+ elsif (! @ dir_prefix )
873
878
{
874
879
# Get prefix common to most directories in list
875
- $dir_prefix = get_prefix(1, keys (%info_data ));
880
+ my $prefix = get_prefix(1, keys (%info_data ));
876
881
877
- if ($dir_prefix )
882
+ if ($prefix )
878
883
{
879
- info(" Found common filename prefix \" $dir_prefix \"\n " );
884
+ info(" Found common filename prefix \" $prefix \"\n " );
885
+ $dir_prefix [0] = $prefix ;
886
+
880
887
}
881
888
else
882
889
{
@@ -886,11 +893,17 @@ sub gen_html()
886
893
}
887
894
else
888
895
{
889
- info(" Using user-specified filename prefix \" " .
890
- " $dir_prefix \"\n " );
891
- $dir_prefix =~ s /\/ +$// ;
896
+ my $msg = " Using user-specified filename prefix " ;
897
+ for my $i (0 .. $#dir_prefix )
898
+ {
899
+ $dir_prefix [$i ] =~ s /\/ +$// ;
900
+ $msg .= " , " unless 0 == $i ;
901
+ $msg .= " \" " . $dir_prefix [$i ] . " \" " ;
902
+ }
903
+ info($msg . " \n " );
892
904
}
893
905
906
+
894
907
# Read in test description file if specified
895
908
if ($desc_filename )
896
909
{
@@ -936,10 +949,10 @@ sub gen_html()
936
949
$dir_name = " root" if ($dir_name eq " " );
937
950
938
951
# Remove prefix if applicable
939
- if (!$no_prefix && $ dir_prefix )
952
+ if (!$no_prefix && @ dir_prefix )
940
953
{
941
- # Match directory names beginning with $ dir_prefix
942
- $dir_name = apply_prefix($dir_name , $ dir_prefix );
954
+ # Match directory names beginning with one of @ dir_prefix
955
+ $dir_name = apply_prefix($dir_name ,@ dir_prefix );
943
956
}
944
957
945
958
# Generate name for directory overview HTML page
@@ -1077,8 +1090,8 @@ sub process_dir($)
1077
1090
# Remove prefix if applicable
1078
1091
if (!$no_prefix )
1079
1092
{
1080
- # Match directory name beginning with $ dir_prefix
1081
- $rel_dir = apply_prefix($rel_dir , $ dir_prefix );
1093
+ # Match directory name beginning with one of @ dir_prefix
1094
+ $rel_dir = apply_prefix($rel_dir ,@ dir_prefix );
1082
1095
}
1083
1096
1084
1097
$trunc_dir = $rel_dir ;
@@ -1260,7 +1273,7 @@ sub write_function_page($$$$$$$$$$$$$$$$$$)
1260
1273
1261
1274
sub process_file ($$$)
1262
1275
{
1263
- info(" Processing file " .apply_prefix($_ [2], $ dir_prefix )." \n " );
1276
+ info(" Processing file " .apply_prefix($_ [2], @ dir_prefix )." \n " );
1264
1277
1265
1278
my $trunc_dir = $_ [0];
1266
1279
my $rel_dir = $_ [1];
@@ -5704,22 +5717,25 @@ sub remove_unused_descriptions()
5704
5717
5705
5718
5706
5719
#
5707
- # apply_prefix(filename, prefix )
5720
+ # apply_prefix(filename, PREFIXES )
5708
5721
#
5709
- # If FILENAME begins with PREFIX, remove PREFIX from FILENAME and return
5710
- # resulting string, otherwise return FILENAME.
5722
+ # If FILENAME begins with PREFIX from PREFIXES , remove PREFIX from FILENAME
5723
+ # and return resulting string, otherwise return FILENAME.
5711
5724
#
5712
5725
5713
- sub apply_prefix ($$ )
5726
+ sub apply_prefix ($@ )
5714
5727
{
5715
- my $filename = $_ [0] ;
5716
- my $prefix = $_ [1] ;
5728
+ my $filename = shift ;
5729
+ my @dir_prefix = @_ ;
5717
5730
5718
- if (defined ( $prefix ) && ( $prefix ne " " ) )
5731
+ if (@dir_prefix )
5719
5732
{
5720
- if ( $filename =~ / ^ \Q $prefix \E\/ (.*) $ / )
5733
+ foreach my $prefix ( @dir_prefix )
5721
5734
{
5722
- return substr ($filename , length ($prefix ) + 1);
5735
+ if ($prefix ne " " && $filename =~ / ^\Q $prefix \E\/ (.*)$ / )
5736
+ {
5737
+ return substr ($filename , length ($prefix ) + 1);
5738
+ }
5723
5739
}
5724
5740
}
5725
5741
@@ -5975,6 +5991,31 @@ sub parse_ignore_errors(@)
5975
5991
}
5976
5992
}
5977
5993
5994
+ #
5995
+ # parse_dir_prefix(@dir_prefix)
5996
+ #
5997
+ # Parse user input about the prefix list
5998
+ #
5999
+
6000
+ sub parse_dir_prefix (@)
6001
+ {
6002
+ my (@opt_dir_prefix ) = @_ ;
6003
+ my $item ;
6004
+
6005
+ return if (!@opt_dir_prefix );
6006
+
6007
+ foreach $item (@opt_dir_prefix ) {
6008
+ $item =~ s /\s // g ;
6009
+ if ($item =~ / ,/ ) {
6010
+ # Split and add comma-separated parameters
6011
+ push (@dir_prefix , split (/ ,/ , $item ));
6012
+ } else {
6013
+ # Add single parameter
6014
+ push (@dir_prefix , $item );
6015
+ }
6016
+ }
6017
+ }
6018
+
5978
6019
#
5979
6020
# rate(hit, found[, suffix, precision, width])
5980
6021
#
0 commit comments