mu: move mu/mu/tests, lib/tests one level up

Makes it easier to generator code-coverage reports
This commit is contained in:
Dirk-Jan C. Binnema
2020-01-01 15:41:49 +02:00
parent 0f98fbec2d
commit 80c5e25b08
125 changed files with 325 additions and 768 deletions

View File

@ -1,4 +1,4 @@
## Copyright (C) 2010-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
## Copyright (C) 2010-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
##
## 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
@ -16,59 +16,103 @@
include $(top_srcdir)/gtest.mk
# enforce compiling guile (optionally) first,then this dir first
# before decending into tests/
SUBDIRS= . tests
AM_CPPFLAGS=-I${top_srcdir}/lib $(GLIB_CFLAGS)
AM_CPPFLAGS= \
-I${top_srcdir}/lib \
$(GLIB_CFLAGS) \
$(CODE_COVERAGE_CFLAGS)
# don't use -Werror, as it might break on other compilers
# use -Wno-unused-parameters, because some callbacks may not
# really need all the params they get
AM_CFLAGS= \
$(JSON_GLIB_CFLAGS) \
$(ASAN_CFLAGS) \
$(WARN_CFLAGS) \
-Wno-switch-enum \
AM_CFLAGS= \
$(JSON_GLIB_CFLAGS) \
$(ASAN_CFLAGS) \
$(WARN_CFLAGS) \
$(CODE_COVERAGE_CFLAGS) \
-Wno-switch-enum \
-DMU_SCRIPTS_DIR="\"$(pkgdatadir)/scripts/\""
AM_CXXFLAGS= \
$(ASAN_CXXCFLAGS) \
$(WARN_CXXFLAGS)
AM_CXXFLAGS= \
$(ASAN_CXXCFLAGS) \
$(WARN_CXXFLAGS) \
$(CODE_COVERAGE_CFLAGS)
AM_LDFLAGS= \
AM_LDFLAGS= \
$(ASAN_LDFLAGS)
bin_PROGRAMS= \
bin_PROGRAMS= \
mu
# note, mu.cc is only '.cc' and not '.c' because libmu must explicitly
# be linked as c++, not c.
mu_SOURCES= \
mu.cc \
mu-cmd-cfind.c \
mu-config.c \
mu-config.h \
mu-cmd-extract.c \
mu-cmd-find.c \
mu-cmd-index.c \
mu-cmd-server.c \
mu-cmd-script.c \
mu-cmd.c \
mu_SOURCES= \
mu.cc \
mu-cmd-cfind.c \
mu-config.c \
mu-config.h \
mu-cmd-extract.c \
mu-cmd-find.c \
mu-cmd-index.c \
mu-cmd-server.c \
mu-cmd-script.c \
mu-cmd.c \
mu-cmd.h
BUILT_SOURCES= \
BUILT_SOURCES= \
mu-help-strings.h
mu-help-strings.h: mu-help-strings.txt mu-help-strings.awk
$(AM_V_GEN) $(AWK) -f ${top_srcdir}/mu/mu-help-strings.awk < $< > $@
mu_LDADD= \
${top_builddir}/lib/libmu.la \
$(GLIB_LIBS)
mu_LDADD= \
${top_builddir}/lib/libmu.la \
$(GLIB_LIBS) \
$(CODE_COVERAGE_LIBS)
EXTRA_DIST= \
mu-help-strings.awk \
EXTRA_DIST= \
mu-help-strings.awk \
mu-help-strings.txt
CLEANFILES=$(BUILT_SOURCES)
noinst_PROGRAMS= $(TEST_PROGS)
test_cflags= \
${AM_CFLAGS} \
-DMU_TESTMAILDIR=\"${abs_top_srcdir}/lib/testdir\" \
-DMU_TESTMAILDIR2=\"${abs_top_srcdir}/lib/testdir2\" \
-DMU_TESTMAILDIR3=\"${abs_top_srcdir}/lib/testdir3\" \
-DMU_TESTMAILDIR4=\"${abs_top_srcdir}/lib/testdir4\" \
-DMU_PROGRAM=\"${abs_top_builddir}/mu/mu\" \
-DABS_CURDIR=\"${abs_builddir}\" \
-DABS_SRCDIR=\"${abs_srcdir}\"
TEST_PROGS += test-mu-query
test_mu_query_SOURCES= test-mu-query.c dummy.cc
test_mu_query_CFLAGS=$(test_cflags)
test_mu_query_LDADD=${top_builddir}/lib/libtestmucommon.la $(CODE_COVERAGE_LIBS)
TEST_PROGS += test-mu-cmd
test_mu_cmd_SOURCES= test-mu-cmd.c dummy.cc
test_mu_cmd_CFLAGS=$(test_cflags)
test_mu_cmd_LDADD=${top_builddir}/lib/libtestmucommon.la $(CODE_COVERAGE_LIBS)
TEST_PROGS += test-mu-cmd-cfind
test_mu_cmd_cfind_SOURCES= test-mu-cmd-cfind.c dummy.cc
test_mu_cmd_cfind_CFLAGS=$(test_cflags)
test_mu_cmd_cfind_LDADD=${top_builddir}/lib/libtestmucommon.la $(CODE_COVERAGE_LIBS)
TEST_PROGS += test-mu-threads
test_mu_threads_SOURCES= test-mu-threads.c dummy.cc
test_mu_threads_CFLAGS=$(test_cflags)
test_mu_threads_LDADD=${top_builddir}/lib/libtestmucommon.la $(CODE_COVERAGE_LIBS)
# we need to use dummy.cc to enforce c++ linking...
BUILT_SOURCES+= \
dummy.cc
dummy.cc:
touch dummy.cc
TESTS=$(TEST_PROGS)
include $(top_srcdir)/aminclude_static.am
CLEANFILES= \
$(BUILT_SOURCES)

