mariadb/mysql-test/main/mysql_install_db_win.test
2023-12-17 11:20:43 +01:00

92 lines
2.5 KiB
Text

--source include/windows.inc
# Create database in tmp directory using mysql_install_db.exe,
# and start server from this directory.
let $ddir= $MYSQLTEST_VARDIR/tmp/ddir;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R;
--source include/kill_mysqld.inc
let $restart_parameters=--datadir=$ddir --loose-innodb;
--source include/start_mysqld.inc
connect (root,localhost,root,foo,mysql);
# Smoke test - check that we're actually using datadir
# we've created (i.e restart_parameters worked)
--replace_result $ddir DATADIR
SELECT @@datadir;
# restart in the original datadir again
--source include/kill_mysqld.inc
rmdir $ddir;
# MDEV-23052
# 1. mysql_install_db works on existing, empty directory
mkdir $ddir;
disable_result_log;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R --verbose-bootstrap;
enable_result_log;
rmdir $ddir;
# 2. mysql_install_db rejects existing, non-empty directory, and does not
# remove it.
mkdir $ddir;
write_file $ddir/1;
EOF
error 1;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R > $MYSQLTEST_VARDIR/tmp/install.log 2>&1;
list_files $ddir;
let $log=$MYSQLTEST_VARDIR/tmp/install.log;
let SEARCH_FILE=$log;
let SEARCH_PATTERN=is not empty. Only new or empty existing directories are accepted for --datadir;
--source include/search_pattern_in_file.inc
remove_file $log;
rmdir $ddir;
# MDEV-28471 - mysql_install_db.exe fails with --innodb-page-size=64K
--disable_result_log
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R --innodb-page-size=64K --verbose;
--enable_result_log
rmdir $ddir;
# Tests with config file
let $restart_parameters=;
connection default;
# Test --template option
let _BASEDIR = $MYSQLTEST_VARDIR/tmp/basedir;
perl;
use autodie;
open(IN, '<', "std_data/mysql_install_db_win.ini");
open(OUT, '>', "$ENV{MYSQLTEST_VARDIR}/tmp/mysql_install_db_win.ini");
while (<IN>) {
s/BASEDIR/$ENV{_BASEDIR}/g;
print OUT $_;
}
close IN;
close OUT
EOF
mkdir $_BASEDIR;
mkdir $_BASEDIR/temp;
# Run mysql_install_db.exe with config parameter
--disable_result_log
exec $MYSQL_INSTALL_DB_EXE -o --port=3307 --config=$MYSQLTEST_VARDIR/tmp/mysql_install_db_win.ini;
--enable_result_log
# dump the modified config in data directory
perl;
use autodie;
open(IN, '<', "$ENV{_BASEDIR}/data/my.ini");
while (<IN>) {
s/$ENV{_BASEDIR}/BASEDIR/g;
# when testing on installation layout, client's plugin
# dir is added, but when testing in build dir.
print unless $_ =~ /plugin-dir/;
}
close IN;
EOF
rmdir $_BASEDIR;
--source include/start_mysqld.inc