mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
79706fd386
- Add additional MTRs for more coverage on invalid options - Updating a few error messages to be more informative - Use the exit code from handle_options() when there is an error processing user options All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
93 lines
4.7 KiB
Text
93 lines
4.7 KiB
Text
#
|
|
# Test error checks on mysqld command line option parsing.
|
|
#
|
|
# Call mysqld with different invalid options, and check that it fails in each case.
|
|
#
|
|
# This means that a test failure results in mysqld starting up, which is only
|
|
# caught when the test case times out. This is not ideal, but I did not find an
|
|
# easy way to have the server shut down after a successful startup.
|
|
#
|
|
|
|
--source include/not_embedded.inc
|
|
|
|
# mysqld refuses to run as root normally.
|
|
-- source include/not_as_root.inc
|
|
|
|
# We have not run (and do not need) bootstrap of the server. We just
|
|
# give it a dummy data directory (for log files etc).
|
|
|
|
mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err;
|
|
|
|
|
|
--echo Test that unknown option is not silently ignored.
|
|
--error 2
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --nonexistentoption >$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
|
|
--echo Test bad binlog format.
|
|
--error 13
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --log-bin --binlog-format=badformat >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
|
|
--echo Test bad default storage engine.
|
|
--error 1
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --default-storage-engine=nonexistentengine >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
|
|
--echo Test non-numeric value passed to number option.
|
|
--error 9
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --min-examined-row-limit=notanumber >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
|
|
# Test for MBug#423035: error in parsing enum value for plugin
|
|
# variable in mysqld command-line option.
|
|
# See also Bug#32034.
|
|
--echo Test that bad value for plugin enum option is rejected correctly.
|
|
--error 7
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --plugin-dir=$MYSQLTEST_VARDIR/plugins --plugin-load=example=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
--let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log
|
|
|
|
--echo Test to see if multiple unknown options will be displayed in the error output
|
|
--error 7
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --nonexistentoption2 --alsononexistent --nonexistentvariable=1 >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
--let SEARCH_PATTERN=unknown option '--nonexistentoption2'
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=unknown option '--alsononexistent'
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=unknown variable 'nonexistentvariable=1'
|
|
--source include/search_pattern_in_file.inc
|
|
|
|
--echo Test to see if multiple ambiguous options and invalid arguments will be displayed in the error output
|
|
--error 9
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --getopt-prefix-matching --sql-mode=invalid_value --character --bootstrap=partstoob --binlog_cache_size=18446744073709551616 --bulk_insert_buffer_size=123y >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
--let SEARCH_PATTERN=Error while setting value 'invalid_value' to 'sql_mode'
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=ambiguous option '--character'
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=option '--bootstrap' cannot take an argument
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=Integer value out of range for uint64: '18446744073709551616'
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=Error while setting value '18446744073709551616' to 'binlog_cache_size'
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=Unknown suffix 'y' used for variable 'bulk_insert_buffer_size' \(value '123y'\). Legal suffix characters are: K, M, G, T, P, E
|
|
--source include/search_pattern_in_file.inc
|
|
--let SEARCH_PATTERN=Error while setting value '123y' to 'bulk_insert_buffer_size'
|
|
--source include/search_pattern_in_file.inc
|
|
|
|
#
|
|
# Test that an wrong option with --help --verbose gives an error
|
|
#
|
|
|
|
--echo Test that --help --verbose works
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
--echo Test that --not-known-option --help --verbose gives error
|
|
--error 2
|
|
--exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
|
|
|
|
rmdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err;
|
|
|
|
--echo Done.
|