#include <unistd.h>
#include <dirent.h>
-#define MAX_PARALLEL_PENDING 200
+#define CLIENT_PROGRESS_TIMEOUT 30
+#define MAX_PARALLEL_PENDING 200
static bool debug = FALSE;
+static const char *failure = NULL;
enum test_ssl_mode {
TEST_SSL_MODE_NONE = 0,
static struct test_client_transaction *client_requests;
static unsigned int client_files_first, client_files_last;
static struct timeout *client_to = NULL;
+struct timeout *to_client_progress = NULL;
static struct test_client_transaction *
test_client_transaction_new(void)
const char *path;
unsigned int count;
+ timeout_reset(to_client_progress);
+
paths = array_get_modifiable(&files, &count);
i_assert(tctrans->files_idx < count);
i_assert(client_files_first < count);
const char *path;
unsigned int count;
+ timeout_reset(to_client_progress);
+
paths = array_get_modifiable(&files, &count);
i_assert(tctrans->files_idx < count);
i_assert(client_files_first < count);
const char *path;
unsigned int count;
+ timeout_reset(to_client_progress);
+
if (debug) {
i_debug("test client: "
"got response for DATA [%u]",
i_debug("test client: continue");
timeout_remove(&client_to);
+ timeout_reset(to_client_progress);
paths = array_get_modifiable(&files, &count);
}
}
+static void
+test_client_progress_timeout(void *context ATTR_UNUSED)
+{
+ /* Terminate test due to lack of progress */
+ failure = "Test is hanging";
+ timeout_remove(&to_client_progress);
+ io_loop_stop(current_ioloop);
+}
+
static void
test_client(enum smtp_protocol protocol,
const struct smtp_client_settings *client_set)
{
client_protocol = protocol;
+ to_client_progress = timeout_add(CLIENT_PROGRESS_TIMEOUT*1000,
+ test_client_progress_timeout, NULL);
+
/* create client */
smtp_client = smtp_client_init(client_set);
static void test_client_deinit(void)
{
timeout_remove(&client_to);
+ timeout_remove(&to_client_progress);
smtp_client_deinit(&smtp_client);
}
if (test_ssl_mode == TEST_SSL_MODE_STARTTLS)
server_set->capabilities |= SMTP_CAPABILITY_STARTTLS;
+ failure = NULL;
test_open_server_fd();
if ((server_pid = fork()) == (pid_t)-1)
client_init);
test_files_deinit();
- test_out("sequential", TRUE);
+ test_out_reason("sequential", (failure == NULL), failure);
test_max_pending = MAX_PARALLEL_PENDING;
test_unknown_size = FALSE;
client_init);
test_files_deinit();
- test_out("parallel", TRUE);
+ test_out_reason("parallel", (failure == NULL), failure);
smtp_server_set.max_pipelined_commands = 5;
smtp_server_set.capabilities |= SMTP_CAPABILITY_PIPELINING;
client_init);
test_files_deinit();
- test_out("parallel pipelining", TRUE);
+ test_out_reason("parallel pipelining", (failure == NULL), failure);
smtp_server_set.max_pipelined_commands = 5;
smtp_server_set.capabilities |= SMTP_CAPABILITY_PIPELINING;
client_init);
test_files_deinit();
- test_out("unknown payload size", TRUE);
+ test_out_reason("unknown payload size", (failure == NULL), failure);
smtp_server_set.max_pipelined_commands = 5;
smtp_server_set.capabilities |= SMTP_CAPABILITY_PIPELINING;
client_init);
test_files_deinit();
- test_out("parallel pipelining ssl", TRUE);
+ test_out_reason("parallel pipelining ssl",
+ (failure == NULL), failure);
smtp_server_set.max_pipelined_commands = 5;
smtp_server_set.capabilities |= SMTP_CAPABILITY_PIPELINING;
client_init);
test_files_deinit();
- test_out("parallel pipelining startls", TRUE);
+ test_out_reason("parallel pipelining startls",
+ (failure == NULL), failure);
}
static void test_smtp_normal(void)