Avoid and detect SIGPIPE race in TAP tests.

Don't write to stdin of a psql process that could have already exited
with an authentication failure.  Buildfarm members crake and mandrill
have failed once by doing so.  Ignore SIGPIPE in all TAP tests.
Back-patch to v10, where these tests were introduced.

Reviewed by Michael Paquier.

Discussion: https://postgr.es/m/20171209210203.GC3362632@rfd.leadboat.com
pull/27/head
Noah Misch 8 years ago
parent 997071691f
commit c757a3da0a
  1. 3
      src/test/authentication/t/001_password.pl
  2. 3
      src/test/authentication/t/002_saslprep.pl
  3. 4
      src/test/perl/TestLib.pm

@ -44,8 +44,7 @@ sub test_role
$status_string = 'success' if ($expected_res eq 0);
my $res =
$node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]);
my $res = $node->psql('postgres', undef, extra_params => [ '-U', $role ]);
is($res, $expected_res,
"authentication $status_string for method $method, role $role");
}

@ -41,8 +41,7 @@ sub test_login
$status_string = 'success' if ($expected_res eq 0);
$ENV{"PGPASSWORD"} = $password;
my $res =
$node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]);
my $res = $node->psql('postgres', undef, extra_params => [ '-U', $role ]);
is($res, $expected_res,
"authentication $status_string for role $role with password $password"
);

@ -75,6 +75,10 @@ BEGIN
INIT
{
# Return EPIPE instead of killing the process with SIGPIPE. An affected
# test may still fail, but it's more likely to report useful facts.
$SIG{PIPE} = 'IGNORE';
# Determine output directories, and create them. The base path is the
# TESTDIR environment variable, which is normally set by the invoking
# Makefile.

Loading…
Cancel
Save