aboutsummaryrefslogtreecommitdiffstats
path: root/camel/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'camel/tests/lib')
-rw-r--r--camel/tests/lib/Makefile.am10
-rw-r--r--camel/tests/lib/addresses.c3
-rw-r--r--camel/tests/lib/camel-test.c41
-rw-r--r--camel/tests/lib/folders.c2
-rw-r--r--camel/tests/lib/session.c6
5 files changed, 46 insertions, 16 deletions
diff --git a/camel/tests/lib/Makefile.am b/camel/tests/lib/Makefile.am
index f3a92899b2..93ec07abd5 100644
--- a/camel/tests/lib/Makefile.am
+++ b/camel/tests/lib/Makefile.am
@@ -1,5 +1,11 @@
-INCLUDES = -I$(includedir) -I$(top_srcdir) -I$(top_srcdir)/camel
+INCLUDES = \
+ -I$(includedir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir)/camel \
+ $(CAMEL_CFLAGS)
check_LIBRARIES = libcameltest.a
@@ -12,3 +18,5 @@ libcameltest_a_SOURCES = \
streams.c streams.h \
address-data.h
+libcameltest_a_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la
diff --git a/camel/tests/lib/addresses.c b/camel/tests/lib/addresses.c
index a97ac5e4f9..57275511c4 100644
--- a/camel/tests/lib/addresses.c
+++ b/camel/tests/lib/addresses.c
@@ -1,3 +1,6 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <string.h>
#include "addresses.h"
#include "camel-test.h"
diff --git a/camel/tests/lib/camel-test.c b/camel/tests/lib/camel-test.c
index a61f949f0a..76385ec696 100644
--- a/camel/tests/lib/camel-test.c
+++ b/camel/tests/lib/camel-test.c
@@ -3,13 +3,18 @@
#include <stdio.h>
#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <signal.h>
+#include <errno.h>
#ifdef ENABLE_THREADS
#include <pthread.h>
-#include <unistd.h>
#endif
+#include <camel/camel.h>
+
#ifdef ENABLE_THREADS
/* well i dunno, doesn't seem to be in the headers but hte manpage mentions it */
/* a nonportable checking mutex for glibc, not really needed, just validates
@@ -106,20 +111,32 @@ current_state(void)
void camel_test_init(int argc, char **argv)
{
- void camel_init(void);
+ struct stat st;
+ char *path;
int i;
-
+
setup = 1;
-
-#ifndef ENABLE_THREADS
- camel_init();
-#endif
-
- info_table = g_hash_table_new(0, 0);
-
+
/* yeah, we do need ot thread init, even though camel isn't compiled with enable threads */
- g_thread_init(NULL);
-
+ g_thread_init (NULL);
+
+ path = g_strdup_printf ("/tmp/camel-test");
+ if (mkdir (path, 0700) == -1 && errno != EEXIST)
+ abort ();
+
+ if (stat (path, &st) == -1)
+ abort ();
+
+ if (!S_ISDIR (st.st_mode) || access (path, R_OK | W_OK | X_OK) == -1)
+ abort ();
+
+ camel_init (path, FALSE);
+ g_free (path);
+
+ camel_type_init ();
+
+ info_table = g_hash_table_new(0, 0);
+
signal(SIGSEGV, die);
signal(SIGABRT, die);
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index 86d9a1f3ff..e7de6b2397 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -358,7 +358,7 @@ test_folder_message_ops(CamelSession *session, const char *name, int local, int
pull();
push("appending simple message %d", j);
- camel_folder_append_message(folder, msg, NULL, ex);
+ camel_folder_append_message(folder, msg, NULL, NULL, ex);
check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
/* sigh, this shouldn't be required, but the imap code is too dumb to do it itself */
diff --git a/camel/tests/lib/session.c b/camel/tests/lib/session.c
index 2ebf6e2d7f..a1f8df3ea0 100644
--- a/camel/tests/lib/session.c
+++ b/camel/tests/lib/session.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "session.h"
static guint
@@ -55,5 +59,3 @@ camel_test_session_new (const char *path)
return session;
}
-
-