diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-04-07 20:21:27 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-04-07 20:22:06 +0300 |
commit | dfe402f955be8e7676e4da86517b8cdf75a072a2 (patch) | |
tree | 3f20cfbe2514afc7e19db6d30ca005e9f49316a8 | |
parent | 854dd250ee178aca201e73923c99aac09b25ea9c (diff) | |
download | postgresql-dfe402f955be8e7676e4da86517b8cdf75a072a2.tar.gz postgresql-dfe402f955be8e7676e4da86517b8cdf75a072a2.zip |
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
-rw-r--r-- | src/test/kerberos/t/001_auth.pl | 7 | ||||
-rw-r--r-- | src/test/ldap/LdapServer.pm | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl index 0deb9bffc8d..d74e4af464e 100644 --- a/src/test/kerberos/t/001_auth.pl +++ b/src/test/kerberos/t/001_auth.pl @@ -203,7 +203,12 @@ system_or_bail $krb5kdc, '-P', $kdc_pidfile; END { - kill 'INT', `cat $kdc_pidfile` if -f $kdc_pidfile; + # take care not to change the script's exit value + my $exit_code = $?; + + kill 'INT', `cat $kdc_pidfile` if defined($kdc_pidfile) && -f $kdc_pidfile; + + $? = $exit_code; } note "setting up PostgreSQL instance"; diff --git a/src/test/ldap/LdapServer.pm b/src/test/ldap/LdapServer.pm index 1d680d82900..2ff580e5d46 100644 --- a/src/test/ldap/LdapServer.pm +++ b/src/test/ldap/LdapServer.pm @@ -145,6 +145,9 @@ INIT END { + # take care not to change the script's exit value + my $exit_code = $?; + foreach my $server (@servers) { next unless -f $server->{pidfile}; @@ -152,6 +155,8 @@ END chomp $pid; kill 'INT', $pid; } + + $? = $exit_code; } =pod |