diff options
author | unknown <msvensson@neptunus.(none)> | 2006-06-14 22:15:21 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-06-14 22:15:21 +0200 |
commit | 59d3c6f4c76aa735d2db4800d939a2474bda0930 (patch) | |
tree | b795f04ef7ba48f2262e41475d7856ffd340b21d /mysql-test/lib | |
parent | 50941b923ac961d87b40315697f9a21682f9ccc6 (diff) | |
download | mariadb-git-59d3c6f4c76aa735d2db4800d939a2474bda0930.tar.gz |
Update function 'mtr_options_from_file' after review (and some help)
Diffstat (limited to 'mysql-test/lib')
-rw-r--r-- | mysql-test/lib/mtr_cases.pl | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 62c2aecb771..9d5ddfd526e 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -5,6 +5,7 @@ # same name. use File::Basename; +use IO::File(); use strict; sub collect_test_cases ($); @@ -505,8 +506,6 @@ sub collect_one_test_case($$$$$$$) { } -use IO::File; - # List of tags in the .test files that if found should set # the specified value in "tinfo" our @tags= @@ -526,17 +525,16 @@ sub mtr_options_from_test_file($$) { #mtr_verbose("$file"); my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!"); - while ( <$F> ) + while ( my $line= <$F> ) { chomp; - # Skip all lines not starting with "--" - next if ( ! /^--/ ); + next if ( $line !~ /^--/ ); # Match this line against tag in "tags" array foreach my $tag (@tags) { - if ( $_ =~ /(.*)\Q$tag->[0]\E(.*)$/ ) + if ( index($line, $tag->[0]) >= 0 ) { # Tag matched, assign value to "tinfo" $tinfo->{"$tag->[1]"}= $tag->[2]; @@ -544,11 +542,11 @@ sub mtr_options_from_test_file($$) { } # If test sources another file, open it as well - if ( /^--([[:space:]]*)source/ ) + if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ ) { - my $value= $'; + my $value= $2; $value =~ s/^\s+//; # Remove leading space - $value =~ s/\s+$//; # Remove ending space + $value =~ s/[[:space:]]+$//; # Remove ending space my $sourced_file= "$::glob_mysql_test_dir/$value"; mtr_options_from_test_file($tinfo, $sourced_file); |