]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Don't clobber test exit code at cleanup in LDAP/Kerberors tests
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sun, 7 Apr 2024 17:21:27 +0000 (20:21 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sun, 7 Apr 2024 17:22:28 +0000 (20:22 +0300)
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

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

index 64117c24193675eb90fc0029c0c5db4fe0555d73..f2253e5b6880326771b603bf753cd74db7090a33 100644 (file)
@@ -184,7 +184,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";
index f651f44408bdfb27d17b32852c3fd63ea48eb21c..3dd56e9f439c91038be2768bb4bbe438f922c399 100644 (file)
@@ -163,7 +163,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);