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:25:14 +0300 |
commit | 0d95711ae0d3b328b0a3534a546a4f848d273e08 (patch) | |
tree | 066b2998a92f5a567fbaee326fa3163e87aaf348 | |
parent | 1782571f6537c1d1a3c65fbf47a1be445eb606e3 (diff) | |
download | postgresql-0d95711ae0d3b328b0a3534a546a4f848d273e08.tar.gz postgresql-0d95711ae0d3b328b0a3534a546a4f848d273e08.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/t/001_auth.pl | 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 0363c5f5a8e..1c1fd674cf0 100644 --- a/src/test/kerberos/t/001_auth.pl +++ b/src/test/kerberos/t/001_auth.pl @@ -180,7 +180,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/t/001_auth.pl b/src/test/ldap/t/001_auth.pl index 850b28f20f8..c0f2782f495 100644 --- a/src/test/ldap/t/001_auth.pl +++ b/src/test/ldap/t/001_auth.pl @@ -147,7 +147,12 @@ system_or_bail $slapd, '-f', $slapd_conf,'-s0', '-h', "$ldap_url $ldaps_url"; END { + # take care not to change the script's exit value + my $exit_code = $?; + kill 'INT', `cat $slapd_pidfile` if -f $slapd_pidfile; + + $? = $exit_code; } append_to_file($ldap_pwfile, $ldap_rootpw); |