From d73e4144d23bad6228d33d1da211a1283f12e080 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Sun, 7 Apr 2024 13:17:18 +0300 Subject: [PATCH 2/2] Don't clobber test exit code at cleanup 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. --- src/test/kerberos/t/001_auth.pl | 5 +++++ src/test/ldap/LdapServer.pm | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl index e51e87d0a2..ec311bfed8 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 { + # 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 91cd9e3762..3866a56e0a 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 -- 2.39.2