From b588ccbbf73547487f54fd1a9d5396d6848e8661 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 10 Sep 2023 19:21:05 +0000 Subject: tests: fold SO_KEEPALIVE check to Perl 5 integration No need to startup more processes than necessary. --- t/integration.t | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't') diff --git a/t/integration.t b/t/integration.t index 80485e4..bea221c 100644 --- a/t/integration.t +++ b/t/integration.t @@ -7,8 +7,16 @@ use v5.14; BEGIN { require './t/lib.perl' }; use autodie; +use Socket qw(SOL_SOCKET SO_KEEPALIVE); our $srv = tcp_server(); our $host_port = tcp_host_port($srv); + +if ('ensure Perl does not set SO_KEEPALIVE by default') { + my $val = getsockopt($srv, SOL_SOCKET, SO_KEEPALIVE); + unpack('i', $val) == 0 or + setsockopt($srv, SOL_SOCKET, SO_KEEPALIVE, pack('i', 0)); + $val = getsockopt($srv, SOL_SOCKET, SO_KEEPALIVE); +} my $t0 = time; open my $conf_fh, '>', $u_conf; $conf_fh->autoflush(1); @@ -71,6 +79,11 @@ is_deeply([ grep(/^X-R2: /, @$hdr) ], [ 'X-R2: a', 'X-R2: b', 'X-R2: c' ], 'rack 2 LF-delimited headers supported') or diag(explain($hdr)); +{ + my $val = getsockopt($srv, SOL_SOCKET, SO_KEEPALIVE); + is(unpack('i', $val), 1, 'SO_KEEPALIVE set on inherited socket'); +} + SKIP: { # Date header check my @d = grep(/^Date: /i, @$hdr); is(scalar(@d), 1, 'got one date header') or diag(explain(\@d)); -- cgit v1.2.3-24-ge0c7