Skip to content

Commit

Permalink
lib-imap-client: Fix test-imapc-client unit test to work on OSX
Browse files Browse the repository at this point in the history
connect() to port 0 fails in it, so for the "connect failure" test first
open a random free listener port and then close it. Hopefully nothing else
reopens it in the mean time.
  • Loading branch information
sirainen authored and GitLab committed Jun 4, 2017
1 parent 796beea commit be97d7e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib-imap-client/test-imapc-client.c
Expand Up @@ -128,9 +128,10 @@ static void test_run_client_server(
i_zero(&server);
server.pid = (pid_t)-1;
server.fd = -1;
server.fd_listen = server_test == NULL ? -1 :
test_open_server_fd(&server.port);
server.fd_listen = test_open_server_fd(&server.port);
client_set_copy.port = server.port;
if (server_test == NULL)
i_close_fd(&server.fd_listen);

if (mkdir(client_set->temp_path_prefix, 0700) < 0 && errno != EEXIST)
i_fatal("mkdir(%s) failed: %m", client_set->temp_path_prefix);
Expand Down

0 comments on commit be97d7e

Please sign in to comment.