diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
commit | c21c3b0befeb46a51b6bf3758ffa30813bea0ff0 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/libh2o/misc/p5-Server-Starter/t/11-specified-fd.t | |
parent | Adding upstream version 1.43.2. (diff) | |
download | netdata-0d980fd06561f4670f5d8170c5aedd74023e3702.tar.xz netdata-0d980fd06561f4670f5d8170c5aedd74023e3702.zip |
Adding upstream version 1.44.3.upstream/1.44.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/misc/p5-Server-Starter/t/11-specified-fd.t')
-rw-r--r-- | web/server/h2o/libh2o/misc/p5-Server-Starter/t/11-specified-fd.t | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/misc/p5-Server-Starter/t/11-specified-fd.t b/web/server/h2o/libh2o/misc/p5-Server-Starter/t/11-specified-fd.t new file mode 100644 index 000000000..7e3b820be --- /dev/null +++ b/web/server/h2o/libh2o/misc/p5-Server-Starter/t/11-specified-fd.t @@ -0,0 +1,40 @@ +use strict; +use warnings; + +use File::Temp (); +use Test::TCP; +use Test::More tests => 4; + +use Server::Starter qw(start_server); + +$SIG{PIPE} = sub {}; + +test_tcp( + server => sub { + my $port = shift; + start_server( + port => "$port=0", + exec => [ + $^X, qw(t/11-specified-fd-server.pl) + ], + ); + exit 0; + }, + client => sub { + my ($port, $server_pid) = @_; + my $buf; + #sleep 1; + my $sock = IO::Socket::INET->new( + PeerAddr => "127.0.0.1:$port", + Proto => 'tcp', + ); + ok($sock, 'connect'); + # check response and get pid + is($sock->syswrite("hello"), 5, 'write'); + ok($sock->sysread($buf, 1048576), 'read'); + undef $sock; + like($buf, qr/^\d+:hello$/, 'read'); + kill $server_pid; + }, +); + |