Skip to content

Commit a475a2f

Browse files
committed
Don't clobber test exit code at cleanup in LDAP/Kerberors tests
If the test script die()d before running the first test, the whole test was interpreted as SKIPped rather than failed. The PostgreSQL::Cluster module got this right. Backpatch to all supported versions. Discussion: https://www.postgresql.org/message-id/fb898a70-3a88-4629-88e9-f2375020061d@iki.fi
1 parent e13b586 commit a475a2f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/test/kerberos/t/001_auth.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@
203203

204204
END
205205
{
206+
# take care not to change the script's exit value
207+
my $exit_code = $?;
208+
206209
kill 'INT', `cat $kdc_pidfile` if defined($kdc_pidfile) && -f $kdc_pidfile;
210+
211+
$? = $exit_code;
207212
}
208213

209214
note "setting up PostgreSQL instance";

src/test/ldap/LdapServer.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,18 @@ INIT
145145

146146
END
147147
{
148+
# take care not to change the script's exit value
149+
my $exit_code = $?;
150+
148151
foreach my $server (@servers)
149152
{
150153
next unless -f $server->{pidfile};
151154
my $pid = slurp_file($server->{pidfile});
152155
chomp $pid;
153156
kill 'INT', $pid;
154157
}
158+
159+
$? = $exit_code;
155160
}
156161

157162
=pod

0 commit comments

Comments
 (0)