# getsockopt can EINVAL if SO_ACCEPTFILTER is unset:
my $x = getsockopt($s, SOL_SOCKET, $SO_ACCEPTFILTER);
return if ($x // '') =~ /[^\0]/s; # don't change if set
- my $accf_arg = pack('a16a240', $af_name, '');
- setsockopt $s, SOL_SOCKET, $SO_ACCEPTFILTER, $accf_arg;
+ CORE::setsockopt $s, SOL_SOCKET, $SO_ACCEPTFILTER,
+ pack('a16a240', $af_name, '') or
+ warn 'W: ', sockname($s), <<EOM;
+ SO_ACCEPTFILTER $af_name: $! (try `kldload $af_name')
+EOM
}
};
my $err = $@; # sockname() clobbers $@
create_coderepo require_bsd kernel_version check_broken_tmpfs
quit_waiter_pipe wait_for_eof require_git_http_backend
tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt
- test_httpd xbail require_cmd is_xdeeply tail_f
+ test_httpd no_httpd_errors xbail require_cmd is_xdeeply tail_f
ignore_inline_c_missing no_pollerfd no_coredump cfg_new
strace strace_inject lsof_pid oct_is);
require Test::More;
$ibx;
}
+sub no_httpd_errors ($;$) {
+ my ($err, $msg) = @_;
+ open my $fh, '<', $err;
+ my $e = read_all $fh;
+ $e =~ s/^Plack::Middleware::ReverseProxy missing,\n//gms and
+ $e =~ s/^URL generation for redirects[^\n]*\n//gms;
+ $e =~ s/^W: .*?try `kldload[^\n]+\n//gms;
+ is $e, '', $msg // 'no httpd errors';
+}
+
sub test_httpd ($$;$$) {
my ($env, $client, $skip, $cb) = @_;
my ($tmpdir, $for_destroy);
ua => $ua);
$cb->() if $cb;
$td->join('TERM');
- open my $fh, '<', $err;
- my $e = read_all($fh);
- if ($e =~ s/^Plack::Middleware::ReverseProxy missing,\n//gms) {
- $e =~ s/^URL generation for redirects .*\n//gms;
- }
- is($e, '', 'no errors');
+ no_httpd_errors $err;
}
};
my $expect = '69df7d565d49fbaaeb0a067910f03dc22cd52bd0';
my $non_existent = 'ee5e32211bf62ab6531bdf39b84b6920d0b6775a';
my $stderr_empty = sub {
- my ($msg) = @_;
- open my $efh, '<', "$tmpdir/stderr.log";
- my @l = <$efh>;
- @l = grep(!/reverse ?proxy/i, @l);
- is_xdeeply(\@l, [], $msg // 'stderr.log is empty');
+ no_httpd_errors "$tmpdir/stderr.log",
+ $_[0] // 'stderr.log is empty';
};
test_lei({tmpdir => "$tmpdir/blob"}, sub {