* update some test files / cleanup Makefile.am to work with distcheck
(mainly fix the false assumptions on the build dirs)
This commit is contained in:
@ -20,29 +20,39 @@ INCLUDES=$(XAPIAN_CXXFLAGS) \
|
|||||||
$(GMIME_CFLAGS) \
|
$(GMIME_CFLAGS) \
|
||||||
$(GLIB_CFLAGS) \
|
$(GLIB_CFLAGS) \
|
||||||
-I ${top_srcdir} \
|
-I ${top_srcdir} \
|
||||||
-DMU_PROGRAM=\"${top_srcdir}/src/mu\" \
|
-DMU_TESTMAILDIR=\"${top_srcdir}/src/tests/testdir\" \
|
||||||
|
-DMU_PROGRAM=\"${top_builddir}/src//mu\" \
|
||||||
-DABS_SRCDIR=\"${abs_srcdir}\"
|
-DABS_SRCDIR=\"${abs_srcdir}\"
|
||||||
|
|
||||||
noinst_PROGRAMS= $(TEST_PROGS)
|
noinst_PROGRAMS= $(TEST_PROGS)
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES=libtestmucommon.la
|
||||||
|
|
||||||
TEST_PROGS += test-mu-util
|
TEST_PROGS += test-mu-util
|
||||||
test_mu_util_SOURCES= test-mu-util.c
|
test_mu_util_SOURCES= test-mu-util.c
|
||||||
test_mu_util_LDADD= ${top_srcdir}/src/libmu.la
|
test_mu_util_LDADD= libtestmucommon.la
|
||||||
|
|
||||||
TEST_PROGS += test-mu-msg-str
|
TEST_PROGS += test-mu-msg-str
|
||||||
test_mu_msg_str_SOURCES= test-mu-msg-str.c
|
test_mu_msg_str_SOURCES= test-mu-msg-str.c
|
||||||
test_mu_msg_str_LDADD= ${top_srcdir}/src/libmu.la
|
test_mu_msg_str_LDADD= libtestmucommon.la
|
||||||
|
|
||||||
TEST_PROGS += test-mu-maildir
|
TEST_PROGS += test-mu-maildir
|
||||||
test_mu_maildir_SOURCES= test-mu-maildir.c
|
test_mu_maildir_SOURCES= test-mu-maildir.c
|
||||||
test_mu_maildir_LDADD= ${top_srcdir}/src/libmu.la
|
test_mu_maildir_LDADD= libtestmucommon.la
|
||||||
|
|
||||||
TEST_PROGS += test-mu-query
|
TEST_PROGS += test-mu-query
|
||||||
test_mu_query_SOURCES= test-mu-query.c dummy.cc
|
test_mu_query_SOURCES= test-mu-query.c dummy.cc
|
||||||
test_mu_query_LDADD= ${top_srcdir}/src/libmu.la
|
test_mu_query_LDADD= libtestmucommon.la
|
||||||
|
|
||||||
|
libtestmucommon_la_SOURCES= \
|
||||||
|
test-mu-common.c \
|
||||||
|
test-mu-common.h
|
||||||
|
libtestmucommon_la_LIBADD= ../libmu.la
|
||||||
|
|
||||||
|
# note the question marks; make does not like files with ':', so we
|
||||||
|
# use the (also supported) version with '!' instead. We could escape
|
||||||
|
# the : with \: but automake does not recognize that....
|
||||||
|
|
||||||
# note the question marks; make does not like files with ':'
|
|
||||||
# 11 messages, the '.ignore' message should be ignored
|
# 11 messages, the '.ignore' message should be ignored
|
||||||
# when indexing
|
# when indexing
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
@ -51,9 +61,9 @@ EXTRA_DIST= \
|
|||||||
testdir/new/1220863087.12663_25.mindcrime \
|
testdir/new/1220863087.12663_25.mindcrime \
|
||||||
testdir/new/1220863087.12663_21.mindcrime \
|
testdir/new/1220863087.12663_21.mindcrime \
|
||||||
testdir/new/1220863087.12663_23.mindcrime \
|
testdir/new/1220863087.12663_23.mindcrime \
|
||||||
testdir/cur/1220863087.12663_5.mindcrime?2,S \
|
testdir/cur/1220863087.12663_5.mindcrime!2,S \
|
||||||
testdir/cur/1220863087.12663_7.mindcrime?2,RS \
|
testdir/cur/1220863087.12663_7.mindcrime!2,RS \
|
||||||
testdir/cur/1220863087.12663_15.mindcrime?2,PS \
|
testdir/cur/1220863087.12663_15.mindcrime!2,PS \
|
||||||
testdir/cur/1220863087.12663_19.mindcrime?2,S \
|
testdir/cur/1220863087.12663_19.mindcrime!2,S \
|
||||||
testdir/cur/1220863042.12663_1.mindcrime?2,S \
|
testdir/cur/1220863042.12663_1.mindcrime!2,S \
|
||||||
testdir/cur/1220863060.12663_3.mindcrime?2,S
|
testdir/cur/1220863060.12663_3.mindcrime!2,S
|
||||||
|
|||||||
@ -28,18 +28,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "test-mu-common.h"
|
||||||
#include "src/mu-maildir.h"
|
#include "src/mu-maildir.h"
|
||||||
|
|
||||||
static char*
|
|
||||||
random_tmpdir (void)
|
|
||||||
{
|
|
||||||
return g_strdup_printf ("%s%cmu-test-%x", g_get_tmp_dir(),
|
|
||||||
G_DIR_SEPARATOR,
|
|
||||||
(int)random()*getpid()*(int)time(NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_mu_maildir_mkmdir_01 (void)
|
test_mu_maildir_mkmdir_01 (void)
|
||||||
{
|
{
|
||||||
@ -47,7 +38,7 @@ test_mu_maildir_mkmdir_01 (void)
|
|||||||
gchar *tmpdir, *mdir, *tmp;
|
gchar *tmpdir, *mdir, *tmp;
|
||||||
const gchar *subs[] = {"tmp", "cur", "new"};
|
const gchar *subs[] = {"tmp", "cur", "new"};
|
||||||
|
|
||||||
tmpdir = random_tmpdir ();
|
tmpdir = test_mu_common_get_random_tmpdir ();
|
||||||
mdir = g_strdup_printf ("%s%c%s", tmpdir, G_DIR_SEPARATOR,
|
mdir = g_strdup_printf ("%s%c%s", tmpdir, G_DIR_SEPARATOR,
|
||||||
"cuux");
|
"cuux");
|
||||||
|
|
||||||
@ -81,7 +72,7 @@ test_mu_maildir_mkmdir_02 (void)
|
|||||||
gchar *tmpdir, *mdir, *tmp;
|
gchar *tmpdir, *mdir, *tmp;
|
||||||
const gchar *subs[] = {"tmp", "cur", "new"};
|
const gchar *subs[] = {"tmp", "cur", "new"};
|
||||||
|
|
||||||
tmpdir = random_tmpdir ();
|
tmpdir = test_mu_common_get_random_tmpdir ();
|
||||||
mdir = g_strdup_printf ("%s%c%s", tmpdir, G_DIR_SEPARATOR,
|
mdir = g_strdup_printf ("%s%c%s", tmpdir, G_DIR_SEPARATOR,
|
||||||
"cuux");
|
"cuux");
|
||||||
|
|
||||||
@ -136,11 +127,17 @@ copy_test_data (void)
|
|||||||
{
|
{
|
||||||
gchar *dir, *cmd;
|
gchar *dir, *cmd;
|
||||||
|
|
||||||
dir = random_tmpdir();
|
dir = test_mu_common_get_random_tmpdir();
|
||||||
cmd = g_strdup_printf ("mkdir %s", dir);
|
cmd = g_strdup_printf ("mkdir %s", dir);
|
||||||
g_assert (g_spawn_command_line_sync (cmd, NULL, NULL, NULL, NULL));
|
g_assert (g_spawn_command_line_sync (cmd, NULL, NULL, NULL, NULL));
|
||||||
g_free (cmd);
|
g_free (cmd);
|
||||||
cmd = g_strdup_printf ("cp -R testdir %s", dir);
|
|
||||||
|
cmd = g_strdup_printf ("cp -R %s %s", MU_TESTMAILDIR, dir);
|
||||||
|
g_assert (g_spawn_command_line_sync (cmd, NULL, NULL, NULL, NULL));
|
||||||
|
g_free (cmd);
|
||||||
|
|
||||||
|
/* unbreak make distcheck */
|
||||||
|
cmd = g_strdup_printf ("chmod -R 700 %s", dir);
|
||||||
g_assert (g_spawn_command_line_sync (cmd, NULL, NULL, NULL, NULL));
|
g_assert (g_spawn_command_line_sync (cmd, NULL, NULL, NULL, NULL));
|
||||||
g_free (cmd);
|
g_free (cmd);
|
||||||
|
|
||||||
@ -174,7 +171,6 @@ msg_cb (const char *fullpath, gboolean enter, WalkData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_mu_maildir_walk_01 (void)
|
test_mu_maildir_walk_01 (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
#include "test-mu-common.h"
|
||||||
#include "src/mu-msg-str.h"
|
#include "src/mu-msg-str.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -29,24 +29,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "test-mu-common.h"
|
||||||
#include "src/mu-query-xapian.h"
|
#include "src/mu-query-xapian.h"
|
||||||
|
|
||||||
static char*
|
|
||||||
random_tmpdir (void)
|
|
||||||
{
|
|
||||||
return g_strdup_printf ("%s%cmu-test-%x", g_get_tmp_dir(),
|
|
||||||
G_DIR_SEPARATOR,
|
|
||||||
(int)random()*getpid()*(int)time(NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* static gboolean */
|
|
||||||
/* ignore_error (const char* log_domain, GLogLevelFlags log_level, const gchar* msg, */
|
|
||||||
/* gpointer user_data) */
|
|
||||||
/* { */
|
|
||||||
/* return FALSE; /\* don't abort *\/ */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
static void shutup (void) {}
|
static void shutup (void) {}
|
||||||
|
|
||||||
@ -56,10 +41,12 @@ fill_database (void)
|
|||||||
{
|
{
|
||||||
gchar *cmdline, *tmpdir, *xpath;
|
gchar *cmdline, *tmpdir, *xpath;
|
||||||
|
|
||||||
tmpdir = random_tmpdir();
|
tmpdir = test_mu_common_get_random_tmpdir();
|
||||||
cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s%ctestdir"
|
cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s"
|
||||||
" --quiet",
|
" --quiet",
|
||||||
MU_PROGRAM, tmpdir, ABS_SRCDIR, G_DIR_SEPARATOR);
|
MU_PROGRAM, tmpdir, MU_TESTMAILDIR);
|
||||||
|
|
||||||
|
g_print ("[%s]\n", cmdline);
|
||||||
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, NULL));
|
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, NULL));
|
||||||
g_free (cmdline);
|
g_free (cmdline);
|
||||||
|
|
||||||
@ -107,6 +94,7 @@ test_mu_query_01 (void)
|
|||||||
if (!mu_msg_iter_xapian_is_null (iter))
|
if (!mu_msg_iter_xapian_is_null (iter))
|
||||||
do { ++count; } while (mu_msg_iter_xapian_next (iter));
|
do { ++count; } while (mu_msg_iter_xapian_next (iter));
|
||||||
|
|
||||||
|
g_print ("[%s][%d,%d]\n", queries[i].query,queries[i].count,count);
|
||||||
g_assert_cmpuint (queries[i].count, ==, count);
|
g_assert_cmpuint (queries[i].count, ==, count);
|
||||||
mu_msg_iter_xapian_destroy (iter);
|
mu_msg_iter_xapian_destroy (iter);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user