diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
commit | 2a0f262beff32ba86bcb58f3273214e5d0517c09 (patch) | |
tree | 24c0ad10dab36bbd5c22743d3c88c4e0ccd5bc65 /src/test/ldap | |
parent | Releasing progress-linux version 16.2-2~progress7.99u1. (diff) | |
download | postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.tar.xz postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.zip |
Merging upstream version 16.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ldap')
-rw-r--r-- | src/test/ldap/LdapServer.pm | 96 | ||||
-rw-r--r-- | src/test/ldap/t/001_auth.pl | 3 | ||||
-rw-r--r-- | src/test/ldap/t/002_bindpasswd.pl | 3 |
3 files changed, 72 insertions, 30 deletions
diff --git a/src/test/ldap/LdapServer.pm b/src/test/ldap/LdapServer.pm index a4c1a18..2ff580e 100644 --- a/src/test/ldap/LdapServer.pm +++ b/src/test/ldap/LdapServer.pm @@ -57,55 +57,97 @@ use File::Basename; # private variables my ($slapd, $ldap_schema_dir, @servers); -# visible variable -our ($setup); +# visible variables +our ($setup, $setup_error); INIT { + # Find the OpenLDAP server binary and directory containing schema + # definition files. On success, $setup is set to 1. On failure, + # it's set to 0, and an error message is set in $setup_error. $setup = 1; - if ($^O eq 'darwin' && -d '/opt/homebrew/opt/openldap') + if ($^O eq 'darwin') { - # typical paths for Homebrew on ARM - $slapd = '/opt/homebrew/opt/openldap/libexec/slapd'; - $ldap_schema_dir = '/opt/homebrew/etc/openldap/schema'; - } - elsif ($^O eq 'darwin' && -d '/usr/local/opt/openldap') - { - # typical paths for Homebrew on Intel - $slapd = '/usr/local/opt/openldap/libexec/slapd'; - $ldap_schema_dir = '/usr/local/etc/openldap/schema'; - } - elsif ($^O eq 'darwin' && -d '/opt/local/etc/openldap') - { - # typical paths for MacPorts - $slapd = '/opt/local/libexec/slapd'; - $ldap_schema_dir = '/opt/local/etc/openldap/schema'; + if (-d '/opt/homebrew/opt/openldap') + { + # typical paths for Homebrew on ARM + $slapd = '/opt/homebrew/opt/openldap/libexec/slapd'; + $ldap_schema_dir = '/opt/homebrew/etc/openldap/schema'; + } + elsif (-d '/usr/local/opt/openldap') + { + # typical paths for Homebrew on Intel + $slapd = '/usr/local/opt/openldap/libexec/slapd'; + $ldap_schema_dir = '/usr/local/etc/openldap/schema'; + } + elsif (-d '/opt/local/etc/openldap') + { + # typical paths for MacPorts + $slapd = '/opt/local/libexec/slapd'; + $ldap_schema_dir = '/opt/local/etc/openldap/schema'; + } + else + { + $setup_error = "OpenLDAP server installation not found"; + $setup = 0; + } } elsif ($^O eq 'linux') { - $slapd = '/usr/sbin/slapd'; - $ldap_schema_dir = '/etc/ldap/schema' if -d '/etc/ldap/schema'; - $ldap_schema_dir = '/etc/openldap/schema' - if -d '/etc/openldap/schema'; + if (-d '/etc/ldap/schema') + { + $slapd = '/usr/sbin/slapd'; + $ldap_schema_dir = '/etc/ldap/schema'; + } + elsif (-d '/etc/openldap/schema') + { + $slapd = '/usr/sbin/slapd'; + $ldap_schema_dir = '/etc/openldap/schema'; + } + else + { + $setup_error = "OpenLDAP server installation not found"; + $setup = 0; + } } elsif ($^O eq 'freebsd') { - $slapd = '/usr/local/libexec/slapd'; - $ldap_schema_dir = '/usr/local/etc/openldap/schema'; + if (-d '/usr/local/etc/openldap/schema') + { + $slapd = '/usr/local/libexec/slapd'; + $ldap_schema_dir = '/usr/local/etc/openldap/schema'; + } + else + { + $setup_error = "OpenLDAP server installation not found"; + $setup = 0; + } } elsif ($^O eq 'openbsd') { - $slapd = '/usr/local/libexec/slapd'; - $ldap_schema_dir = '/usr/local/share/examples/openldap/schema'; + if (-d '/usr/local/share/examples/openldap/schema') + { + $slapd = '/usr/local/libexec/slapd'; + $ldap_schema_dir = '/usr/local/share/examples/openldap/schema'; + } + else + { + $setup_error = "OpenLDAP server installation not found"; + $setup = 0; + } } else { + $setup_error = "ldap tests not supported on $^O"; $setup = 0; } } END { + # take care not to change the script's exit value + my $exit_code = $?; + foreach my $server (@servers) { next unless -f $server->{pidfile}; @@ -113,6 +155,8 @@ END chomp $pid; kill 'INT', $pid; } + + $? = $exit_code; } =pod diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl index 3e113fd..ef8ad17 100644 --- a/src/test/ldap/t/001_auth.pl +++ b/src/test/ldap/t/001_auth.pl @@ -25,8 +25,7 @@ elsif ($ENV{PG_TEST_EXTRA} !~ /\bldap\b/) } elsif (!$LdapServer::setup) { - plan skip_all => - "ldap tests not supported on $^O or dependencies not installed"; + plan skip_all => $LdapServer::setup_error; } note "setting up LDAP server"; diff --git a/src/test/ldap/t/002_bindpasswd.pl b/src/test/ldap/t/002_bindpasswd.pl index bcd4aa2..9242faf 100644 --- a/src/test/ldap/t/002_bindpasswd.pl +++ b/src/test/ldap/t/002_bindpasswd.pl @@ -25,8 +25,7 @@ elsif ($ENV{PG_TEST_EXTRA} !~ /\bldap\b/) } elsif (!$LdapServer::setup) { - plan skip_all => - "ldap tests not supported on $^O or dependencies not installed"; + plan skip_all => $LdapServer::setup_error; } note "setting up LDAP server"; |