]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: test-mail-{index,cache} - Use the new test-dir API
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sat, 1 Nov 2025 19:52:34 +0000 (20:52 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 5 Nov 2025 10:17:48 +0000 (10:17 +0000)
src/lib-index/test-mail-cache-fields.c
src/lib-index/test-mail-cache-purge.c
src/lib-index/test-mail-cache.c
src/lib-index/test-mail-index-modseq.c
src/lib-index/test-mail-index.c
src/lib-index/test-mail-index.h

index 1a99c774fdfb55edaaf000002f0af17cc8f706e3..2c7245eb368f74e7896926bff2ef3f1e6961f348 100644 (file)
@@ -110,5 +110,6 @@ int main(void)
                test_mail_cache_fields_read_write,
                NULL
        };
+       test_dir_init("mail-cache-fields");
        return test_run(test_functions);
 }
index 24dd3bb74dafa26d4b7d28d6a678b6acfcdbfcaa..3c251a24acd6fda6dcd1afa181351c7b32c5d197 100644 (file)
@@ -1111,5 +1111,6 @@ int main(void)
                test_mail_cache_purge_deadlines,
                NULL
        };
+       test_dir_init("mail-cache-purge");
        return test_run(test_functions);
 }
index 352e57f26a927c760444493efd15cd1b128b0659..282dc95190073d51519e2dd139e56f1ac07347a1 100644 (file)
@@ -822,5 +822,6 @@ int main(void)
                test_mail_cache_duplicate_fields,
                NULL
        };
+       test_dir_init("mail-cache");
        return test_run(test_functions);
 }
index c900966254fbda08e2f202a71538855633de5e2e..9ea15a25f0d7b9da6a39c1c7c6a900e20e985f68 100644 (file)
@@ -73,5 +73,6 @@ int main(void)
                test_mail_index_modseq_get_next_log_offset,
                NULL
        };
+       test_dir_init("mail-index-modseq");
        return test_run(test_functions);
 }
index 84d2b43f516754e1b3fb118df2cdc3794910fd10..49001ced98692bdd273a2d9c8e16a3203cfafcbf 100644 (file)
@@ -165,5 +165,6 @@ int main(void)
                test_mail_index_new_extension,
                NULL
        };
+       test_dir_init("mail-index");
        return test_run(test_functions);
 }
index e8251e974d18f51237eba21971c09c2683a88c24..f6ddca5f84c37f08fac17fd18c2da5d7df8e664d 100644 (file)
@@ -4,14 +4,21 @@
 #include "ioloop.h"
 #include "unlink-directory.h"
 #include "mail-index-private.h"
+#include "test-dir.h"
 
 #define TESTDIR_NAME ".dovecot.test"
 
+static inline const char *test_mail_index_get_dir(void)
+{
+       return test_dir_prepend(TESTDIR_NAME);
+}
+
 static inline struct mail_index *test_mail_index_open(bool idx_initial_created)
 {
        struct mail_index *index;
 
-       index = mail_index_alloc(NULL, TESTDIR_NAME, "test.dovecot.index");
+       index = mail_index_alloc(NULL, test_mail_index_get_dir(),
+                                "test.dovecot.index");
        test_assert(mail_index_open_or_create(index, MAIL_INDEX_OPEN_FLAG_CREATE) ==
                   (idx_initial_created ? 1 : 0));
        return index;
@@ -19,11 +26,12 @@ static inline struct mail_index *test_mail_index_open(bool idx_initial_created)
 
 static inline struct mail_index *test_mail_index_init(bool idx_initial_created)
 {
+       const char *testdir_name = test_mail_index_get_dir();
        const char *error;
 
-       (void)unlink_directory(TESTDIR_NAME, UNLINK_DIRECTORY_FLAG_RMDIR, &error);
-       if (mkdir(TESTDIR_NAME, 0700) < 0)
-               i_error("mkdir(%s) failed: %m", TESTDIR_NAME);
+       (void)unlink_directory(testdir_name, UNLINK_DIRECTORY_FLAG_RMDIR, &error);
+       if (mkdir(testdir_name, 0700) < 0)
+               i_error("mkdir(%s) failed: %m", testdir_name);
 
        ioloop_time = 1;
 
@@ -40,7 +48,8 @@ static inline void test_mail_index_delete(void)
 {
        const char *error;
 
-       (void)unlink_directory(TESTDIR_NAME, UNLINK_DIRECTORY_FLAG_RMDIR, &error);
+       (void)unlink_directory(test_mail_index_get_dir(),
+                              UNLINK_DIRECTORY_FLAG_RMDIR, &error);
 }
 
 static inline void test_mail_index_deinit(struct mail_index **index)