Commit 09a7f309 authored by unknown's avatar unknown

WL#3234 Maria Control file manager

last round of fixes to the storage engines' and plugins' unit tests
structure. Will extract a total patch and push it in 5.1 as has been
approved.


Makefile.am:
  unittest must be before storage and plugin, because engine and plugin
  may have unit tests which link with libtap which is found in
  unitttest.
config/ac-macros/plugins.m4:
  When enabling an engine/plugin, add its directory to the list
  of directories where unit tests should be searched. That is,
  its directory will be recursively searched by our unit test framework
  which will execute any executable *-t file.
storage/maria/ma_control_file.c:
  those my_message pollute the output of unit tests.
storage/maria/plug.in:
  When Maria is enabled, add its unittest Makefile.
unittest/Makefile.am:
  plugins too
parent cdf831cf
...@@ -24,11 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ ...@@ -24,11 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
@sql_union_dirs@ storage plugin \ @sql_union_dirs@ unittest storage plugin \
@sql_server@ scripts @man_dirs@ tests \ @sql_server@ scripts @man_dirs@ tests \
netware @libmysqld_dirs@ \ netware @libmysqld_dirs@ \
mysql-test support-files @tools_dirs@ \ mysql-test support-files @tools_dirs@ \
unittest win win
DIST_SUBDIRS = $(SUBDIRS) BUILD DIST_SUBDIRS = $(SUBDIRS) BUILD
......
...@@ -281,6 +281,7 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ ...@@ -281,6 +281,7 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[
AC_SUBST([mysql_se_dirs]) AC_SUBST([mysql_se_dirs])
AC_SUBST([mysql_pg_dirs]) AC_SUBST([mysql_pg_dirs])
AC_SUBST([mysql_se_unittest_dirs]) AC_SUBST([mysql_se_unittest_dirs])
AC_SUBST([mysql_pg_unittest_dirs])
]) ])
]) ])
]) ])
...@@ -316,7 +317,6 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ ...@@ -316,7 +317,6 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
]) ])
AC_MSG_CHECKING([whether to use ]$3) AC_MSG_CHECKING([whether to use ]$3)
mysql_use_plugin_dir="" mysql_use_plugin_dir=""
mysql_use_plugin_unittest_dir=""
m4_ifdef([$10],[ m4_ifdef([$10],[
if test "X[$mysql_plugin_]$2" = Xyes -a \ if test "X[$mysql_plugin_]$2" = Xyes -a \
"X[$with_plugin_]$2" != Xno -o \ "X[$with_plugin_]$2" != Xno -o \
...@@ -409,26 +409,18 @@ dnl Although this is "pretty", it breaks libmysqld build ...@@ -409,26 +409,18 @@ dnl Although this is "pretty", it breaks libmysqld build
m4_syscmd(test -f "$6/configure") m4_syscmd(test -f "$6/configure")
ifelse(m4_sysval, 0, ifelse(m4_sysval, 0,
[AC_CONFIG_SUBDIRS($6)], [AC_CONFIG_SUBDIRS($6)],
[ [AC_CONFIG_FILES($6/Makefile)]
AC_CONFIG_FILES($6/Makefile)
m4_syscmd(test -d "$6/unittest")
ifelse(m4_sysval, 0,
[
mysql_use_plugin_unittest_dir="$6/unittest"
AC_CONFIG_FILES($6/unittest/Makefile)
], [])
]
) )
ifelse(m4_substr($6, 0, 8), [storage/], ifelse(m4_substr($6, 0, 8), [storage/],
[ [
[mysql_se_name="]m4_substr($6, 8)" [mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)"
mysql_se_dirs="$mysql_se_dirs $mysql_se_name" mysql_se_unittest_dirs="$mysql_se_unittest_dirs ../$6"
if test -n "$mysql_use_plugin_unittest_dir" ; then
mysql_se_unittest_dirs="$mysql_se_unitest_dirs ../$mysql_use_plugin_unittest_dir"
fi
], ],
m4_substr($6, 0, 7), [plugin/], m4_substr($6, 0, 7), [plugin/],
[mysql_pg_dirs="$mysql_pg_dirs ]m4_substr($6, 7)", [
[mysql_pg_dirs="$mysql_pg_dirs ]m4_substr($6, 7)"
mysql_pg_unittest_dirs="$mysql_pg_unittest_dirs ../$6"
],
[AC_FATAL([don't know how to handle plugin dir ]$6)]) [AC_FATAL([don't know how to handle plugin dir ]$6)])
fi fi
]) ])
......
...@@ -188,14 +188,17 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open() ...@@ -188,14 +188,17 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
disk/filesystem has a problem. disk/filesystem has a problem.
So let's be rigid. So let's be rigid.
*/ */
my_message(0, "too small file", MYF(0)); /* TODO: improve errors */ /*
TODO: store a message "too small file" somewhere, so that it goes to
MySQL's error log at startup.
*/
error= CONTROL_FILE_TOO_SMALL; error= CONTROL_FILE_TOO_SMALL;
goto err; goto err;
} }
if ((uint)stat_buff.st_size > CONTROL_FILE_SIZE) if ((uint)stat_buff.st_size > CONTROL_FILE_SIZE)
{ {
my_message(0, "too big file", MYF(0)); /* TODO: improve errors */ /* TODO: store "too big file" message */
error= CONTROL_FILE_TOO_BIG; error= CONTROL_FILE_TOO_BIG;
goto err; goto err;
} }
...@@ -206,7 +209,7 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open() ...@@ -206,7 +209,7 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
if (memcmp(buffer + CONTROL_FILE_MAGIC_STRING_OFFSET, if (memcmp(buffer + CONTROL_FILE_MAGIC_STRING_OFFSET,
CONTROL_FILE_MAGIC_STRING, CONTROL_FILE_MAGIC_STRING_SIZE)) CONTROL_FILE_MAGIC_STRING, CONTROL_FILE_MAGIC_STRING_SIZE))
{ {
my_message(0, "bad magic string", MYF(0)); /* TODO: store message "bad magic string" somewhere */
error= CONTROL_FILE_BAD_MAGIC_STRING; error= CONTROL_FILE_BAD_MAGIC_STRING;
goto err; goto err;
} }
...@@ -214,7 +217,7 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open() ...@@ -214,7 +217,7 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
CONTROL_FILE_SIZE - CONTROL_FILE_LSN_OFFSET) != CONTROL_FILE_SIZE - CONTROL_FILE_LSN_OFFSET) !=
buffer[CONTROL_FILE_CHECKSUM_OFFSET]) buffer[CONTROL_FILE_CHECKSUM_OFFSET])
{ {
my_message(0, "checksum mismatch", MYF(0)); /* TODO: store message "checksum mismatch" somewhere */
error= CONTROL_FILE_BAD_CHECKSUM; error= CONTROL_FILE_BAD_CHECKSUM;
goto err; goto err;
} }
......
MYSQL_STORAGE_ENGINE(maria, no, [Maria Storage Engine], MYSQL_STORAGE_ENGINE(maria, no, [Maria Storage Engine],
[Traditional transactional MySQL tables], [max,max-no-ndb]) [Traditional transactional MySQL tables], [max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(maria, [storage/maria]) MYSQL_PLUGIN_DIRECTORY(maria, [storage/maria])
MYSQL_PLUGIN_ACTIONS(maria, [AC_CONFIG_FILES(storage/maria/unittest/Makefile)])
MYSQL_PLUGIN_STATIC(maria, [libmaria.a]) MYSQL_PLUGIN_STATIC(maria, [libmaria.a])
# Maria will probably go first into max builds, not all builds, # Maria will probably go first into max builds, not all builds,
# so we don't declare it mandatory. # so we don't declare it mandatory.
...@@ -4,7 +4,7 @@ noinst_SCRIPTS = unit ...@@ -4,7 +4,7 @@ noinst_SCRIPTS = unit
EXTRA_DIST = unit.pl EXTRA_DIST = unit.pl
CLEANFILES = unit CLEANFILES = unit
unittests = mytap mysys @mysql_se_unittest_dirs@ unittests = mytap mysys @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@
test: unit test: unit
./unit run $(unittests) ./unit run $(unittests)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment