Hi! 4 окт. 2009, в 17:10, Sergey Petrunya написал(а):
Hi,
Could anybody please review the below: [skip] 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 ";
I think that the variable list should have space around every variable name (see below)
}
# ----------------------------------------------------
[skip]
@@ -4714,6 +4731,12 @@
if ( ! defined $ENV{$string} ) { + if ($unsupported_env_variables =~ /$string/)
It also finds substrings in the variables it would be better to have (with spaces, see upper comment): 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"); }
[skip] All other looks OK.