Skip to content

Commit c757a3d

Browse files
committed
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
1 parent 9970716 commit c757a3d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/test/authentication/t/001_password.pl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ sub test_role
4444

4545
$status_string = 'success' if ($expected_res eq 0);
4646

47-
my $res =
48-
$node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]);
47+
my $res = $node->psql('postgres', undef, extra_params => [ '-U', $role ]);
4948
is($res, $expected_res,
5049
"authentication $status_string for method $method, role $role");
5150
}

src/test/authentication/t/002_saslprep.pl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ sub test_login
4141
$status_string = 'success' if ($expected_res eq 0);
4242

4343
$ENV{"PGPASSWORD"} = $password;
44-
my $res =
45-
$node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]);
44+
my $res = $node->psql('postgres', undef, extra_params => [ '-U', $role ]);
4645
is($res, $expected_res,
4746
"authentication $status_string for role $role with password $password"
4847
);

src/test/perl/TestLib.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ BEGIN
7575
INIT
7676
{
7777

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy