changeset 21302:f677d31a8211

mail-crypt: Skip tests if dcrypt cannot be initialized Avoids breaking tests on system without working ECC keys.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Wed, 14 Dec 2016 17:39:04 +0200
parents e39750012d11
children e48ccffc7815
files src/plugins/mail-crypt/test-mail-global-key.c src/plugins/mail-crypt/test-mail-key.c
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/mail-crypt/test-mail-global-key.c	Wed Dec 14 11:42:56 2016 +0200
+++ b/src/plugins/mail-crypt/test-mail-global-key.c	Wed Dec 14 17:39:04 2016 +0200
@@ -37,7 +37,10 @@
 	struct dcrypt_settings set = {
 		.module_dir = top_builddir "/src/lib-dcrypt/.libs"
 	};
-	dcrypt_initialize(NULL, &set, NULL);
+	if (!dcrypt_initialize(NULL, &set, NULL)) {
+		i_info("No functional dcrypt backend found - skipping tests");
+		test_exit(0);
+	}
 	i_array_init(&fs_set.plugin_envs, 8);
 	array_append(&fs_set.plugin_envs, settings, N_ELEMENTS(settings));
 }
--- a/src/plugins/mail-crypt/test-mail-key.c	Wed Dec 14 11:42:56 2016 +0200
+++ b/src/plugins/mail-crypt/test-mail-key.c	Wed Dec 14 17:39:04 2016 +0200
@@ -456,7 +456,10 @@
 	};
 	test_pool = pool_alloconly_create(MEMPOOL_GROWING "mcp test pool", 128);
 	test_ioloop = io_loop_create();
-	dcrypt_initialize(NULL, &set, NULL);
+	if (!dcrypt_initialize(NULL, &set, NULL)) {
+		i_info("No functional dcrypt backend found - skipping tests");
+		test_exit(0);
+	}
 	/* allocate a user */
 	if (init_test_mail_user() < 0) {
 		test_exit(1);