Hi, Could anybody please review the below: Thanks, SergeyP. ----- Forwarded message from Sergey Petrunya <psergey@askmonty.org> ----- Return-Path: maria-developers-bounces+psergey=askmonty.org@lists.launchpad.net X-Original-To: psergey@localhost Delivered-To: psergey@localhost From: Sergey Petrunya <psergey@askmonty.org> To: maria-developers@lists.launchpad.net Date: Sun, 4 Oct 2009 18:05:41 +0400 (MSD) Subject: [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; _______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp ----- End forwarded message ----- -- BR Sergey -- Sergey Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog