用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

139 lines
3.7 KiB

--source include/big_test.inc
let BASEDIR= `select @@basedir`;
let DDIR=$MYSQL_TMP_DIR/installdb_test;
let MYSQLD_LOG=$MYSQL_TMP_DIR/server.log;
let extra_args=--no-defaults --innodb_dedicated_server=OFF --console --loose-skip-auto_generate_certs --loose-skip-sha256_password_auto_generate_rsa_keys --skip-ssl --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR;
let PASSWD_FILE=$MYSQL_TMP_DIR/password_file.txt;
--echo # shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # Server is down
--echo #
--echo # Bug #21680457: REDUCE THE NEW PASSWORD PRINTED BY
--echo # --INITIALIZE TO A NOTE, NOT A WARNING.
--echo #
--echo # Run the server with --initialize
--exec $MYSQLD $extra_args --initialize --datadir=$DDIR > $MYSQLD_LOG 2>&1
--echo extract the root password
--perl
use strict;
my $log= $ENV{'MYSQLD_LOG'} or die;
my $passwd_file= $ENV{'PASSWD_FILE'} or die;
my $FILE;
open(FILE, "$log") or die;
while (my $row = <FILE>)
{
if ($row =~ m/.*\[Note\] \[[^]]*\] \[[^]]*\] A temporary password is generated for root.localhost: ([^ \n][^ \n]*)/)
{
my $passwd=$1;
print "password found\n";
my $OUT_FILE;
open(OUT_FILE, "> $passwd_file");
print OUT_FILE "delimiter lessprobability;\n";
print OUT_FILE "let new_pwd=$passwd";
print OUT_FILE "lessprobability\n";
print OUT_FILE "--delimiter ;\n";
close(OUT_FILE);
}
}
close(FILE);
EOF
source $passwd_file;
--echo # Restart the server against DDIR
--exec echo "restart:--datadir=$DDIR " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # connect as root
connect(root_con,localhost,root,$new_pwd,mysql);
--echo # reset the password
SET PASSWORD='';
CREATE DATABASE test;
--echo # shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # Server is down
--echo # close the test connection
connection default;
disconnect root_con;
--echo # remove the password file
remove_file $PASSWD_FILE;
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete datadir
--force-rmdir $DDIR
--echo #
--echo # Bug #27675647: INVALID INITIALIZATION COMMAND ALLOWED TO DO TOO MUCH WORK
--echo #
--echo # Run server with --initialize insecure
--error 1
--exec $MYSQLD $extra_args --datadir=$DDIR --initialize insecure > $MYSQLD_LOG 2>&1
--echo # check for unusable directory log message
--let $grep_file=$MYSQLD_LOG
--let $grep_pattern=The newly created data directory .* by --initialize is unusable. You can remove it.
--let $grep_output=boolean
--source include/grep_pattern.inc
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete datadir
--force-rmdir $DDIR
--echo # End of the test for bug #27675647
--echo #
--echo # Bug #29594082: INCORRECT AND DANGEROUS ERROR MESSAGE FROM MY-013236
--echo #
--echo # Run server with --initialize insecure on an existing empty directory
mkdir $DDIR;
--error 1
--exec $MYSQLD $extra_args --datadir=$DDIR --initialize insecure > $MYSQLD_LOG 2>&1
--echo # check for unusable existing directory log message
--let $grep_file=$MYSQLD_LOG
--let $grep_pattern=The designated data directory .* is unusable. You can remove all files that the server added to it.
--let $grep_output=boolean
--source include/grep_pattern.inc
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete datadir
--force-rmdir $DDIR
--echo # End of the test for bug #29594082
--echo #
--echo # Cleanup
--echo #
--echo # Restarting the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc