mirror of https://github.com/djcb/mu.git
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).pull/2180/head
parent
67b16acbb2
commit
48d3f9cfab
@ -1,46 +0,0 @@
|
||||
# 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
|
||||
## 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 \
|
||||
-DMU_TESTMAILDIR=\"${abs_top_srcdir}/lib/testdir\" \
|
||||
-DMU_TESTMAILDIR2=\"${abs_top_srcdir}/lib/testdir2\" \
|
||||
-DMU_TESTMAILDIR3=\"${abs_top_srcdir}/lib/testdir3\" \
|
||||
-DMU_PROGRAM=\"${abs_top_builddir}/mu/mu\" \
|
||||
-DMU_GUILE_MODULE_PATH=\"${abs_top_srcdir}/guile/\" \
|
||||
-DMU_GUILE_LIBRARY_PATH=\"${abs_top_builddir}/guile/.libs\" \
|
||||
-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_CXXFLAGS) ${WARN_CXXFLAGS}
|
||||
AM_LDFLAGS=$(ASAN_LDFLAGS)
|
||||
|
||||
noinst_PROGRAMS= $(TEST_PROGS)
|
||||
|
||||
TEST_PROGS += test-mu-guile
|
||||
test_mu_guile_SOURCES= test-mu-guile.cc
|
||||
test_mu_guile_LDADD=${top_builddir}/lib/libtestmucommon.la
|
||||
|
||||
EXTRA_DIST=test-mu-guile.scm test-mu-guile.cc
|
@ -0,0 +1,27 @@
|
||||
## 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.
|
||||
|
||||
|
||||
test('test_mu_guile',
|
||||
executable('test-mu-guile',
|
||||
'test-mu-guile.cc',
|
||||
install: false,
|
||||
cpp_args: [
|
||||
'-DABS_SRCDIR="' + meson.current_source_dir() + '"',
|
||||
'-DMU_GUILE_LIBRARY_PATH="' + guile_builddir + '"',
|
||||
'-DMU_GUILE_MODULE_PATH="' + guile_builddir + '"'
|
||||
],
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
@ -1,78 +0,0 @@
|
||||
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
|
||||
|
||||
/*
|
||||
** 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.
|
||||
**
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "mu-date.h"
|
||||
|
||||
static void
|
||||
test_mu_date_interpret_begin(void)
|
||||
{
|
||||
time_t now;
|
||||
now = time(NULL);
|
||||
|
||||
g_assert_cmpstr(mu_date_interpret_s("now", TRUE), ==, mu_date_str_s("%Y%m%d%H%M%S", now));
|
||||
|
||||
g_assert_cmpstr(mu_date_interpret_s("today", TRUE), ==, mu_date_str_s("%Y%m%d000000", now));
|
||||
}
|
||||
|
||||
static void
|
||||
test_mu_date_interpret_end(void)
|
||||
{
|
||||
time_t now;
|
||||
now = time(NULL);
|
||||
|
||||
g_assert_cmpstr(mu_date_interpret_s("now", FALSE), ==, mu_date_str_s("%Y%m%d%H%M%S", now));
|
||||
|
||||
g_assert_cmpstr(mu_date_interpret_s("today", FALSE),
|
||||
==,
|
||||
mu_date_str_s("%Y%m%d235959", now));
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
g_test_init(&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func("/mu-str/mu_date_parse_hdwmy", test_mu_date_parse_hdwmy);
|
||||
g_test_add_func("/mu-str/mu_date_complete_begin", test_mu_date_complete_begin);
|
||||
g_test_add_func("/mu-str/mu_date_complete_end", test_mu_date_complete_end);
|
||||
|
||||
g_test_add_func("/mu-str/mu_date_interpret_begin", test_mu_date_interpret_begin);
|
||||
g_test_add_func("/mu-str/mu_date_interpret_end", test_mu_date_interpret_end);
|
||||
|
||||
g_log_set_handler(NULL,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
|
||||
(GLogFunc)black_hole,
|
||||
NULL);
|
||||
|
||||
return g_test_run();
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
## 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_maildir',
|
||||
executable('test-maildir',
|
||||
'test-mu-maildir.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_msg_fields',
|
||||
executable('test-msg-fields',
|
||||
'test-mu-msg-fields.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_msg',
|
||||
executable('test-msg',
|
||||
'test-mu-msg.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_store',
|
||||
executable('test-store',
|
||||
'test-mu-store.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_query',
|
||||
executable('test-query',
|
||||
'test-query.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_flags',
|
||||
executable('test-flags',
|
||||
'test-mu-flags.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
|
||||
test('test_tokenizer',
|
||||
executable('test-tokenizer',
|
||||
'test-tokenizer.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_threads',
|
||||
executable('test-threads',
|
||||
'../mu-query-threads.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_contacts',
|
||||
executable('test-contacts',
|
||||
'../mu-contacts.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test_parser',
|
||||
executable('test-parser',
|
||||
'test-parser.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
@ -0,0 +1,50 @@
|
||||
## 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_command_parser',
|
||||
executable('test-command-parser',
|
||||
'test-command-parser.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_utils_dep]))
|
||||
test('test_mu_str',
|
||||
executable('test-mu-str',
|
||||
'test-mu-str.c',
|
||||
install: false,
|
||||
dependencies: [glib_dep, config_h_dep,lib_mu_utils_dep]))
|
||||
test('test_mu_util',
|
||||
executable('test-mu-util',
|
||||
'test-mu-util.c',
|
||||
install: false,
|
||||
dependencies: [glib_dep,config_h_dep, lib_mu_utils_dep]))
|
||||
test('test_option',
|
||||
executable('test-option',
|
||||
'test-option.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_utils_dep]))
|
||||
test('test_mu_utils',
|
||||
executable('test-mu-utils',
|
||||
'test-utils.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_utils_dep]))
|
||||
test('test_sexp',
|
||||
executable('test-sexp',
|
||||
'test-sexp.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_utils_dep] ))
|
@ -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)
|
Loading…
Reference in New Issue