commit 22396a44e39b6049e85a778b0ec0f9f8254edfcf Author: Laurynas Biveinis Date: Fri Aug 4 06:46:18 2017 +0300 Fix bug 87313 / LP TODO (Test auth_sec.secure_file_priv_warnings handling server error log incorrectly) Testcase auth_sec.secure_file_priv_warnings does several things wrong with the server error log: - greps it without restarting with a custom log location first, enabling false positives as the log contains everything from the past testcases on the same MTR worker; - deletes it, destroying content from all the past testcases on the same MTR worker, and also destroying the CURRENT_TEST marker in the log which MTR uses; - restarts with the same error log location, requiring a cumbersome perl script to delete it in a loop. Fix by: - removing the -master.opt file, and restarting the server in the testcase with its options, and also setting a custom error log location; - in the next restart, switching to a different custom error log location, enabling easy removal of the 1st custom error log. diff --git a/mysql-test/suite/auth_sec/r/secure_file_priv_warnings.result b/mysql-test/suite/auth_sec/r/secure_file_priv_warnings.result index 3b80cbe8d6f..a959a602ebc 100644 --- a/mysql-test/suite/auth_sec/r/secure_file_priv_warnings.result +++ b/mysql-test/suite/auth_sec/r/secure_file_priv_warnings.result @@ -1,6 +1,7 @@ #----------------------------------------------------------------------- # Setup #----------------------------------------------------------------------- +# restart:--secure-file-priv= --local-infile=true --log-error=MYSQLTEST_VARDIR/log/sfpw_1.err # Search for : Insecure configuration for --secure-file-priv: Current # value does not restrict location of generated files. # Consider setting it to a valid, non-empty path. @@ -8,10 +9,11 @@ SHOW VARIABLES LIKE 'secure_file_priv'; Variable_name Value secure_file_priv #----------------------------------------------------------------------- -# Restart completed. +# restart:--secure-file-priv= --local-infile=true --log-error=MYSQLTEST_VARDIR/log/sfpw_2.err --plugin-dir=PLUGIN_DIR --secure-file-priv=PLUGIN_DIR # Search for : Insecure configuration for --secure-file-priv: Plugin # directory is accessible through --secure-file-priv. # Consider choosing a different directory. #----------------------------------------------------------------------- # Clean-up +# restart #----------------------------------------------------------------------- diff --git a/mysql-test/suite/auth_sec/t/secure_file_priv_warnings-master.opt b/mysql-test/suite/auth_sec/t/secure_file_priv_warnings-master.opt deleted file mode 100644 index 08e4cc331de..00000000000 --- a/mysql-test/suite/auth_sec/t/secure_file_priv_warnings-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---secure-file-priv="" ---local-infile=true diff --git a/mysql-test/suite/auth_sec/t/secure_file_priv_warnings.test b/mysql-test/suite/auth_sec/t/secure_file_priv_warnings.test index 607b369b043..e6a4f92e707 100644 --- a/mysql-test/suite/auth_sec/t/secure_file_priv_warnings.test +++ b/mysql-test/suite/auth_sec/t/secure_file_priv_warnings.test @@ -2,12 +2,16 @@ --echo #----------------------------------------------------------------------- --echo # Setup -let server_log= $MYSQLTEST_VARDIR/log/mysqld.1.err; -let SEARCH_FILE= $server_log; -let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +let server_log1= $MYSQLTEST_VARDIR/log/sfpw_1.err; +let SEARCH_FILE= $server_log1; let PLUGIN_DIR= $MYSQLTEST_VARDIR/tmp; +let common_restart_args=--secure-file-priv="" --local-infile=true; --echo #----------------------------------------------------------------------- +--let $restart_parameters=restart:$common_restart_args --log-error=$server_log1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--source include/restart_mysqld.inc + --echo # Search for : Insecure configuration for --secure-file-priv: Current --echo # value does not restrict location of generated files. --echo # Consider setting it to a valid, non-empty path. @@ -19,24 +23,14 @@ SHOW VARIABLES LIKE 'secure_file_priv'; --echo #----------------------------------------------------------------------- -let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; ---exec echo "wait" > $restart_file ---shutdown_server ---source include/wait_until_disconnected.inc - -perl; -my $filetodelete = "$ENV{'MYSQLTEST_VARDIR'}/log/mysqld.1.err"; -while (-e $filetodelete) { - unlink $filetodelete; - sleep 1; -} -EOF - ---exec echo "restart:--plugin-dir=$PLUGIN_DIR --secure-file-priv=$PLUGIN_DIR" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc ---disable_reconnect ---echo # Restart completed. +let server_log2= $MYSQLTEST_VARDIR/log/sfpw_2.err; +let SEARCH_FILE= $server_log2; + +--let $restart_parameters=restart:$common_restart_args --log-error=$server_log2 --plugin-dir=$PLUGIN_DIR --secure-file-priv=$PLUGIN_DIR +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $PLUGIN_DIR PLUGIN_DIR +--source include/restart_mysqld.inc + +--remove_file $server_log1 --echo # Search for : Insecure configuration for --secure-file-priv: Plugin --echo # directory is accessible through --secure-file-priv. @@ -47,8 +41,9 @@ let SEARCH_PATTERN= Insecure configuration for --secure-file-priv: Plugin direct --echo #----------------------------------------------------------------------- --echo # Clean-up ---disable_warnings ---source include/force_restart.inc ---enable_warnings +--let $restart_parameters= +--source include/restart_mysqld.inc + +--remove_file $server_log2 --echo #-----------------------------------------------------------------------