aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/tests/folder/Makefile.am45
-rw-r--r--camel/tests/folder/test3.c4
-rw-r--r--camel/tests/folder/test8.c4
-rw-r--r--camel/tests/folder/test9.c2
-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
-rw-r--r--camel/tests/message/Makefile.am29
-rw-r--r--camel/tests/message/test1.c1
-rw-r--r--camel/tests/mime-filter/Makefile.am47
-rw-r--r--camel/tests/mime-filter/stripheader-1.in6
-rw-r--r--camel/tests/mime-filter/stripheader-1.out5
-rw-r--r--camel/tests/mime-filter/stripheader-2.in8
-rw-r--r--camel/tests/mime-filter/stripheader-2.out6
-rw-r--r--camel/tests/mime-filter/stripheader-3.in9
-rw-r--r--camel/tests/mime-filter/stripheader-3.out7
-rw-r--r--camel/tests/mime-filter/stripheader-4.in7
-rw-r--r--camel/tests/mime-filter/stripheader-4.out5
-rw-r--r--camel/tests/mime-filter/stripheader-5.in9
-rw-r--r--camel/tests/mime-filter/stripheader-5.out5
-rw-r--r--camel/tests/mime-filter/stripheader-6.in15
-rw-r--r--camel/tests/mime-filter/stripheader-6.out6
-rw-r--r--camel/tests/mime-filter/test-crlf.c2
-rw-r--r--camel/tests/mime-filter/test-stripheader.c131
-rw-r--r--camel/tests/misc/Makefile.am26
-rw-r--r--camel/tests/smime/Makefile.am26
-rw-r--r--camel/tests/smime/pgp-mime.c39
-rw-r--r--camel/tests/smime/pgp.c19
-rw-r--r--camel/tests/stream/Makefile.am26
32 files changed, 206 insertions, 357 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e4c14b822f..2c0cb7f432 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,15 @@
+2002-08-19 Jeffrey Stedfast <fejj@ximian.com>
+
+ * 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 <config.h> needed for
+ ENABLE_THREADS so that sizeof (CamelSessionClass) gives the
+ correct size.
+
+ * tests/*: Updated to work with camel API changes.
+
2002-08-16 Dan Winship <danw@ximian.com>
* camel-session.c (get_service): If the passed-in URL contains a
diff --git a/camel/tests/folder/Makefile.am b/camel/tests/folder/Makefile.am
index 143fd7f4ad..6329ca289a 100644
--- a/camel/tests/folder/Makefile.am
+++ b/camel/tests/folder/Makefile.am
@@ -1,29 +1,28 @@
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
+INCLUDES = \
+ -I$(includedir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir)/camel \
+ -I$(top_srcdir)/camel/tests/lib \
+ -DG_LOG_DOMAIN=\"evolution-tests\" \
+ $(CAMEL_CFLAGS)
LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EVOLUTION_MAIL_LIBS)
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(GNOME_LIBDIR) \
+ $(top_builddir)/camel/tests/lib/libcameltest.a \
+ $(GNOMEUI_LIBS) \
+ $(INTLLIBS) \
+ $(EVOLUTION_MAIL_LIBS)
check_PROGRAMS = \
- test1 test4 test5 \
- test2 test6 test7 \
- test3 \
- test8 \
- test9
-
-TESTS = test1 test4 test5 \
- test2 test6 test7 \
- test3 \
- test8 \
- test9
-
-
+ test1 test2 test3 \
+ test4 test5 test6 \
+ test7 test8 test9
+TESTS = test1 test2 test3 \
+ test4 test5 test6 \
+ test7 test8 test9
diff --git a/camel/tests/folder/test3.c b/camel/tests/folder/test3.c
index dc2946956f..14be8ed570 100644
--- a/camel/tests/folder/test3.c
+++ b/camel/tests/folder/test3.c
@@ -2,6 +2,8 @@
#include <gtk/gtk.h>
+#include <string.h>
+
#include "camel-test.h"
#include "messages.h"
#include "folders.h"
@@ -215,7 +217,7 @@ int main(int argc, char **argv)
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));
pull();
diff --git a/camel/tests/folder/test8.c b/camel/tests/folder/test8.c
index cf8a7ecc8a..c039af5eb0 100644
--- a/camel/tests/folder/test8.c
+++ b/camel/tests/folder/test8.c
@@ -1,5 +1,7 @@
/* threaded folder testing */
+#include <string.h>
+
#include "camel-test.h"
#include "folders.h"
#include "messages.h"
@@ -54,7 +56,7 @@ test_add_message(CamelFolder *folder, int j)
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));
pull();
diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c
index 974c2c7793..87efb2246c 100644
--- a/camel/tests/folder/test9.c
+++ b/camel/tests/folder/test9.c
@@ -1,5 +1,7 @@
/* folder/index testing */
+#include <string.h>
+
#include "camel-test.h"
#include "messages.h"
#include "folders.h"
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;
}
-
-
diff --git a/camel/tests/message/Makefile.am b/camel/tests/message/Makefile.am
index 5487a13f42..3b04021a5e 100644
--- a/camel/tests/message/Makefile.am
+++ b/camel/tests/message/Makefile.am
@@ -1,16 +1,22 @@
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
+INCLUDES = \
+ -I$(includedir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir)/camel \
+ -I$(top_srcdir)/camel/tests/lib \
+ -DG_LOG_DOMAIN=\"evolution-tests\" \
+ $(CAMEL_CFLAGS)
LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EVOLUTION_MAIL_LIBS)
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(GNOME_LIBDIR) \
+ $(top_builddir)/camel/tests/lib/libcameltest.a \
+ $(GNOMEUI_LIBS) \
+ $(INTLLIBS) \
+ $(EVOLUTION_MAIL_LIBS)
check_PROGRAMS = \
test1 \
@@ -18,6 +24,3 @@ check_PROGRAMS = \
test3
TESTS = test1 test2 test3
-
-
-
diff --git a/camel/tests/message/test1.c b/camel/tests/message/test1.c
index 3294000550..6eadfcacc2 100644
--- a/camel/tests/message/test1.c
+++ b/camel/tests/message/test1.c
@@ -24,6 +24,7 @@
/* for stat */
#include <sys/stat.h>
#include <unistd.h>
+#include <string.h>
#include <camel/camel-mime-message.h>
#include <camel/camel-stream-fs.h>
diff --git a/camel/tests/mime-filter/Makefile.am b/camel/tests/mime-filter/Makefile.am
index d3c2a7d29f..bceee243eb 100644
--- a/camel/tests/mime-filter/Makefile.am
+++ b/camel/tests/mime-filter/Makefile.am
@@ -1,39 +1,32 @@
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\" \
- -DSOURCEDIR=\"$(srcdir)\"
+INCLUDES = \
+ -I$(includedir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir)/camel \
+ -I$(top_srcdir)/camel/tests/lib \
+ -DG_LOG_DOMAIN=\"evolution-tests\" \
+ -DSOURCEDIR=\"$(srcdir)\" \
+ $(CAMEL_CFLAGS)
LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EVOLUTION_MAIL_LIBS)
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(GNOME_LIBDIR) \
+ $(top_builddir)/camel/tests/lib/libcameltest.a \
+ $(GNOMEUI_LIBS) \
+ $(INTLLIBS) \
+ $(EVOLUTION_MAIL_LIBS)
EXTRA_DIST = \
crlf-1.in \
- crlf-1.out \
- stripheader-1.in \
- stripheader-1.out \
- stripheader-2.in \
- stripheader-2.out \
- stripheader-3.in \
- stripheader-3.out \
- stripheader-4.in \
- stripheader-4.out \
- stripheader-5.in \
- stripheader-5.out \
- stripheader-6.in \
- stripheader-6.out
+ crlf-1.out
check_PROGRAMS = \
- test-crlf \
- test-stripheader
+ test-crlf
-TESTS = test-crlf test-stripheader
+TESTS = test-crlf
diff --git a/camel/tests/mime-filter/stripheader-1.in b/camel/tests/mime-filter/stripheader-1.in
deleted file mode 100644
index 1db4bf86e3..0000000000
--- a/camel/tests/mime-filter/stripheader-1.in
+++ /dev/null
@@ -1,6 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-1.out b/camel/tests/mime-filter/stripheader-1.out
deleted file mode 100644
index 3101c1e6bd..0000000000
--- a/camel/tests/mime-filter/stripheader-1.out
+++ /dev/null
@@ -1,5 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-2.in b/camel/tests/mime-filter/stripheader-2.in
deleted file mode 100644
index 0a16133bc0..0000000000
--- a/camel/tests/mime-filter/stripheader-2.in
+++ /dev/null
@@ -1,8 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
-CC: this header should be preserved
-Stripped: this header should also be stripped
-BCC: but not this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-2.out b/camel/tests/mime-filter/stripheader-2.out
deleted file mode 100644
index 626dd9c170..0000000000
--- a/camel/tests/mime-filter/stripheader-2.out
+++ /dev/null
@@ -1,6 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: but not this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-3.in b/camel/tests/mime-filter/stripheader-3.in
deleted file mode 100644
index d7c348125b..0000000000
--- a/camel/tests/mime-filter/stripheader-3.in
+++ /dev/null
@@ -1,9 +0,0 @@
-Subject: this is a simple test with a different subject
-Stripped: of the header stripping filter
-Stripped: this header should also be stripped
-CC: this header should be preserved
-BCC: and so should this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy.
-Let's add lots of characters on this line just for fun because I love fun don't you who wouldn't love fun I sure do. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-3.out b/camel/tests/mime-filter/stripheader-3.out
deleted file mode 100644
index a6da94594e..0000000000
--- a/camel/tests/mime-filter/stripheader-3.out
+++ /dev/null
@@ -1,7 +0,0 @@
-Subject: this is a simple test with a different subject
-CC: this header should be preserved
-BCC: and so should this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy.
-Let's add lots of characters on this line just for fun because I love fun don't you who wouldn't love fun I sure do. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-4.in b/camel/tests/mime-filter/stripheader-4.in
deleted file mode 100644
index 5b0b12e080..0000000000
--- a/camel/tests/mime-filter/stripheader-4.in
+++ /dev/null
@@ -1,7 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
- ooh look this header spans two lines.
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-4.out b/camel/tests/mime-filter/stripheader-4.out
deleted file mode 100644
index 3101c1e6bd..0000000000
--- a/camel/tests/mime-filter/stripheader-4.out
+++ /dev/null
@@ -1,5 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-5.in b/camel/tests/mime-filter/stripheader-5.in
deleted file mode 100644
index 99258daec6..0000000000
--- a/camel/tests/mime-filter/stripheader-5.in
+++ /dev/null
@@ -1,9 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
- ooh look this header spans many
- lines look at all the freaking lines
- that this header spans. Wowwww.
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-5.out b/camel/tests/mime-filter/stripheader-5.out
deleted file mode 100644
index 3101c1e6bd..0000000000
--- a/camel/tests/mime-filter/stripheader-5.out
+++ /dev/null
@@ -1,5 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-6.in b/camel/tests/mime-filter/stripheader-6.in
deleted file mode 100644
index 8bf0e848d0..0000000000
--- a/camel/tests/mime-filter/stripheader-6.in
+++ /dev/null
@@ -1,15 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
- ooh look this header spans many
- lines look at all the freaking lines
- that this header spans. Wowwww.
-Stripped: and then another one to strip that extends fairly far across the page
-Other: let's not use CC here.
-Stripped: oops, I stripped it again
-Stripped: then single line....
- followed by multi-line. Huzzah.
-NotBCC: definitely not BCC
- however this one is definitely continued
-Stripped: god-damn look at that stripping.
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-6.out b/camel/tests/mime-filter/stripheader-6.out
deleted file mode 100644
index d8d4202ed0..0000000000
--- a/camel/tests/mime-filter/stripheader-6.out
+++ /dev/null
@@ -1,6 +0,0 @@
-Subject: this is a simple test
-Other: let's not use CC here.
-NotBCC: definitely not BCC
- however this one is definitely continued
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/test-crlf.c b/camel/tests/mime-filter/test-crlf.c
index 2e8a4333fa..0ffa5b2b26 100644
--- a/camel/tests/mime-filter/test-crlf.c
+++ b/camel/tests/mime-filter/test-crlf.c
@@ -32,7 +32,7 @@ main (int argc, char **argv)
CamelStream *correct;
CamelStreamFilter *filter;
CamelMimeFilter *sh;
- gchar *work;
+ char *work;
int i;
ssize_t comp_progress, comp_correct_chunk, comp_filter_chunk;
int comp_i;
diff --git a/camel/tests/mime-filter/test-stripheader.c b/camel/tests/mime-filter/test-stripheader.c
deleted file mode 100644
index ff5446635b..0000000000
--- a/camel/tests/mime-filter/test-stripheader.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- test-stripheader.c
-
- Test the CamelMimeFilterStripHeader class
-*/
-
-#include <stdio.h>
-#include <string.h>
-
-#include "camel-test.h"
-
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-mime-filter-stripheader.h>
-
-#define d(x) x
-
-#define NUM_CASES 6
-#define CHUNK_SIZE 32
-
-int
-main(int argc, char **argv)
-{
- CamelStream *source;
- CamelStream *correct;
- CamelStreamFilter *filter;
- CamelMimeFilter *sh;
- gchar *work;
- int i;
- ssize_t comp_progress, comp_correct_chunk, comp_filter_chunk;
- int comp_i;
- char comp_correct[CHUNK_SIZE], comp_filter[CHUNK_SIZE];
-
- camel_test_init(argc, argv);
-
- for (i = 0; i < NUM_CASES; i++) {
- work = g_strdup_printf ("Header stripping filter, test case %d", i);
- camel_test_start (work);
- g_free (work);
-
- camel_test_push ("Initializing objects");
- work = g_strdup_printf ("%s/stripheader-%d.in", SOURCEDIR, i + 1);
- source = camel_stream_fs_new_with_name (work, 0, O_RDONLY);
- if (!source) {
- camel_test_fail ("Failed to open input case in \"%s\"", work);
- g_free (work);
- continue;
- }
- g_free (work);
-
- work = g_strdup_printf ("%s/stripheader-%d.out", SOURCEDIR, i + 1);
- correct = camel_stream_fs_new_with_name (work, 0, O_RDONLY);
- if (!correct) {
- camel_test_fail ("Failed to open correct output in \"%s\"", work);
- g_free (work);
- continue;
- }
- g_free (work);
-
- filter = camel_stream_filter_new_with_stream (CAMEL_STREAM (source));
- if (!filter) {
- camel_test_fail ("Couldn't create CamelStreamFilter??");
- continue;
- }
-
- sh = camel_mime_filter_stripheader_new ("Stripped");
- if (!sh) {
- camel_test_fail ("Couldn't create CamelMimeFilterStripHeader??");
- continue;
- }
-
- camel_stream_filter_add (filter, sh);
- camel_test_pull ();
-
- camel_test_push ("Running filter and comparing to correct result");
-
- comp_progress = 0;
-
- while (1) {
- comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE);
- comp_filter_chunk = 0;
-
- if (comp_correct_chunk == 0)
- break;
-
- while (comp_filter_chunk < comp_correct_chunk) {
- ssize_t delta;
-
- delta = camel_stream_read (CAMEL_STREAM (filter),
- comp_filter + comp_filter_chunk,
- CHUNK_SIZE - comp_filter_chunk);
-
- if (delta == 0) {
- camel_test_fail ("Chunks are different sizes: correct is %d, filter is %d, %d bytes into stream",
- comp_correct_chunk, comp_filter_chunk, comp_progress);
- }
-
- comp_filter_chunk += delta;
- }
-
- d(printf ("\n\nCORRECT: >>%.*s<<", comp_correct_chunk, comp_correct);)
- d(printf ("\nFILTER : >>%.*s<<\n", comp_filter_chunk, comp_filter);)
-
- for (comp_i = 0; comp_i < comp_filter_chunk; comp_i++) {
- if (comp_correct[comp_i] != comp_filter[comp_i]) {
- camel_test_fail ("Difference: correct is %c, filter is %c, %d bytes into stream",
- comp_correct[comp_i],
- comp_filter[comp_i],
- comp_progress + comp_i);
- }
- }
-
- comp_progress += comp_filter_chunk;
- }
-
- camel_test_pull ();
-
- /* inefficient */
- camel_test_push ("Cleaning up");
- camel_object_unref (CAMEL_OBJECT (filter));
- camel_object_unref (CAMEL_OBJECT (correct));
- camel_object_unref (CAMEL_OBJECT (source));
- camel_object_unref (CAMEL_OBJECT (sh));
- camel_test_pull ();
-
- camel_test_end();
- }
-
- return 0;
-}
diff --git a/camel/tests/misc/Makefile.am b/camel/tests/misc/Makefile.am
index dc34d1ea16..2b112937bb 100644
--- a/camel/tests/misc/Makefile.am
+++ b/camel/tests/misc/Makefile.am
@@ -1,16 +1,22 @@
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
+INCLUDES = \
+ -I$(includedir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir)/camel \
+ -I$(top_srcdir)/camel/tests/lib \
+ -DG_LOG_DOMAIN=\"evolution-tests\" \
+ $(CAMEL_CFLAGS)
LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EVOLUTION_MAIL_LIBS)
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(GNOME_LIBDIR) \
+ $(top_builddir)/camel/tests/lib/libcameltest.a \
+ $(GNOMEUI_LIBS) \
+ $(INTLLIBS) \
+ $(EVOLUTION_MAIL_LIBS)
check_PROGRAMS = \
url
diff --git a/camel/tests/smime/Makefile.am b/camel/tests/smime/Makefile.am
index e8b098745f..a85f4044b8 100644
--- a/camel/tests/smime/Makefile.am
+++ b/camel/tests/smime/Makefile.am
@@ -1,16 +1,22 @@
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
+INCLUDES = \
+ -I$(includedir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir)/camel \
+ -I$(top_srcdir)/camel/tests/lib \
+ -DG_LOG_DOMAIN=\"evolution-tests\" \
+ $(CAMEL_CFLAGS)
LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EVOLUTION_MAIL_LIBS)
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(GNOME_LIBDIR) \
+ $(top_builddir)/camel/tests/lib/libcameltest.a \
+ $(GNOMEUI_LIBS) \
+ $(INTLLIBS) \
+ $(EVOLUTION_MAIL_LIBS)
check_PROGRAMS = \
pgp \
diff --git a/camel/tests/smime/pgp-mime.c b/camel/tests/smime/pgp-mime.c
index d2e243e084..c58b1866f3 100644
--- a/camel/tests/smime/pgp-mime.c
+++ b/camel/tests/smime/pgp-mime.c
@@ -3,7 +3,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <camel/camel-pgp-mime.h>
+#include <camel/camel-gpg-context.h>
+#include <camel/camel-multipart-signed.h>
+#include <camel/camel-multipart-encrypted.h>
+#include <camel/camel-mime-part.h>
#include <camel/camel-stream-mem.h>
#include "camel-test.h"
@@ -94,10 +97,12 @@ camel_pgp_session_new (const char *path)
int main (int argc, char **argv)
{
CamelSession *session;
- CamelPgpContext *ctx;
+ CamelCipherContext *ctx;
CamelException *ex;
CamelCipherValidity *valid;
- CamelMimePart *mime_part, *part;
+ CamelMimePart *mime_part;
+ CamelMultipartSigned *mps;
+ CamelMultipartEncrypted *mpe;
GPtrArray *recipients;
camel_test_init (argc, argv);
@@ -109,7 +114,8 @@ int main (int argc, char **argv)
session = camel_pgp_session_new ("/tmp/camel-test");
- ctx = camel_pgp_context_new (session, CAMEL_PGP_TYPE_GPG, "/usr/bin/gpg", FALSE);
+ ctx = camel_gpg_context_new (session, "/usr/bin/gpg");
+ camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE);
camel_test_start ("Test of PGP/MIME functions");
@@ -118,23 +124,22 @@ int main (int argc, char **argv)
camel_mime_part_set_description (mime_part, "Test of PGP/MIME multipart/signed stuff");
camel_test_push ("PGP/MIME signing");
- camel_pgp_mime_part_sign (ctx, &mime_part, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, ex);
+ mps = camel_multipart_signed_new ();
+ camel_multipart_signed_sign (mps, ctx, mime_part, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
- check_msg (camel_pgp_mime_is_rfc2015_signed (mime_part),
- "Huh, the MIME part does not seem to be a valid multipart/signed part");
camel_test_pull ();
+ camel_object_unref (mime_part);
camel_exception_clear (ex);
camel_test_push ("PGP/MIME verify");
- valid = camel_pgp_mime_part_verify (ctx, mime_part, ex);
+ valid = camel_multipart_signed_verify (mps, ctx, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid));
camel_cipher_validity_free (valid);
camel_test_pull ();
- camel_object_unref (CAMEL_OBJECT (mime_part));
-
+ camel_object_unref (mps);
camel_exception_clear (ex);
mime_part = camel_mime_part_new ();
@@ -144,23 +149,23 @@ int main (int argc, char **argv)
camel_test_push ("PGP/MIME encrypt");
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, "pgp-mime@xtorshun.org");
- camel_pgp_mime_part_encrypt (ctx, &mime_part, recipients, ex);
+
+ mpe = camel_multipart_encrypted_new ();
+ camel_multipart_encrypted_encrypt (mpe, mime_part, ctx, "pgp-mime@xtorshun.org", recipients, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
- check_msg (camel_pgp_mime_is_rfc2015_encrypted (mime_part),
- "Huh, the MIME part does not seem to be a valid multipart/encrypted part");
g_ptr_array_free (recipients, TRUE);
camel_test_pull ();
camel_exception_clear (ex);
+ camel_object_unref (mime_part);
camel_test_push ("PGP/MIME decrypt");
- part = camel_pgp_mime_part_decrypt (ctx, mime_part, ex);
+ mime_part = camel_multipart_encrypted_decrypt (mpe, ctx, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
- camel_object_unref (CAMEL_OBJECT (part));
+ camel_object_unref (mime_part);
+ camel_object_unref (mpe);
camel_test_pull ();
- camel_object_unref (CAMEL_OBJECT (mime_part));
-
camel_object_unref (CAMEL_OBJECT (ctx));
camel_object_unref (CAMEL_OBJECT (session));
diff --git a/camel/tests/smime/pgp.c b/camel/tests/smime/pgp.c
index 2d5ff7228c..3b422d222b 100644
--- a/camel/tests/smime/pgp.c
+++ b/camel/tests/smime/pgp.c
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <camel/camel-pgp-context.h>
+#include <camel/camel-gpg-context.h>
#include <camel/camel-stream-mem.h>
#include "camel-test.h"
@@ -89,7 +89,7 @@ camel_pgp_session_new (const char *path)
int main (int argc, char **argv)
{
CamelSession *session;
- CamelPgpContext *ctx;
+ CamelCipherContext *ctx;
CamelException *ex;
CamelCipherValidity *valid;
CamelStream *stream1, *stream2, *stream3;
@@ -106,7 +106,8 @@ int main (int argc, char **argv)
session = camel_pgp_session_new ("/tmp/camel-test");
- ctx = camel_pgp_context_new (session, CAMEL_PGP_TYPE_GPG, "/usr/bin/gpg", FALSE);
+ ctx = camel_gpg_context_new (session, "/usr/bin/gpg");
+ camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE);
camel_test_start ("Test of PGP functions");
@@ -117,8 +118,8 @@ int main (int argc, char **argv)
stream2 = camel_stream_mem_new ();
camel_test_push ("PGP signing");
- camel_pgp_sign (ctx, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1,
- stream1, stream2, ex);
+ camel_cipher_sign (ctx, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1,
+ stream1, stream2, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
camel_test_pull ();
@@ -127,7 +128,7 @@ int main (int argc, char **argv)
camel_test_push ("PGP verify");
camel_stream_reset (stream1);
camel_stream_reset (stream2);
- valid = camel_pgp_verify (ctx, stream1, stream2, ex);
+ valid = camel_cipher_verify (ctx, CAMEL_CIPHER_HASH_SHA1, stream1, stream2, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid));
camel_cipher_validity_free (valid);
@@ -148,8 +149,8 @@ int main (int argc, char **argv)
camel_test_push ("PGP encrypt");
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, "pgp-mime@xtorshun.org");
- camel_pgp_encrypt (ctx, FALSE, "pgp-mime@xtorshun.org", recipients,
- stream1, stream2, ex);
+ camel_cipher_encrypt (ctx, FALSE, "pgp-mime@xtorshun.org", recipients,
+ stream1, stream2, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
g_ptr_array_free (recipients, TRUE);
camel_test_pull ();
@@ -158,7 +159,7 @@ int main (int argc, char **argv)
camel_exception_clear (ex);
camel_test_push ("PGP decrypt");
- camel_pgp_decrypt (ctx, stream2, stream3, ex);
+ camel_cipher_decrypt (ctx, stream2, stream3, ex);
check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
buf = CAMEL_STREAM_MEM (stream1)->buffer;
before = g_strndup (buf->data, buf->len);
diff --git a/camel/tests/stream/Makefile.am b/camel/tests/stream/Makefile.am
index 37586766c7..492617b9af 100644
--- a/camel/tests/stream/Makefile.am
+++ b/camel/tests/stream/Makefile.am
@@ -1,16 +1,22 @@
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
+INCLUDES = \
+ -I$(includedir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir)/camel \
+ -I$(top_srcdir)/camel/tests/lib \
+ -DG_LOG_DOMAIN=\"evolution-tests\" \
+ $(CAMEL_CFLAGS)
LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EVOLUTION_MAIL_LIBS)
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(GNOME_LIBDIR) \
+ $(top_builddir)/camel/tests/lib/libcameltest.a \
+ $(GNOMEUI_LIBS) \
+ $(INTLLIBS) \
+ $(EVOLUTION_MAIL_LIBS)
check_PROGRAMS = \
test1 test2 test3