Commit b35617cd authored by unknown's avatar unknown
Browse files

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 a4c972bc
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -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);
      }
    }

  }
}