commit 62d3137341fe02a7ceb3f6e7552c95e509c44fe8 Author: Laurynas Biveinis Date: Wed Aug 2 11:38:28 2017 +0300 Fix bug 87279 / LP TODO (Error log pattern searches broken in main.mysql_upgrade_test) The testcase greps the default server error log for expected patterns. The default log contains all the error log from the MTR run on the same worker so far. This is bad because now the searches can find output of the preceding tests. This breaks --repeat option, retry on failure, and should any previous test caused same output in the server log, the corresponding part of the test stops working and just passes silently. Fix by restarting the server with the custom error log, grepping that instead, resetting to the default error log after the last grep, and deleting the custom log. diff --git a/mysql-test/r/mysql_upgrade_grant.result b/mysql-test/r/mysql_upgrade_grant.result index 863aa09178b..f7a1f898751 100644 --- a/mysql-test/r/mysql_upgrade_grant.result +++ b/mysql-test/r/mysql_upgrade_grant.result @@ -1,3 +1,4 @@ +# restart:--log-error=MYSQL_TMP_DIR/mysql_upgrade_grant.err CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila'; GRANT ALL ON *.* TO mysqltest1@'%'; Run mysql_upgrade with password protected account @@ -327,7 +328,7 @@ call mtr.add_suppression("User entry 'su_old_pass_pn'@'%' has an empty plugin va # check the presents of the warnings in the log file # end of check for the presense of the warning #Restart the server -# restart +# restart:--log-error=MYSQL_TMP_DIR/mysql_upgrade_grant.err #After the update all acl commands should be working fine. Trying out #some of them ALTER USER 'user_nat_pass_pn'@'%' PASSWORD EXPIRE; diff --git a/mysql-test/t/mysql_upgrade_grant.test b/mysql-test/t/mysql_upgrade_grant.test index faf2f2144c2..15d2fc095d2 100644 --- a/mysql-test/t/mysql_upgrade_grant.test +++ b/mysql-test/t/mysql_upgrade_grant.test @@ -2,6 +2,11 @@ -- source include/no_valgrind_without_big.inc -- source include/mysql_upgrade_preparation.inc +--let $test_error_log= $MYSQL_TMP_DIR/mysql_upgrade_grant.err +--let $restart_parameters=restart:--log-error=$test_error_log +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +--source include/restart_mysqld.inc + # # Bug #25452 mysql_upgrade access denied. # @@ -67,11 +72,10 @@ call mtr.add_suppression("User entry .B19011337"); FLUSH PRIVILEGES; --echo # let's check for the presense of the warning -let server_log= $MYSQLTEST_VARDIR/log/mysqld.1.err; -# $server_log has to be processed by include/search_pattern_in_file.inc which +# $test_error_log has to be processed by include/search_pattern_in_file.inc which # contains Perl code requiring that the environment variable SEARCH_FILE points # to this file. -let SEARCH_FILE= $server_log; +let SEARCH_FILE= $test_error_log; --let SEARCH_PATTERN= User entry 'B19011337_ohash'@'localhost' has a deprecated pre-4.1 password. The user will be ignored and no one can login with this user anymore. --source include/search_pattern_in_file.inc @@ -154,7 +158,7 @@ INSERT INTO mysql.user VALUES FLUSH PRIVILEGES; --echo # check the presents of the warnings in the log file -let SEARCH_FILE= $server_log; +let SEARCH_FILE= $test_error_log; --let SEARCH_PATTERN= User entry 'user_old_pass_pn'@'%' has a deprecated pre-4.1 password. The user will be ignored and no one can login with this user anymore. --source include/search_pattern_in_file.inc @@ -256,7 +260,7 @@ call mtr.add_suppression("User entry 'user_old_pass_pn'@'%' has an empty plugin call mtr.add_suppression("User entry 'su_old_pass_pn'@'%' has an empty plugin value. The user will be ignored and no one can login with this user anymore."); --echo # check the presents of the warnings in the log file -let SEARCH_FILE= $server_log; +let SEARCH_FILE= $test_error_log; --let SEARCH_PATTERN= User entry 'user_old_pass_pn'@'%' has an empty plugin value. --source include/search_pattern_in_file.inc @@ -271,6 +275,7 @@ disconnect con3; disconnect con4; --echo #Restart the server +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --source include/restart_mysqld.inc --echo #After the update all acl commands should be working fine. Trying out @@ -334,7 +339,7 @@ INSERT INTO mysql.user VALUES FLUSH PRIVILEGES; --echo # check the presents of the warnings in the log file -let SEARCH_FILE= $server_log; +let SEARCH_FILE= $test_error_log; --let SEARCH_PATTERN= User entry 'B20614545'@'localhost' has a deprecated pre-4.1 password. The user will be ignored and no one can login with this user anymore. --source include/search_pattern_in_file.inc @@ -348,7 +353,7 @@ let SEARCH_FILE= $server_log; call mtr.add_suppression("User entry 'B20614545'@'localhost' has an empty plugin value. The user will be ignored and no one can login with this user anymore."); --echo # check the presents of the warnings in the log file -let SEARCH_FILE= $server_log; +let SEARCH_FILE= $test_error_log; --let SEARCH_PATTERN= User entry 'B20614545'@'localhost' has an empty plugin value. --source include/search_pattern_in_file.inc @@ -356,8 +361,11 @@ let SEARCH_FILE= $server_log; --echo # end of check for the presense of the warning --echo #Restart the server +--let $restart_parameters= --source include/restart_mysqld.inc +--remove_file $test_error_log + --echo # expect empty plugin SELECT plugin FROM mysql.user WHERE user='B20614545';