From: Eric Wong Date: Sun, 30 Jun 2019 22:32:32 +0000 (+0000) Subject: t/httpd-unix.t: avoid race in between bind() and listen() X-Git-Tag: v1.2.0~131 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=15f98820ca5434f40410a6fceed1e37e50ab68a7;p=public-inbox.git t/httpd-unix.t: avoid race in between bind() and listen() We need to be able to successfully connect() to the socket before attempting further tests. Merely testing for the existence of a socket isn't enough, since the server may've only done bind(), not listen(). --- diff --git a/t/httpd-unix.t b/t/httpd-unix.t index 758277c9..04f4b8fa 100644 --- a/t/httpd-unix.t +++ b/t/httpd-unix.t @@ -42,8 +42,9 @@ my $spawn_httpd = sub { ok(!-S $unix, 'UNIX socket does not exist, yet'); $spawn_httpd->("-l$unix"); +my %o = (Peer => $unix, Type => SOCK_STREAM); for (1..1000) { - last if -S $unix; + last if -S $unix && IO::Socket::UNIX->new(%o); select undef, undef, undef, 0.02 }