/* Copyright (c) 2017-2018 Dovecot authors, see the included COPYING file */
#include "test-lib.h"
#include "unlink-directory.h"
#include "file-create-locked.h"
#include <fcntl.h>
#include <signal.h>
{
int fd;
if (fd == -1)
i_close_fd(&fd);
}
{
for (unsigned int i = 0; i < 1000; i++) {
return TRUE;
return FALSE;
i_fatal("kill(SIGSRCH) failed: %m");
}
usleep(10000);
}
return FALSE;
}
static void test_file_create_locked_basic(void)
{
.lock_timeout_secs = 0,
};
const char *error;
bool created;
int fd;
test_begin("file_create_locked()");
i_unlink_if_exists(".test-temp-file-create-locked-child");
switch (pid) {
case (pid_t)-1:
i_error("fork() failed: %m");
break;
case 0:
/* child */
test_assert(fd > 0);
if (test_has_failed())
exit(1);
create_file(".test-temp-file-create-locked-child");
sleep(60);
i_close_fd(&fd);
exit(0);
default:
/* parent */
if (test_has_failed())
break;
i_error("kill(SIGKILL) failed: %m");
break;
}
i_unlink_if_exists(".test-temp-file-create-locked-child");
test_end();
}
static void test_file_create_locked_mkdir(void)
{
.lock_timeout_secs = 0,
};
const char *path;
bool created;
int fd;
test_begin("file_create_locked() with mkdir");
dir = ".test-temp-file-create-locked-dir";
/* try without mkdir enabled */
/* try with mkdir enabled */
test_assert(fd > 0);
i_close_fd(&fd);
test_end();
}
void test_file_create_locked(void)
{
}