From 5133886fe11d7650bc89b46746731ca2eab2185d Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" Date: Wed, 20 Aug 2014 13:43:56 +0200 Subject: [PATCH] move tests into their own directory --- .gitignore | 7 -- Makefile.am | 1 + avahi/Makefile.am | 102 +---------------------- configure.ac | 1 + examples/.gitignore | 10 --- {avahi => tests}/.gitignore | 7 -- tests/Makefile.am | 123 ++++++++++++++++++++++++++++ {avahi => tests}/alternative-test.c | 6 +- {avahi => tests}/avahi-reflector.c | 0 {avahi => tests}/avahi-test.c | 0 {avahi => tests}/conformance-test.c | 0 {avahi => tests}/dns-spin-test.c | 2 +- {avahi => tests}/dns-test.c | 6 +- {avahi => tests}/domain-test.c | 4 +- {avahi => tests}/hashmap-test.c | 4 +- {avahi => tests}/prioq-test.c | 2 +- {avahi => tests}/querier-test.c | 0 {avahi => tests}/strlst-test.c | 4 +- {avahi => tests}/timeeventq-test.c | 4 +- {avahi => tests}/timeval-test.c | 4 +- {avahi => tests}/update-test.c | 0 {avahi => tests}/utf8-test.c | 2 +- {avahi => tests}/watch-test.c | 10 +-- 23 files changed, 150 insertions(+), 149 deletions(-) rename {avahi => tests}/.gitignore (84%) create mode 100644 tests/Makefile.am rename {avahi => tests}/alternative-test.c (96%) rename {avahi => tests}/avahi-reflector.c (100%) rename {avahi => tests}/avahi-test.c (100%) rename {avahi => tests}/conformance-test.c (100%) rename {avahi => tests}/dns-spin-test.c (99%) rename {avahi => tests}/dns-test.c (97%) rename {avahi => tests}/domain-test.c (98%) rename {avahi => tests}/hashmap-test.c (97%) rename {avahi => tests}/prioq-test.c (99%) rename {avahi => tests}/querier-test.c (100%) rename {avahi => tests}/strlst-test.c (98%) rename {avahi => tests}/timeeventq-test.c (97%) rename {avahi => tests}/timeval-test.c (95%) rename {avahi => tests}/update-test.c (100%) rename {avahi => tests}/utf8-test.c (97%) rename {avahi => tests}/watch-test.c (95%) diff --git a/.gitignore b/.gitignore index 887295c..2059c26 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -intltool-extract.in -intltool-merge.in -intltool-update.in *.tar.gz doxygen Makefile @@ -12,8 +9,6 @@ Makefile.in *.la .deps/ .libs/ -ABOUT-NLS -ChangeLog aclocal.m4 *.cache compile @@ -21,7 +16,6 @@ config.guess config.h config.h.in config.log -config.rpath config.status config.sub configure @@ -30,7 +24,6 @@ install-sh libtool ltmain.sh missing -py-compile stamp-h1 .*.swp test-driver diff --git a/Makefile.am b/Makefile.am index f6be64d..792e43a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,6 +41,7 @@ EXTRA_DIST = \ SUBDIRS = \ common \ avahi \ + tests \ examples DX_INPUT = \ diff --git a/avahi/Makefile.am b/avahi/Makefile.am index bcb101c..c850392 100644 --- a/avahi/Makefile.am +++ b/avahi/Makefile.am @@ -20,7 +20,7 @@ AM_CFLAGS=-I$(top_srcdir) # This cool debug trap works on i386/gcc only AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")' -avahiincludedir=$(includedir)/src +avahiincludedir = $(top_srcdir)/avahi avahiinclude_HEADERS = \ strlst.h \ @@ -46,32 +46,6 @@ avahiinclude_HEADERS = \ lib_LTLIBRARIES = libavahi.la -if ENABLE_TESTS -noinst_PROGRAMS = \ - strlst-test \ - domain-test \ - alternative-test \ - timeval-test \ - watch-test \ - watch-test-thread \ - utf8-test \ - prioq-test \ - avahi-test \ - conformance-test \ - avahi-reflector \ - dns-test \ - dns-spin-test \ - timeeventq-test \ - hashmap-test \ - querier-test \ - update-test - -TESTS = \ - dns-spin-test \ - dns-test \ - hashmap-test -endif - libavahi_la_SOURCES = \ malloc.c malloc.h \ address.c address.h \ @@ -136,77 +110,3 @@ endif libavahi_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -DAVAHI_LOCALEDIR=\"$(avahilocaledir)\" libavahi_la_LIBADD = $(AM_LDADD) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(INTLLIBS) libavahi_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_VERSION_INFO) - -strlst_test_SOURCES = strlst-test.c -strlst_test_CFLAGS = $(AM_CFLAGS) -strlst_test_LDADD = $(AM_LDADD) libavahi.la - -alternative_test_SOURCES = alternative-test.c -alternative_test_CFLAGS = $(AM_CFLAGS) -alternative_test_LDADD = $(AM_LDADD) libavahi.la - -domain_test_SOURCES = domain-test.c -domain_test_CFLAGS = $(AM_CFLAGS) -domain_test_LDADD = $(AM_LDADD) libavahi.la - -watch_test_SOURCES = watch-test.c -watch_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -watch_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) libavahi.la - -watch_test_thread_SOURCES = $(watch_test_SOURCES) -watch_test_thread_CFLAGS = $(watch_test_CFLAGS) -DUSE_THREAD -watch_test_thread_LDADD = $(watch_test_LDADD) libavahi.la - -timeval_test_SOURCES = timeval-test.c -timeval_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -timeval_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) libavahi.la - -utf8_test_SOURCES = utf8-test.c -utf8_test_CFLAGS = $(AM_CFLAGS) -utf8_test_LDADD = $(AM_LDADD) libavahi.la - -prioq_test_SOURCES = prioq-test.c -prioq_test_CFLAGS = $(AM_CFLAGS) -prioq_test_LDADD = $(AM_LDADD) libavahi.la - -avahi_test_SOURCES = avahi-test.c -avahi_test_CFLAGS = $(AM_CFLAGS) -avahi_test_LDADD = $(AM_LDADD) libavahi.la - -update_test_SOURCES = update-test.c -update_test_CFLAGS = $(AM_CFLAGS) -update_test_LDADD = $(AM_LDADD) libavahi.la - -querier_test_SOURCES = querier-test.c -querier_test_CFLAGS = $(AM_CFLAGS) -querier_test_LDADD = $(AM_LDADD) libavahi.la - -conformance_test_SOURCES = conformance-test.c -conformance_test_CFLAGS = $(AM_CFLAGS) -conformance_test_LDADD = $(AM_LDADD) libavahi.la - -avahi_reflector_SOURCES = avahi-reflector.c -avahi_reflector_CFLAGS = $(AM_CFLAGS) -avahi_reflector_LDADD = $(AM_LDADD) libavahi.la - -dns_test_SOURCES = dns-test.c -dns_test_CFLAGS = $(AM_CFLAGS) -dns_test_LDADD = $(AM_LDADD) libavahi.la - -dns_spin_test_SOURCES = dns-spin-test.c -dns_spin_test_CFLAGS = $(AM_CFLAGS) -dns_spin_test_LDADD = $(AM_LDADD) libavahi.la - -timeeventq_test_SOURCES = timeeventq-test.c -timeeventq_test_CFLAGS = $(AM_CFLAGS) -timeeventq_test_LDADD = $(AM_LDADD) libavahi.la - -hashmap_test_SOURCES = hashmap-test.c -hashmap_test_CFLAGS = $(AM_CFLAGS) -hashmap_test_LDADD = $(AM_LDADD) libavahi.la - -valgrind: avahi-test - libtool --mode=execute valgrind ./avahi-test - -gdb: avahi-test - libtool --mode=execute gdb ./avahi-test diff --git a/configure.ac b/configure.ac index 5dcefae..f931dd1 100644 --- a/configure.ac +++ b/configure.ac @@ -324,6 +324,7 @@ AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"]) AC_CONFIG_FILES([ Makefile avahi/Makefile +tests/Makefile examples/Makefile common/Makefile ]) diff --git a/examples/.gitignore b/examples/.gitignore index 1e1ae08..6696f05 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -1,12 +1,2 @@ -*.o -*.lo -*.la -Makefile -Makefile.in -.deps -.libs -client-browse-services -client-publish-service core-browse-services core-publish-service -glib-integration diff --git a/avahi/.gitignore b/tests/.gitignore similarity index 84% rename from avahi/.gitignore rename to tests/.gitignore index 49b7739..2aab96f 100644 --- a/avahi/.gitignore +++ b/tests/.gitignore @@ -1,10 +1,3 @@ -*.o -*.lo -*.la -Makefile -Makefile.in -.deps -.libs alternative-test domain-test strlst-test diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..5232323 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,123 @@ +# This file is part of avahi. +# +# avahi is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# avahi 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 Lesser General Public +# License along with avahi; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +AM_CFLAGS=-I$(top_srcdir) +AM_LDADD=$(top_srcdir)/avahi/libavahi.la + +# This cool debug trap works on i386/gcc only +AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")' + +if ENABLE_TESTS +noinst_PROGRAMS = \ + strlst-test \ + domain-test \ + alternative-test \ + timeval-test \ + watch-test \ + watch-test-thread \ + utf8-test \ + prioq-test \ + avahi-test \ + conformance-test \ + avahi-reflector \ + dns-test \ + dns-spin-test \ + timeeventq-test \ + hashmap-test \ + querier-test \ + update-test + +TESTS = \ + dns-spin-test \ + dns-test \ + hashmap-test +endif + + +strlst_test_SOURCES = strlst-test.c +strlst_test_CFLAGS = $(AM_CFLAGS) +strlst_test_LDADD = $(AM_LDADD) + +alternative_test_SOURCES = alternative-test.c +alternative_test_CFLAGS = $(AM_CFLAGS) +alternative_test_LDADD = $(AM_LDADD) + +domain_test_SOURCES = domain-test.c +domain_test_CFLAGS = $(AM_CFLAGS) +domain_test_LDADD = $(AM_LDADD) + +watch_test_SOURCES = watch-test.c +watch_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) +watch_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) + +watch_test_thread_SOURCES = $(watch_test_SOURCES) +watch_test_thread_CFLAGS = $(watch_test_CFLAGS) -DUSE_THREAD +watch_test_thread_LDADD = $(watch_test_LDADD) + +timeval_test_SOURCES = timeval-test.c +timeval_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) +timeval_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) + +utf8_test_SOURCES = utf8-test.c +utf8_test_CFLAGS = $(AM_CFLAGS) +utf8_test_LDADD = $(AM_LDADD) + +prioq_test_SOURCES = prioq-test.c +prioq_test_CFLAGS = $(AM_CFLAGS) +prioq_test_LDADD = $(AM_LDADD) + +avahi_test_SOURCES = avahi-test.c +avahi_test_CFLAGS = $(AM_CFLAGS) +avahi_test_LDADD = $(AM_LDADD) + +update_test_SOURCES = update-test.c +update_test_CFLAGS = $(AM_CFLAGS) +update_test_LDADD = $(AM_LDADD) + +querier_test_SOURCES = querier-test.c +querier_test_CFLAGS = $(AM_CFLAGS) +querier_test_LDADD = $(AM_LDADD) + +conformance_test_SOURCES = conformance-test.c +conformance_test_CFLAGS = $(AM_CFLAGS) +conformance_test_LDADD = $(AM_LDADD) + +avahi_reflector_SOURCES = avahi-reflector.c +avahi_reflector_CFLAGS = $(AM_CFLAGS) +avahi_reflector_LDADD = $(AM_LDADD) + +dns_test_SOURCES = dns-test.c +dns_test_CFLAGS = $(AM_CFLAGS) +dns_test_LDADD = $(AM_LDADD) + +dns_spin_test_SOURCES = dns-spin-test.c +dns_spin_test_CFLAGS = $(AM_CFLAGS) +dns_spin_test_LDADD = $(AM_LDADD) + +timeeventq_test_SOURCES = timeeventq-test.c +timeeventq_test_CFLAGS = $(AM_CFLAGS) +timeeventq_test_LDADD = $(AM_LDADD) + +hashmap_test_SOURCES = hashmap-test.c +hashmap_test_CFLAGS = $(AM_CFLAGS) +hashmap_test_LDADD = $(AM_LDADD) + +valgrind: avahi-test + libtool --mode=execute valgrind ./avahi-test + +gdb: avahi-test + libtool --mode=execute gdb ./avahi-test diff --git a/avahi/alternative-test.c b/tests/alternative-test.c similarity index 96% rename from avahi/alternative-test.c rename to tests/alternative-test.c index 9255435..9636189 100644 --- a/avahi/alternative-test.c +++ b/tests/alternative-test.c @@ -23,9 +23,9 @@ #include -#include "alternative.h" -#include "malloc.h" -#include "domain.h" +#include +#include +#include int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { const char* const test_strings[] = { diff --git a/avahi/avahi-reflector.c b/tests/avahi-reflector.c similarity index 100% rename from avahi/avahi-reflector.c rename to tests/avahi-reflector.c diff --git a/avahi/avahi-test.c b/tests/avahi-test.c similarity index 100% rename from avahi/avahi-test.c rename to tests/avahi-test.c diff --git a/avahi/conformance-test.c b/tests/conformance-test.c similarity index 100% rename from avahi/conformance-test.c rename to tests/conformance-test.c diff --git a/avahi/dns-spin-test.c b/tests/dns-spin-test.c similarity index 99% rename from avahi/dns-spin-test.c rename to tests/dns-spin-test.c index f50e691..51af02d 100644 --- a/avahi/dns-spin-test.c +++ b/tests/dns-spin-test.c @@ -34,7 +34,7 @@ #include #include -#include "dns.h" +#include #define MAX_CPU_SECONDS 1 diff --git a/avahi/dns-test.c b/tests/dns-test.c similarity index 97% rename from avahi/dns-test.c rename to tests/dns-test.c index dd95487..6a63a0c 100644 --- a/avahi/dns-test.c +++ b/tests/dns-test.c @@ -31,9 +31,9 @@ #include #include -#include "dns.h" -#include "log.h" -#include "util.h" +#include +#include +#include int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { char t[AVAHI_DOMAIN_NAME_MAX], *m; diff --git a/avahi/domain-test.c b/tests/domain-test.c similarity index 98% rename from avahi/domain-test.c rename to tests/domain-test.c index cf763ec..445c051 100644 --- a/avahi/domain-test.c +++ b/tests/domain-test.c @@ -25,8 +25,8 @@ #include #include -#include "domain.h" -#include "malloc.h" +#include +#include int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { char *s; diff --git a/avahi/hashmap-test.c b/tests/hashmap-test.c similarity index 97% rename from avahi/hashmap-test.c rename to tests/hashmap-test.c index 54ac1b0..7c60aa2 100644 --- a/avahi/hashmap-test.c +++ b/tests/hashmap-test.c @@ -26,8 +26,8 @@ #include #include -#include "hashmap.h" -#include "util.h" +#include +#include int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { unsigned n; diff --git a/avahi/prioq-test.c b/tests/prioq-test.c similarity index 99% rename from avahi/prioq-test.c rename to tests/prioq-test.c index 3315494..9922565 100644 --- a/avahi/prioq-test.c +++ b/tests/prioq-test.c @@ -28,7 +28,7 @@ #include -#include "prioq.h" +#include #define POINTER_TO_INT(p) ((int) (long) (p)) #define INT_TO_POINTER(i) ((void*) (long) (i)) diff --git a/avahi/querier-test.c b/tests/querier-test.c similarity index 100% rename from avahi/querier-test.c rename to tests/querier-test.c diff --git a/avahi/strlst-test.c b/tests/strlst-test.c similarity index 98% rename from avahi/strlst-test.c rename to tests/strlst-test.c index 0945b37..dbfe269 100644 --- a/avahi/strlst-test.c +++ b/tests/strlst-test.c @@ -24,8 +24,8 @@ #include #include -#include "strlst.h" -#include "malloc.h" +#include +#include int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { char *t, *v; diff --git a/avahi/timeeventq-test.c b/tests/timeeventq-test.c similarity index 97% rename from avahi/timeeventq-test.c rename to tests/timeeventq-test.c index 91116ff..5b399b1 100644 --- a/avahi/timeeventq-test.c +++ b/tests/timeeventq-test.c @@ -27,8 +27,8 @@ #include #include -#include "timeeventq.h" -#include "log.h" +#include +#include #define POINTER_TO_INT(p) ((int) (long) (p)) #define INT_TO_POINTER(i) ((void*) (long) (i)) diff --git a/avahi/timeval-test.c b/tests/timeval-test.c similarity index 95% rename from avahi/timeval-test.c rename to tests/timeval-test.c index 387c180..461b97f 100644 --- a/avahi/timeval-test.c +++ b/tests/timeval-test.c @@ -23,8 +23,8 @@ #include -#include "gccmacro.h" -#include "timeval.h" +#include +#include int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { diff --git a/avahi/update-test.c b/tests/update-test.c similarity index 100% rename from avahi/update-test.c rename to tests/update-test.c diff --git a/avahi/utf8-test.c b/tests/utf8-test.c similarity index 97% rename from avahi/utf8-test.c rename to tests/utf8-test.c index ee928de..56c6fd0 100644 --- a/avahi/utf8-test.c +++ b/tests/utf8-test.c @@ -25,7 +25,7 @@ #include -#include "utf8.h" +#include int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { diff --git a/avahi/watch-test.c b/tests/watch-test.c similarity index 95% rename from avahi/watch-test.c rename to tests/watch-test.c index 6c178ba..51e6016 100644 --- a/avahi/watch-test.c +++ b/tests/watch-test.c @@ -27,17 +27,17 @@ #include #include -#include "watch.h" -#include "timeval.h" -#include "gccmacro.h" +#include +#include +#include static const AvahiPoll *api = NULL; #ifndef USE_THREAD -#include "simple-watch.h" +#include static AvahiSimplePoll *simple_poll = NULL; #else -#include "thread-watch.h" +#include static AvahiThreadedPoll *threaded_poll = NULL; #endif -- 2.39.2