]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage, mail-crypt: test-mail* - Use the new test-dir API
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sat, 25 Oct 2025 17:15:05 +0000 (20:15 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 10 Nov 2025 12:12:12 +0000 (12:12 +0000)
mail-crypt's test-mail-key also uses test-mail-storage-common API, so it
now needs the test_dir_init() call.

src/lib-storage/test-mail-storage-common.c
src/lib-storage/test-mail-storage.c
src/lib-storage/test-mail.c
src/plugins/mail-crypt/test-mail-key.c

index e5dc928398073fcc5f7f03aae7c79474ea082027..8defad5e5e3e919ad4ae2438bc4e6355ff972474 100644 (file)
@@ -1,6 +1,7 @@
 /* Copyright (c) 2017-2020 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
+#include "test-dir.h"
 #include "ioloop.h"
 #include "mkdir-parents.h"
 #include "unlink-directory.h"
 struct test_mail_storage_ctx *test_mail_storage_init(void)
 {
        struct test_mail_storage_ctx *ctx;
-       const char *current_dir, *error;
+       const char *error;
        pool_t pool;
 
        pool = pool_allocfree_create("test pool");
        ctx = p_new(pool, struct test_mail_storage_ctx, 1);
        ctx->pool = pool;
 
-       if (t_get_working_dir(&current_dir, &error) < 0)
-               i_fatal("Failed to get current directory: %s", error);
        ctx->home_root = p_strdup_printf(ctx->pool, "%s/.test-home/",
-                                        current_dir);
+                                        test_dir_get());
 
        if (unlink_directory(ctx->home_root, UNLINK_DIRECTORY_FLAG_RMDIR, &error) < 0 &&
            errno != ENOENT)
index d5adfeb59754fe555d5fca47fbf4af7b35756010..3e1e55c4b1ebb55dacfb3b2076c05c11b334799a 100644 (file)
@@ -3,6 +3,7 @@
 #include "lib.h"
 #include "ioloop.h"
 #include "test-common.h"
+#include "test-dir.h"
 #include "master-service.h"
 #include "test-mail-storage-common.h"
 
@@ -747,7 +748,7 @@ int main(int argc, char **argv)
                                             MASTER_SERVICE_FLAG_NO_SSL_INIT |
                                             MASTER_SERVICE_FLAG_NO_INIT_DATASTACK_FRAME,
                                             &argc, &argv, "");
-
+       test_dir_init("test-mail-storage");
        ret = test_run(tests);
 
        master_service_deinit(&master_service);
index 3262d06af2721c6e0b154e9dcac13df6daf6a64f..e2e1c3b5cce55ab8ca2afe9cbf31b80426c0c658 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "lib.h"
 #include "test-common.h"
+#include "test-dir.h"
 #include "istream.h"
 #include "master-service.h"
 #include "message-size.h"
@@ -748,6 +749,7 @@ int main(int argc, char **argv)
 
        if (null_strcmp(argv[1], "-D") == 0)
                event_set_forced_debug(test_event, TRUE);
+       test_dir_init("test-mail");
        ret = test_run(tests);
        master_service_deinit(&master_service);
        return ret;
index a99b0cc852254e8398e4c32132e34f423035f80c..af3f5b82524896745794f6893f2df07965c80998 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "lib.h"
 #include "test-common.h"
+#include "test-dir.h"
 #include "hex-binary.h"
 #include "settings.h"
 #include "master-service.h"
@@ -429,6 +430,7 @@ int main(int argc, char **argv)
                                             &argc, &argv, "");
        settings_info_register(&dict_setting_parser_info);
        settings_info_register(&dict_file_setting_parser_info);
+       test_dir_init("test-mail-key");
        int ret = test_run(tests);
        master_service_deinit(&master_service);
        return ret;