tests: move to subdir, move to meson

De-clutter the source directories a bit. Ensure tests build with meson, and
remove from autotools in a few places (no need to do things twice).
This commit is contained in:
Dirk-Jan C. Binnema
2021-11-07 11:41:55 +02:00
parent 67b16acbb2
commit 48d3f9cfab
87 changed files with 214 additions and 485 deletions

View File

@ -68,38 +68,5 @@ EXTRA_DIST= \
mu-help-strings.awk \
mu-help-strings.txt
#
# Tests
#
noinst_PROGRAMS= $(TEST_PROGS)
test_cxxflags= \
${AM_CXXFLAGS} \
-DMU_TESTMAILDIR=\"${abs_top_srcdir}/lib/testdir\" \
-DMU_TESTMAILDIR2=\"${abs_top_srcdir}/lib/testdir2\" \
-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-query
test_query_SOURCES= tests/test-mu-query.cc
test_query_CXXFLAGS=$(test_cxxflags)
test_query_LDADD=${top_builddir}/lib/libtestmucommon.la $(CODE_COVERAGE_LIBS)
TEST_PROGS += test-cmd
test_cmd_SOURCES= tests/test-mu-cmd.cc
test_cmd_CXXFLAGS=$(test_cxxflags)
test_cmd_LDADD=${top_builddir}/lib/libtestmucommon.la $(CODE_COVERAGE_LIBS)
TEST_PROGS += test-cmd-cfind
test_cmd_cfind_SOURCES= tests/test-mu-cmd-cfind.cc
test_cmd_cfind_CXXFLAGS=$(test_cxxflags)
test_cmd_cfind_LDADD=${top_builddir}/lib/libtestmucommon.la $(CODE_COVERAGE_LIBS)
TESTS=$(TEST_PROGS)
include $(top_srcdir)/aminclude_static.am
CLEANFILES= \
$(BUILT_SOURCES)

View File

@ -14,7 +14,6 @@
## along with this program; if not, write to the Free Software Foundation,
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
awk_script=join_paths(meson.current_source_dir(), 'mu-help-strings.awk')
mu_help_strings_h=custom_target('mu_help',
input: 'mu-help-strings.txt',
@ -40,42 +39,4 @@ mu = executable(
cpp_args: ['-DMU_SCRIPTS_DIR="'+ join_paths(datadir, 'mu', 'scripts') + '"'],
install: true)
#
# tests
#
mu_binary = mu.full_path()
testmaildir=join_paths(meson.current_source_dir(),'../lib')
test('test_cmd',
executable('test-cmd',
'tests/test-mu-cmd.cc',
install: false,
cpp_args: ['-DMU_PROGRAM="' + mu_binary + '"',
'-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"',
'-DMU_TESTMAILDIR4="'+ join_paths(testmaildir, 'testdir4') + '"'],
dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep]))
test('test_cmd_cfind',
executable('test-cmd-cfind',
'tests/test-mu-cmd-cfind.cc',
install: false,
cpp_args: ['-DMU_PROGRAM="' + mu_binary + '"',
'-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"',
],
dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep]))
test('test_cmd_query',
executable('test-cmd-query',
'tests/test-mu-query.cc',
install: false,
cpp_args: ['-DMU_PROGRAM="' + mu_binary + '"',
'-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"',
'-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"'
],
dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep]))
gmime_test = executable(
'gmime-test', [
'tests/gmime-test.c'
],
dependencies: [ glib_dep, gmime_dep ],
install: false)
subdir('tests')

41
mu/tests/meson.build Normal file
View File

@ -0,0 +1,41 @@
## Copyright (C) 2021 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# tests
#
test('test_cmd',
executable('test-cmd',
'test-mu-cmd.cc',
install: false,
dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep]))
test('test_cmd_cfind',
executable('test-cmd-cfind',
'test-mu-cmd-cfind.cc',
install: false,
dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep]))
test('test_cmd_query',
executable('test-cmd-query',
'test-mu-query.cc',
install: false,
dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep]))
gmime_test = executable(
'gmime-test', [
'gmime-test.c'
],
dependencies: [ glib_dep, gmime_dep ],
install: false)