diff --git a/Makefile.am b/Makefile.am index df6845ec3b1..22c2fce7dc1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \ @mysql_se_plugins@ \ netware @libmysqld_dirs@ \ @bench_dirs@ support-files @tools_dirs@ \ - plugin mytap unittest + plugin unittest DIST_SUBDIRS = . include @docs_dirs@ zlib \ @readline_topdir@ sql-common \ @@ -39,7 +39,7 @@ DIST_SUBDIRS = . include @docs_dirs@ zlib \ @man_dirs@ tests SSL\ BUILD netware os2 @libmysqld_dirs@\ @bench_dirs@ support-files server-tools tools \ - plugin mytap unittest + plugin unittest # Run these targets before any others, also make part of clean target, # to make sure we create new links after a clean. diff --git a/configure.in b/configure.in index bd56dd10fc7..f32a2cedb59 100644 --- a/configure.in +++ b/configure.in @@ -2599,7 +2599,8 @@ AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS) # Output results AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl - mytap/Makefile mytap/t/Makefile unittest/Makefile dnl + unittest/Makefile dnl + unittest/mytap/Makefile unittest/mytap/t/Makefile dnl unittest/mysys/Makefile unittest/examples/Makefile dnl strings/Makefile regex/Makefile storage/Makefile storage/heap/Makefile dnl storage/myisam/Makefile storage/myisammrg/Makefile dnl diff --git a/unittest/Makefile.am b/unittest/Makefile.am index 54142b1e08d..3e7fc37e4f6 100644 --- a/unittest/Makefile.am +++ b/unittest/Makefile.am @@ -1 +1,21 @@ -SUBDIRS = mysys examples +SUBDIRS = mytap . mysys examples + +.PHONY: mytap mysys examples test + +noinst_SCRIPTS = unit + +test: mytap mysys examples + ./unit run $^ + +mytap: + cd mytap && $(MAKE) + +mysys: + cd mysys && $(MAKE) + +examples: + cd examples && $(MAKE) + +unit: unit.pl + cp $< $@ + chmod +x $@ diff --git a/unittest/examples/Makefile.am b/unittest/examples/Makefile.am index 1d0416f88c8..2e48ab8d9b3 100644 --- a/unittest/examples/Makefile.am +++ b/unittest/examples/Makefile.am @@ -1,9 +1,9 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include -AM_CPPFLAGS += -I$(top_builddir)/mytap +AM_CPPFLAGS += -I$(top_builddir)/unittest/mytap -AM_LDFLAGS = -L$(top_builddir)/mytap +AM_LDFLAGS = -L$(top_builddir)/unittest/mytap -AM_CFLAGS = -Wall -ansi -pedantic +AM_CFLAGS = -W -Wall -ansi -pedantic LDADD = -lmytap diff --git a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am index 4d725facc52..248dda84f7e 100644 --- a/unittest/mysys/Makefile.am +++ b/unittest/mysys/Makefile.am @@ -1,14 +1,15 @@ -AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include -AM_CPPFLAGS += -I$(top_builddir)/mytap +AM_CPPFLAGS = @ZLIB_INCLUDES@ -I$(top_builddir)/include +AM_CPPFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/unittest/mytap -AM_CFLAGS = -Wall -ansi -pedantic +AM_LDFLAGS = -L$(top_builddir)/unittest/mytap -L$(top_builddir)/mysys +AM_LDFLAGS += -L$(top_builddir)/strings -L$(top_builddir)/dbug -AM_LDFLAGS = -L$(top_builddir)/mytap -L$(top_builddir)/mysys -AM_LDFLAGS += -L$(top_builddir)/strings +LDADD = -lmytap -lmysys -lmystrings -ldbug -LDADD = -lmytap -lmysys -lmystrings - -noinst_PROGRAMS = bitmap.t +noinst_PROGRAMS = bitmap.t base64.t bitmap_t_SOURCES = bitmap.t.c + +base64_t_SOURCES = base64.t.c + diff --git a/unittest/mysys/base64.t.c b/unittest/mysys/base64.t.c new file mode 100644 index 00000000000..ecec5a4b560 --- /dev/null +++ b/unittest/mysys/base64.t.c @@ -0,0 +1,89 @@ +/* Copyright (C) 2003 MySQL AB + + 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; either version 2 of the + License, or (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA */ + +#include +#include +#include +#include + +int +main(void) +{ + int i; + size_t j, k, l, dst_len, needed_length; + + for (i= 0; i < 500; i++) + { + /* Create source data */ + const size_t src_len= rand() % 1000 + 1; + + char * src= (char *) malloc(src_len); + char * s= src; + char * str; + char * dst; + + for (j= 0; j #include -#include "my_bitmap.h" - -#include +#include static void bitmap_print(MY_BITMAP *map) { diff --git a/mytap/Doxyfile b/unittest/mytap/Doxyfile similarity index 100% rename from mytap/Doxyfile rename to unittest/mytap/Doxyfile diff --git a/mytap/Makefile.am b/unittest/mytap/Makefile.am similarity index 83% rename from mytap/Makefile.am rename to unittest/mytap/Makefile.am index 3f04f956876..2e9fe87709d 100644 --- a/mytap/Makefile.am +++ b/unittest/mytap/Makefile.am @@ -1,6 +1,5 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) -AM_CPPFLAGS += -I$(top_builddir)/mytap noinst_LIBRARIES = libmytap.a noinst_HEADERS = tap.h diff --git a/mytap/t/Makefile.am b/unittest/mytap/t/Makefile.am similarity index 67% rename from mytap/t/Makefile.am rename to unittest/mytap/t/Makefile.am index feff87da37d..88f663c2a9e 100644 --- a/mytap/t/Makefile.am +++ b/unittest/mytap/t/Makefile.am @@ -1,5 +1,6 @@ -AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/mytap +AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include +AM_CPPFLAGS += -I$(srcdir)/.. AM_LDFLAGS = -L$(srcdir)/.. diff --git a/mytap/t/basic.t.c b/unittest/mytap/t/basic.t.c similarity index 100% rename from mytap/t/basic.t.c rename to unittest/mytap/t/basic.t.c diff --git a/mytap/tap.c b/unittest/mytap/tap.c similarity index 100% rename from mytap/tap.c rename to unittest/mytap/tap.c diff --git a/mytap/tap.h b/unittest/mytap/tap.h similarity index 100% rename from mytap/tap.h rename to unittest/mytap/tap.h