From be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 04:57:58 +0200 Subject: Adding upstream version 1.44.3. Signed-off-by: Daniel Baumann --- .../misc/p5-Server-Starter/t/03-starter-unix.t | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 web/server/h2o/libh2o/misc/p5-Server-Starter/t/03-starter-unix.t (limited to 'web/server/h2o/libh2o/misc/p5-Server-Starter/t/03-starter-unix.t') diff --git a/web/server/h2o/libh2o/misc/p5-Server-Starter/t/03-starter-unix.t b/web/server/h2o/libh2o/misc/p5-Server-Starter/t/03-starter-unix.t new file mode 100644 index 00000000..965de6b6 --- /dev/null +++ b/web/server/h2o/libh2o/misc/p5-Server-Starter/t/03-starter-unix.t @@ -0,0 +1,40 @@ +use strict; +use warnings; + +use File::Temp (); +use IO::Socket::UNIX; +use Test::More tests => 4; +use Test::SharedFork; + +use Server::Starter qw(start_server); + +$SIG{PIPE} = sub {}; + +my $sockfile = File::Temp::tmpnam(); + +my $pid = fork; +die "fork failed: $!" + unless defined $pid; +if ($pid == 0) { + # child + start_server( + path => $sockfile, + exec => [ $^X, qw(t/03-starter-unix-echod.pl) ], + ); + exit 0; +} else { + # parent + sleep 1 + until -e $sockfile; + my $sock = IO::Socket::UNIX->new( + Peer => $sockfile, + ) or die "failed to connect to unix socket:$!"; + is $sock->syswrite('hello', 5), 5, 'write'; + is $sock->sysread(my $buf, 5), 5, 'read length'; + is $buf, 'hello', 'read data'; + kill 'TERM', $pid; + while (wait != $pid) {} + ok ! -e $sockfile, 'socket file removed after shutdown'; +} + +unlink $sockfile; -- cgit v1.2.3