"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib-dict-extra/test-dict-fs.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

test-dict-fs.c  (dovecot-2.3.16):test-dict-fs.c  (dovecot-2.3.17)
skipping to change at line 12 skipping to change at line 12
#include <sys/stat.h> #include <sys/stat.h>
#include "lib.h" #include "lib.h"
#include "unlink-directory.h" #include "unlink-directory.h"
#include "test-common.h" #include "test-common.h"
#include "dict-private.h" #include "dict-private.h"
static void test_dict_set_get(struct dict *dict, const char *key, static void test_dict_set_get(struct dict *dict, const char *key,
const char *value) const char *value)
{ {
const char *got_value, *error; const char *got_value, *error;
struct dict_transaction_context *t = dict_transaction_begin(dict); struct dict_op_settings set = {
.username = "testuser",
};
struct dict_transaction_context *t = dict_transaction_begin(dict, &set);
dict_set(t, key, value); dict_set(t, key, value);
if (dict_transaction_commit(&t, &error) < 0) if (dict_transaction_commit(&t, &error) < 0)
i_fatal("dict_transaction_commit(%s) failed: %s", key, error); i_fatal("dict_transaction_commit(%s) failed: %s", key, error);
if (dict_lookup(dict, pool_datastack_create(), key, &got_value, if (dict_lookup(dict, &set, pool_datastack_create(), key, &got_value,
&error) < 0) &error) < 0)
i_fatal("dict_lookup(%s) failed: %s", key, error); i_fatal("dict_lookup(%s) failed: %s", key, error);
test_assert_strcmp(got_value, value); test_assert_strcmp(got_value, value);
} }
static bool test_file_exists(const char *path) static bool test_file_exists(const char *path)
{ {
struct stat st; struct stat st;
if (stat(path, &st) < 0) { if (stat(path, &st) < 0) {
if (ENOTFOUND(errno)) return FALSE; if (ENOTFOUND(errno)) return FALSE;
skipping to change at line 38 skipping to change at line 41
} }
return TRUE; return TRUE;
} }
static void test_dict_fs_set_get(void) static void test_dict_fs_set_get(void)
{ {
test_begin("dict-fs get/set"); test_begin("dict-fs get/set");
const char *error; const char *error;
struct dict *dict; struct dict *dict;
struct dict_settings set = { struct dict_settings set = {
.username = "testuser",
.base_dir = ".", .base_dir = ".",
}; };
if (dict_init("fs:posix:prefix=.test-dict/", &set, &dict, &error) < 0) if (dict_init("fs:posix:prefix=.test-dict/", &set, &dict, &error) < 0)
i_fatal("dict_init() failed: %s", error); i_fatal("dict_init() failed: %s", error);
/* shared paths */ /* shared paths */
struct { struct {
const char *key; const char *key;
const char *path; const char *path;
} test_cases[] = { } test_cases[] = {
 End of changes. 3 change blocks. 
3 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)