From 5fb3a28aba18266a1cfc3759e6fc271a86531cb8 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 19 Aug 2002 20:14:15 +0000 Subject: Updated to pass the needed arguments to camel_init() and to init gthreads 2002-08-19 Jeffrey Stedfast * tests/lib/camel-test.c (camel_test_init): Updated to pass the needed arguments to camel_init() and to init gthreads before camel (since camel expectes it to be initialised already). * tests/lib/session.c: #include needed for ENABLE_THREADS so that sizeof (CamelSessionClass) gives the correct size. * tests/*: Updated to work with camel API changes. svn path=/trunk/; revision=17805 --- camel/tests/lib/Makefile.am | 10 +++++++++- camel/tests/lib/addresses.c | 3 +++ camel/tests/lib/camel-test.c | 41 +++++++++++++++++++++++++++++------------ camel/tests/lib/folders.c | 2 +- camel/tests/lib/session.c | 6 ++++-- 5 files changed, 46 insertions(+), 16 deletions(-) (limited to 'camel/tests/lib') 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 #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 #include +#include +#include +#include #include +#include #ifdef ENABLE_THREADS #include -#include #endif +#include + #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 +#endif + #include "session.h" static guint @@ -55,5 +59,3 @@ camel_test_session_new (const char *path) return session; } - - -- cgit v1.2.3