View File

@ -1,6 +1,6 @@
/* -*- mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
**
** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2008-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** 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
@ -18,21 +18,18 @@
**
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif /*HAVE_CONFIG_H*/
#include <glib.h>
#include <glib/gstdio.h>
#include "../mu-query.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "test-mu-common.h"
#include "mu-store.hh"
#include "mu-query.h"
static gchar *CONTACTS_CACHE = NULL;

View File

@ -1,69 +0,0 @@
# Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
##
## 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
include $(top_srcdir)/gtest.mk
AM_CPPFLAGS=$(XAPIAN_CXXFLAGS) \
$(GMIME_CFLAGS) \
$(GLIB_CFLAGS) \
-I ${top_srcdir} \
-I ${top_srcdir}/lib \
-I ${top_srcdir}/lib/tests \
-DMU_TESTMAILDIR=\"${abs_top_srcdir}/lib/tests/testdir\" \
-DMU_TESTMAILDIR2=\"${abs_top_srcdir}/lib/tests/testdir2\" \
-DMU_TESTMAILDIR3=\"${abs_top_srcdir}/lib/tests/testdir3\" \
-DMU_TESTMAILDIR4=\"${abs_top_srcdir}/lib/tests/testdir4\" \
-DMU_PROGRAM=\"${abs_top_builddir}/mu/mu\" \
-DABS_CURDIR=\"${abs_builddir}\" \
-DABS_SRCDIR=\"${abs_srcdir}\"
# don't use -Werror, as it might break on other compilers
# use -Wno-unused-parameters, because some callbacks may not
# really need all the params they get
AM_CFLAGS= \
$(ASAN_CFLAGS) \
${WARN_CFLAGS}
AM_CXXFLAGS= \
$(ASAN_CFLAGS) \
${WARN_CXXFLAGS}
AM_LDFLAGS= \
$(ASAN_LDFLAGS)
noinst_PROGRAMS= $(TEST_PROGS)
TEST_PROGS += test-mu-query
test_mu_query_SOURCES= test-mu-query.c dummy.cc
test_mu_query_LDADD=${top_builddir}/lib/tests/libtestmucommon.la
TEST_PROGS += test-mu-cmd
test_mu_cmd_SOURCES= test-mu-cmd.c dummy.cc
test_mu_cmd_LDADD=${top_builddir}/lib/tests/libtestmucommon.la
TEST_PROGS += test-mu-cmd-cfind
test_mu_cmd_cfind_SOURCES= test-mu-cmd-cfind.c dummy.cc
test_mu_cmd_cfind_LDADD=${top_builddir}/lib/tests/libtestmucommon.la
TEST_PROGS += test-mu-threads
test_mu_threads_SOURCES= test-mu-threads.c dummy.cc
test_mu_threads_LDADD=${top_builddir}/lib/tests/libtestmucommon.la
# we need to use dummy.cc to enforce c++ linking...
BUILT_SOURCES= \
dummy.cc
dummy.cc:
touch dummy.cc