Improve the function that parses test files looking for what features it uses

Now also detects "source nnnn;" command, previous version only detected
"--source"
parent 927c20dd
......@@ -575,8 +575,6 @@ sub mtr_options_from_test_file($$) {
while ( my $line= <$F> )
{
next if ( $line !~ /^--/ );
# Match this line against tag in "tags" array
foreach my $tag (@tags)
{
......@@ -588,15 +586,22 @@ sub mtr_options_from_test_file($$) {
}
# If test sources another file, open it as well
if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ )
if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ or
$line =~ /^([[:space:]]*)source(.*);$/ )
{
my $value= $2;
$value =~ s/^\s+//; # Remove leading space
$value =~ s/[[:space:]]+$//; # Remove ending space
my $sourced_file= "$::glob_mysql_test_dir/$value";
if ( -f $sourced_file )
{
# Only source the file if it exists, we may get
# false positives in the regexes above if someone
# writes "source nnnn;" in a test case(such as mysqltest.test)
mtr_options_from_test_file($tinfo, $sourced_file);
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment