Commit 6e10407c authored by unknown's avatar unknown
Browse files

WL#3504 "plugin actions for engines' and plugins' unit tests"

for push in 5.1 (I will inform Trudy).
Storage engines and plugins can now have unit tests to test their components; such
test must be an executable C/C++ program which name ends with '-t' and which is
obeys the mytap protocol, it must be stored in the storage engine's or plugin's
source directory (storage/<engine> or plugin/<plugin>) or any subdirectories of
this.
The top-level Makefile target "test-unit" will run all unit tests: it will scan
the engines' and plugins' directories, recursively, and execute all executable
files which name ends with '-t'."


Makefile.am:
  "unittest" directory must be built before "storage" and "plugin"
  because the unit tests in these directories may need libmytap.a
  which is in unittest/mytap.
config/ac-macros/plugins.m4:
  When enabling engine "X", we add "../storage/X" to the unit tests
  directories which unittest/unit.pl should traverse looking for
  tests to execute. Same for plugins.
unittest/Makefile.am:
  Those variables contain all enabled engines and plugins.
parent aa856526
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,11 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS =		. include @docs_dirs@ @zlib_dir@ \
			@readline_topdir@ sql-common \
			@thread_dirs@ pstack \
			@sql_union_dirs@ storage plugin \
			@sql_union_dirs@ unittest storage plugin \
			@sql_server@ scripts @man_dirs@ tests \
			netware @libmysqld_dirs@ \
			mysql-test support-files @tools_dirs@ \
			unittest win
			win

DIST_SUBDIRS =		$(SUBDIRS) BUILD

+10 −2
Original line number Diff line number Diff line
@@ -280,6 +280,8 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[
    _MYSQL_EMIT_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
    AC_SUBST([mysql_se_dirs])
    AC_SUBST([mysql_pg_dirs])
    AC_SUBST([mysql_se_unittest_dirs])
    AC_SUBST([mysql_pg_unittest_dirs])
   ])
 ])
])
@@ -410,9 +412,15 @@ dnl Although this is "pretty", it breaks libmysqld build
          [AC_CONFIG_FILES($6/Makefile)]
        )
        ifelse(m4_substr($6, 0, 8), [storage/],
          [mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)",
          [
            [mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)"
             mysql_se_unittest_dirs="$mysql_se_unittest_dirs ../$6"
          ],
          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)])
      fi
    ])
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ SUBDIRS = mytap . mysys examples
EXTRA_DIST = unit.pl
CLEANFILES = unit

unittests = mytap mysys
unittests = mytap mysys @mysql_se_unittest_dirs@  @mysql_pg_unittest_dirs@

test:
	perl unit.pl run $(unittests)