[Maria-developers] 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@askmonty.org-20091004140534-693l5bsctpf9zseq parent: psergey@askmonty.org-20091003192413-50pog1zkms4xe670 committer: Sergey Petrunya <psergey@askmonty.org> 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;
Sergey Petrunya <psergey@askmonty.org> writes:
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)
@@ -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 "; }
In this case, I think it is simpler and better to just set the variables to empty here. Then the plugin tests will be skipped by include/have_example_plugin.inc. else { for (qw(EXAMPLE_PLUGIN EXAMPLE_PLUGIN_OPT HA_EXAMPLE_SO EXAMPLE_PLUGIN_LOAD)) { $ENV{$_}= ''; } } In addition/instead, you might also consider adding include/have_example_plugin.inc to the list @tags in mysql-test/lib/mtr_cases.pm. Then add in sub collect_one_test_case at the place where there are other similar checks: if ( $tinfo->{'example_plugin_test'} ) { if ( !$ENV{'EXAMPLE_PLUGIN'} ) { $tinfo->{'skip'}= 1; $tinfo->{'comment'}= "Test requires the 'example' plugin"; return $tinfo; } } This will make mysql-test-run not even attempt to start the server, avoiding the problem with the .opt file. My suggestion is to do both, or do either one if you prefer. - Kristian.
participants (2)
-
Kristian Nielsen
-
Sergey Petrunya