summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/mysqld--defaults-file.test
blob: 9ca427568ef599d5f76346ec0da4ba2326252c7a (plain)
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
# BUG#58455
# Starting mysqld with defaults file without extension cause
# segmentation fault

source include/not_embedded.inc;
source include/not_windows.inc;
source include/not_aix.inc;

# All these tests refer to configuration files that do not exist

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=/path/with/no/extension --print-defaults 2>&1;

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=/path/with.ext --print-defaults 2>&1;

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=relative/path/with.ext --print-defaults 2>&1;

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=relative/path/without/extension --print-defaults 2>&1;

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;

--echo #
--echo # MDEV-21374: When "--help --verbose" prints out configuration file paths,
--echo # the --defaults-file option is not considered
--echo #

--echo # Test on `defaults-file`
--replace_result $MYSQLTEST_REAL_VARDIR MYSQLTEST_VARDIR
exec $MYSQLD --defaults-file=$MYSQLTEST_VARDIR/my.cnf --help --verbose | grep -A 1 'Default options are read';

--echo # Test on `defaults-extra-file`
# <first-defaults> = `/etc/my.cnf /etc/mysql/my.cnf`
# Using sysconfdir configuration, we don't always have `/etc/mysql/my.cnf`, so replace them with a regex as well.
copy_file $MYSQLTEST_VARDIR/my.cnf $MYSQLTEST_VARDIR/my_test.cnf;
--replace_regex /.*my_test.cnf/<first-defaults> MYSQLTEST_VARDIR\/my_test.cnf/
exec $MYSQLD --defaults-extra-file=$MYSQLTEST_VARDIR/my_test.cnf --help --verbose | grep -A 1 'Default options are read';
remove_file $MYSQLTEST_VARDIR/my_test.cnf;