summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqld_option_err.test
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2009-09-03 15:05:02 +0200
committerunknown <knielsen@knielsen-hq.org>2009-09-03 15:05:02 +0200
commit03db11cfdaabc27b57de342eb4974195745f90d6 (patch)
tree6345a3f93d0f780155ac26c54ea4c667aa28fc26 /mysql-test/t/mysqld_option_err.test
parentf58512d8b719b70250edf433b8aed72db382bb94 (diff)
downloadmariadb-git-03db11cfdaabc27b57de342eb4974195745f90d6.tar.gz
MBug#423035: error in parsing enum value for plugin variable in mysqld command-line option
Fix parsing of invalid plugin enum option value. Previous patch to fix plugin enum option parsing on big-endian introduced another bug due to incorrect comparison of unsigned value. This would cause an incorrect value to be parsed as value 0. See also MySQL Bug#41010 and Bug#32034. mysql-test/mysql-test-run.pl: Add a facility for test case to run the mysqld binary (to test that invalid startup options are rejected correctly). mysql-test/r/mysqld_option_err.result: Add a test case to check that invalid startup options for mysqld are rejected. This is needed to test MBug#423035. Also add a few other similar tests, as this was completely untested before this patch. mysql-test/t/mysqld_option_err.test: Add a test case to check that invalid startup options for mysqld are rejected. This is needed to test MBug#423035. Also add a few other similar tests, as this was completely untested before this patch. mysys/my_getopt.c: Fix parsing of invalid plugin enum option value.
Diffstat (limited to 'mysql-test/t/mysqld_option_err.test')
-rw-r--r--mysql-test/t/mysqld_option_err.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/t/mysqld_option_err.test b/mysql-test/t/mysqld_option_err.test
new file mode 100644
index 00000000000..2b35a2eb38e
--- /dev/null
+++ b/mysql-test/t/mysqld_option_err.test
@@ -0,0 +1,47 @@
+#
+# 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
+
+# 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 --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 1
+--exec $MYSQLD --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 --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 1
+--exec $MYSQLD --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 --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables $EXAMPLE_PLUGIN_OPT --plugin-load=EXAMPLE=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+
+
+--echo Done.