summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2009-11-09 12:32:48 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2009-11-09 12:32:48 +0100
commit13cd7170ccadbc596146175c0674956f49aed830 (patch)
treeef650a7fd633d354f237aa267a871fce11fe48d3 /unittest
parent411a6bfeb94e89f4cd4b8daaee96fe1913218a85 (diff)
downloadmariadb-git-13cd7170ccadbc596146175c0674956f49aed830.tar.gz
WL#5161 : Cross-platform build with CMake
Diffstat (limited to 'unittest')
-rw-r--r--unittest/mysys/CMakeLists.txt36
-rw-r--r--unittest/mysys/Makefile.am2
-rw-r--r--unittest/mytap/CMakeLists.txt18
-rw-r--r--unittest/mytap/Makefile.am2
-rw-r--r--unittest/mytap/tap.c8
5 files changed, 63 insertions, 3 deletions
diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt
new file mode 100644
index 00000000000..94eb3159693
--- /dev/null
+++ b/unittest/mysys/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems,Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# 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
+ ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_SOURCE_DIR}/unittest/mytap)
+
+
+MACRO (MY_ADD_TEST name)
+ ADD_EXECUTABLE(${name}-t ${name}-t.c)
+ TARGET_LINK_LIBRARIES(${name}-t mytap mysys)
+ ADD_TEST(${name} ${name}-t)
+ENDMACRO()
+
+
+FOREACH(testname bitmap base64 my_vsnprintf)
+ MY_ADD_TEST(${testname})
+ENDFOREACH()
+IF(NOT WIN32)
+ # does not work on Windows in 5.x codebase
+ MY_ADD_TEST(my_atomic)
+ENDIF()
diff --git a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am
index 56c65d71396..2dfa6d7698a 100644
--- a/unittest/mysys/Makefile.am
+++ b/unittest/mysys/Makefile.am
@@ -22,6 +22,8 @@ LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
$(top_builddir)/strings/libmystrings.a
noinst_PROGRAMS = bitmap-t base64-t my_vsnprintf-t
+EXTRA_DIST = CMakeLists.txt
+
if NEED_THREAD
# my_atomic-t is used to check thread functions, so it is safe to
diff --git a/unittest/mytap/CMakeLists.txt b/unittest/mytap/CMakeLists.txt
new file mode 100644
index 00000000000..8a2f6c9639a
--- /dev/null
+++ b/unittest/mytap/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# 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)
+ADD_LIBRARY(mytap tap.c)
diff --git a/unittest/mytap/Makefile.am b/unittest/mytap/Makefile.am
index c02bcd3b49d..8feefb134bb 100644
--- a/unittest/mytap/Makefile.am
+++ b/unittest/mytap/Makefile.am
@@ -20,6 +20,8 @@ noinst_HEADERS = tap.h
libmytap_a_SOURCES = tap.c
+EXTRA_DIST = CMakeLists.txt
+
SUBDIRS = . t
# Don't update the files from bitkeeper
diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c
index 4e053e3e745..34a3b933eba 100644
--- a/unittest/mytap/tap.c
+++ b/unittest/mytap/tap.c
@@ -151,7 +151,9 @@ static signal_entry install_signal[]= {
{ SIGABRT, handle_core_signal },
{ SIGFPE, handle_core_signal },
{ SIGSEGV, handle_core_signal },
+#ifdef SIGBUS
{ SIGBUS, handle_core_signal }
+#endif
#ifdef SIGXCPU
, { SIGXCPU, handle_core_signal }
#endif
@@ -167,7 +169,7 @@ static signal_entry install_signal[]= {
};
void
-plan(int const count)
+plan(int count)
{
/*
Install signal handler
@@ -201,7 +203,7 @@ skip_all(char const *reason, ...)
}
void
-ok(int const pass, char const *fmt, ...)
+ok(int pass, char const *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@@ -218,7 +220,7 @@ ok(int const pass, char const *fmt, ...)
void
-skip(int how_many, char const *const fmt, ...)
+skip(int how_many, char const *fmt, ...)
{
char reason[80];
if (fmt && *fmt)