← Back to team overview

maria-developers team mailing list archive

Rev 2751: MBUG#442254: mysql-test-run --embedded fails on Windows with: ERROR: .opt file references 'EXAMPLE_PLUGIN_OPT' in file:///home/psergey/bzr-new/mysql-5.1-maria-contd4/

 

At file:///home/psergey/bzr-new/mysql-5.1-maria-contd4/

------------------------------------------------------------
revno: 2751
revision-id: psergey@xxxxxxxxxxxx-20091004140534-693l5bsctpf9zseq
parent: psergey@xxxxxxxxxxxx-20091003192413-50pog1zkms4xe670
committer: Sergey Petrunya <psergey@xxxxxxxxxxxx>
branch nick: mysql-5.1-maria-contd4
timestamp: Sun 2009-10-04 18:05:34 +0400
message:
  MBUG#442254: mysql-test-run --embedded fails on Windows with: ERROR: .opt file references 'EXAMPLE_PLUGIN_OPT'
  - Make mysql-test-run keep track of what variables it could be expected to set but didn't, 
    and skip the test if its .opt file uses such variable
    (note: we can't disable using --include/have_smth.inc approach because it requires that mysqltest can be
     successfully started before the have_smth check is performed, and ".opt file references..." error occurs
     before mysqltest is started)
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-09-29 19:02:48 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-10-04 14:05:34 +0000
@@ -260,6 +260,12 @@
 # print messages when test suite is stopped (for buildbot)
 my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE};
 
+# List of environment variables that mysql-test-run can be 
+# expected to set but didnt because of test run configuration
+# (e.g. we dont set EXAMPLE_PLUGIN when running embedded server 
+#  on windows)
+our $unsupported_env_variables="";
+
 select(STDOUT);
 $| = 1; # Automatically flush STDOUT
 
@@ -1923,6 +1929,11 @@
 
     $ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
     $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=;EXAMPLE=".$plugin_filename.";";
+  } else {
+    $unsupported_env_variables .= "EXAMPLE_PLUGIN ";
+    $unsupported_env_variables .= "EXAMPLE_PLUGIN_OPT ";
+    $unsupported_env_variables .= "HA_EXAMPLE_SO ";
+    $unsupported_env_variables .= "EXAMPLE_PLUGIN_LOAD ";
   }
 
   # ----------------------------------------------------
@@ -3516,8 +3527,14 @@
 
     return 1;
   }
-
   my $test= start_mysqltest($tinfo);
+
+  if ($tinfo->{'skip'}) {
+    mtr_verbose("According to start_mysqltest(), the test should be skipped");
+    mtr_report_test_skipped($tinfo);
+    return 0;
+  }
+
   # Set only when we have to keep waiting after expectedly died server
   my $keep_waiting_proc = 0;
 
@@ -4714,6 +4731,12 @@
 
   if ( ! defined $ENV{$string} )
   {
+    if ($unsupported_env_variables =~ /$string/)
+    {
+      # This is environment variable that we ought to set but didnt. 
+      # Return undef all the way up so that the test needing it is skipped
+      return undef;
+    }
     mtr_error(".opt file references '$string' which is not set");
   }
 
@@ -4731,8 +4754,14 @@
   # Expand environment variables
   foreach my $opt ( @$opts )
   {
-    $opt =~ s/\$\{(\w+)\}/envsubst($1)/ge;
-    $opt =~ s/\$(\w+)/envsubst($1)/ge;
+    my ($subst1, $subst2) = ("dummy","dummy");
+
+    $opt =~ s/\$\{(\w+)\}/defined($subst1= envsubst($1))? $subst1 : "undef"/ge;
+    $opt =~ s/\$(\w+)/defined($subst2= envsubst($1))? $subst2 : "undef"/ge;
+    if (!(defined $subst1) || !(defined $subst2)) {
+      # Detected use of unsupported env variable
+      return undef;
+    }
   }
   return $opts;
 }
@@ -5075,6 +5104,11 @@
     my $mysqld_args;
     mtr_init_args(\$mysqld_args);
     my $extra_opts= get_extra_opts($mysqld, $tinfo);
+    if (! defined $extra_opts) {
+      $tinfo->{'skip'}= 1;
+      $tinfo->{'comment'}= "Test requires options not supported in this configuration";
+      return undef;
+    }
     mysqld_arguments($mysqld_args, $mysqld, $extra_opts);
     mtr_add_arg($args, "--server-arg=%s", $_) for @$mysqld_args;
 




Follow ups