test-ioloop.c revision d54edc1ad7b71020f6726363308985e0658657fb
/* Copyright (c) 2015-2016 Dovecot authors, see the included COPYING file */
#include "test-lib.h"
#include "net.h"
#include "time-util.h"
#include "ioloop.h"
#include "istream.h"
#include <unistd.h>
struct test_ctx {
bool got_left;
bool got_right;
bool got_to;
};
{
i_fatal("gettimeofday() failed: %m");
}
{
}
{
}
{
}
static void test_ioloop_fd(void)
{
test_begin("ioloop fd");
int fds[2];
test_assert(ret == 0);
if (ret < 0) {
i_error("socketpair() failed: %m");
test_end();
return;
}
i_fatal("write() failed: %m");
timeout_remove(&to);
i_close_fd(&fds[0]);
test_end();
}
static void test_ioloop_timeout(void)
{
test_begin("ioloop timeout");
ioloop = io_loop_create();
/* add a timeout by moving it from another ioloop */
ioloop2 = io_loop_create();
sleep(1);
/* add & remove immediately */
timeout_remove(&to);
/* add the timeout we're actually testing below */
i_fatal("gettimeofday() failed: %m");
timeout_remove(&to);
test_end();
}
{
}
static void test_ioloop_find_fd_conditions(void)
{
struct {
enum io_condition condition;
int fd[2];
} tests[] = {
};
unsigned int i;
test_begin("ioloop find fd conditions");
ioloop = io_loop_create();
for (i = 0; i < N_ELEMENTS(tests); i++) {
i_fatal("socketpair() failed: %m");
}
for (i = 0; i < N_ELEMENTS(tests); i++)
for (i = 0; i < N_ELEMENTS(tests); i++) {
}
test_end();
}
{
}
static void test_ioloop_pending_io(void)
{
test_begin("ioloop pending io");
i_stream_unref(&is);
test_end();
}
void test_ioloop(void)
{
}