Commit 2853f6bf authored by Sergei Golubchik's avatar Sergei Golubchik

unit test fixes for ctest

parent 66a8da06
......@@ -144,6 +144,7 @@ INCLUDE(readline)
INCLUDE(mysql_version)
INCLUDE(libutils)
INCLUDE(dtrace)
INCLUDE(ctest)
INCLUDE(plugin)
INCLUDE(install_macros)
INCLUDE(install_layout)
......@@ -269,6 +270,14 @@ IF(MYSQL_MAINTAINER_MODE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}")
ENDIF()
IF(WITH_UNIT_TESTS)
ENABLE_TESTING()
ADD_SUBDIRECTORY(unittest/mytap)
ADD_SUBDIRECTORY(unittest/strings)
ADD_SUBDIRECTORY(unittest/examples)
ADD_SUBDIRECTORY(unittest/mysys)
ENDIF()
IF(NOT WITHOUT_SERVER)
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
# Add storage engines and plugins.
......@@ -276,22 +285,16 @@ SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
ENDIF()
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(dbug)
IF(WITH_DEBUG)
ADD_SUBDIRECTORY(dbug)
SET(DBUG_LIBRARY dbug)
ENDIF(WITH_DEBUG)
ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(libmysql)
IF(WITH_UNIT_TESTS)
ENABLE_TESTING()
ENDIF()
IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest/mytap)
ADD_SUBDIRECTORY(unittest/mysys)
ENDIF()
ADD_SUBDIRECTORY(extra)
IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(tests)
......
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
MACRO(MY_ADD_TEST name)
ADD_TEST(${name} ${name}-t)
ENDMACRO()
MACRO (MY_ADD_TESTS)
MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;EXT" "" ${ARGN})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/unittest/mytap)
IF (NOT ARG_EXT)
SET(ARG_EXT "c")
ENDIF()
FOREACH(name ${ARG_DEFAULT_ARGS})
ADD_EXECUTABLE(${name}-t "${name}-t.${ARG_EXT}")
TARGET_LINK_LIBRARIES(${name}-t mytap ${ARG_LINK_LIBRARIES})
MY_ADD_TEST(${name})
ENDFOREACH()
ENDMACRO()
......@@ -45,9 +45,10 @@ IF(NOT WIN32)
COMMAND sed -e 's!\\\\!\\\\\\\\!g'
<${CMAKE_CURRENT_SOURCE_DIR}/${srcfile} >${file})
ENDFOREACH(file)
ADD_CUSTOM_COMMAND(OUTPUT tests-t DEPENDS tests-t.pl
COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/tests-t.pl tests-t)
ADD_CUSTOM_TARGET(unit ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tests-t)
ADD_CUSTOM_COMMAND(OUTPUT dbug-t DEPENDS tests-t.pl
COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/tests-t.pl dbug-t)
ADD_CUSTOM_TARGET(dbug-t ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dbug-t)
MY_ADD_TEST(dbug)
IF(GROFF)
ADD_CUSTOM_COMMAND(OUTPUT user.ps
......
......@@ -8,8 +8,9 @@
use Test::More;
$exe=$0;
$exe =~ s@[^/]+$@tests@;
die unless $exe =~ s/(tests)-t(\.exe)?$/$1$2 /;
die unless -x $exe;
# load tests
@tests=();
......@@ -28,7 +29,7 @@ plan skip_all => "because dbug is disabled" if system $exe;
plan tests => scalar(@tests);
for (@tests) {
$t=$exe . shift @$_;
$t=$exe . ' ' . shift @$_;
chomp($t);
open F, '-|', $t or die "open($t|): $!";
local $";
......
......@@ -87,3 +87,4 @@ ENDIF()
CMAKE_DEPENDENT_OPTION(USE_ARIA_FOR_TMP_TABLES "Use Aria for temporary tables" ON
"WITH_ARIA_STORAGE_ENGINE" OFF)
ADD_SUBDIRECTORY(unittest)
......@@ -15,81 +15,122 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/unittest/mytap)
LINK_LIBRARIES(aria myisam mytap mysys dbug strings wsock32 zlib)
LINK_LIBRARIES(aria myisam mytap mysys ${DBUG_LIBRARY} strings ${ZLIB_LIBRARY})
MY_ADD_TESTS(ma_control_file trnman)
ADD_EXECUTABLE(ma_control_file-t ma_control_file-t.c)
ADD_EXECUTABLE(trnman-t trnman-t.c)
ADD_EXECUTABLE(ma_test_loghandler-t
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler)
ADD_EXECUTABLE(ma_test_loghandler_multigroup-t
ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c sequence_storage.c)
ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c sequence_storage.c)
MY_ADD_TEST(ma_test_loghandler_multigroup)
ADD_EXECUTABLE(ma_test_loghandler_multithread-t
ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler_multithread)
ADD_EXECUTABLE(ma_test_loghandler_pagecache-t
ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler_pagecache)
ADD_EXECUTABLE(ma_test_loghandler_long-t
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
SET_TARGET_PROPERTIES(ma_test_loghandler_long-t PROPERTIES COMPILE_FLAGS "-DLONG_LOG_TEST")
MY_ADD_TEST(ma_test_loghandler_long)
ADD_EXECUTABLE(ma_test_loghandler_noflush-t
ma_test_loghandler_noflush-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler_noflush-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler_noflush)
ADD_EXECUTABLE(ma_test_loghandler_first_lsn-t
ma_test_loghandler_first_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler_first_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler_first_lsn)
ADD_EXECUTABLE(ma_test_loghandler_max_lsn-t
ma_test_loghandler_max_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler_max_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler_max_lsn)
ADD_EXECUTABLE(ma_test_loghandler_purge-t
ma_test_loghandler_purge-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler_purge-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler_purge)
ADD_EXECUTABLE(ma_test_loghandler_readonly-t
ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c sequence_storage.c)
ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c sequence_storage.c)
MY_ADD_TEST(ma_test_loghandler_readonly)
SET_TARGET_PROPERTIES(ma_test_loghandler_readonly-t PROPERTIES COMPILE_FLAGS "-DREADONLY_TEST")
ADD_EXECUTABLE(ma_test_loghandler_nologs-t
ma_test_loghandler_nologs-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ma_test_loghandler_nologs-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
MY_ADD_TEST(ma_test_loghandler_nologs)
SET(ma_pagecache_single_src ma_pagecache_single.c test_file.c test_file.h)
SET(ma_pagecache_single_src ma_pagecache_single.c test_file.c test_file.h)
SET(ma_pagecache_consist_src ma_pagecache_consist.c test_file.c test_file.h)
SET(ma_pagecache_common_cppflags "-DEXTRA_DEBUG -DPAGECACHE_DEBUG -DMAIN")
ADD_EXECUTABLE(ma_pagecache_single_1k-t ${ma_pagecache_single_src})
SET_TARGET_PROPERTIES(ma_pagecache_single_1k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024")
MY_ADD_TEST(ma_pagecache_single_1k)
ADD_EXECUTABLE(ma_pagecache_single_8k-t ${ma_pagecache_single_src})
SET_TARGET_PROPERTIES(ma_pagecache_single_8k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=8192")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=8192")
MY_ADD_TEST(ma_pagecache_single_8k)
ADD_EXECUTABLE(ma_pagecache_single_64k-t ${ma_pagecache_single_src})
SET_TARGET_PROPERTIES(ma_pagecache_single_64k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536")
MY_ADD_TEST(ma_pagecache_single_64k)
ADD_EXECUTABLE(ma_pagecache_consist_1k-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024")
MY_ADD_TEST(ma_pagecache_consist_1k)
ADD_EXECUTABLE(ma_pagecache_consist_64k-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536")
MY_ADD_TEST(ma_pagecache_consist_64k)
ADD_EXECUTABLE(ma_pagecache_consist_1kHC-t
${ma_pagecache_consist_src})
${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1kHC-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024 -DTEST_HIGH_CONCURENCY")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024 -DTEST_HIGH_CONCURENCY")
MY_ADD_TEST(ma_pagecache_consist_1kHC)
ADD_EXECUTABLE(ma_pagecache_consist_64kHC-t
${ma_pagecache_consist_src})
${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64kHC-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536 -DTEST_HIGH_CONCURENCY")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536 -DTEST_HIGH_CONCURENCY")
MY_ADD_TEST(ma_pagecache_consist_64kHC)
ADD_EXECUTABLE(ma_pagecache_consist_1kRD-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1kRD-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024 -DTEST_READERS")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024 -DTEST_READERS")
MY_ADD_TEST(ma_pagecache_consist_1kRD)
ADD_EXECUTABLE(ma_pagecache_consist_64kRD-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64kRD-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536 -DTEST_READERS")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536 -DTEST_READERS")
MY_ADD_TEST(ma_pagecache_consist_64kRD)
ADD_EXECUTABLE(ma_pagecache_consist_1kWR-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1kWR-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024 -DTEST_WRITERS")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=1024 -DTEST_WRITERS")
MY_ADD_TEST(ma_pagecache_consist_1kWR)
ADD_EXECUTABLE(ma_pagecache_consist_64kWR-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64kWR-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536 -DTEST_WRITERS")
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DTEST_PAGE_SIZE=65536 -DTEST_WRITERS")
MY_ADD_TEST(ma_pagecache_consist_64kWR)
ADD_EXECUTABLE(ma_pagecache_rwconsist_1k-t ma_pagecache_rwconsist.c)
SET_TARGET_PROPERTIES(ma_pagecache_rwconsist_1k-t PROPERTIES COMPILE_FLAGS "-DTEST_PAGE_SIZE=1024")
MY_ADD_TEST(ma_pagecache_rwconsist_1k)
ADD_EXECUTABLE(ma_pagecache_rwconsist2_1k-t ma_pagecache_rwconsist2.c)
SET_TARGET_PROPERTIES(ma_pagecache_rwconsist2_1k-t PROPERTIES COMPILE_FLAGS "-DTEST_PAGE_SIZE=1024")
MY_ADD_TEST(ma_pagecache_rwconsist2_1k)
......@@ -74,7 +74,6 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
)
MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT STATIC_ONLY)
IF(WITH_PERFSCHEMA_STORAGE_ENGINE AND WITH_UNIT_TESTS)
ENABLE_TESTING()
IF(WITH_PERFSCHEMA_STORAGE_ENGINE)
ADD_SUBDIRECTORY(unittest)
ENDIF()
......@@ -23,19 +23,5 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_DEFINITIONS(-DMYSQL_SERVER)
MACRO (PFS_ADD_TEST name)
ADD_EXECUTABLE(${name}-t ${name}-t.cc)
TARGET_LINK_LIBRARIES(${name}-t mytap perfschema mysys)
ADD_TEST(${name} ${name}-t)
ENDMACRO()
SET(tests
pfs_instr_class
pfs_instr_class-oom
pfs_instr
pfs_instr-oom
pfs
)
FOREACH(testname ${tests})
PFS_ADD_TEST(${testname})
ENDFOREACH()
MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom pfs
EXT "cc" LINK_LIBRARIES perfschema mysys)
......@@ -13,25 +13,4 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/unittest/mytap)
ADD_EXECUTABLE(simple-t simple-t.c)
TARGET_LINK_LIBRARIES(simple-t mytap)
ADD_EXECUTABLE(skip-t skip-t.c)
TARGET_LINK_LIBRARIES(skip-t mytap)
ADD_EXECUTABLE(todo-t todo-t.c)
TARGET_LINK_LIBRARIES(todo-t mytap)
ADD_EXECUTABLE(skip_all-t skip_all-t.c)
TARGET_LINK_LIBRARIES(skip_all-t mytap)
ADD_EXECUTABLE(no_plan-t no_plan-t.c)
TARGET_LINK_LIBRARIES(no_plan-t mytap)
ADD_EXECUTABLE(core-t core-t.c)
TARGET_LINK_LIBRARIES(core-t mytap)
MY_ADD_TESTS(simple skip todo skip_all no_plan)
......@@ -13,20 +13,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/unittest/mytap)
${CMAKE_SOURCE_DIR}/extra/yassl/include)
MACRO (MY_ADD_TEST name)
ADD_EXECUTABLE(${name}-t ${name}-t.c)
TARGET_LINK_LIBRARIES(${name}-t mytap mysys strings)
ADD_TEST(${name} ${name}-t)
ENDMACRO()
FOREACH(testname bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc)
MY_ADD_TEST(${testname})
ENDFOREACH()
MY_ADD_TESTS(bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc
LINK_LIBRARIES mysys)
......@@ -15,3 +15,5 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(mytap tap.c)
MY_ADD_TESTS(t/basic)
MY_ADD_TESTS(strings LINK_LIBRARIES strings)
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