1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
--source include/windows.inc
select database();
use mysql;
# 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;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R > /dev/null;
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
use test;
|