Improve check in LDAP test to find the OpenLDAP installation
If the OpenLDAP installation directory is not found, set $setup to 0 so that the LDAP tests are skipped. The macOS checks were already doing that, but the checks on other OS's were not. While we're at it, improve the error message when the tests are skipped, to specify whether the OS is supported at all, or if we just didn't find the installation directory. This was accidentally "working" without this, i.e. we were skipping the tests if the OpenLDAP installation was not found, because of a bug in the LdapServer test module: the END block clobbered the exit code so if the script die()s before running the first subtest, the whole test script was marked as SKIPped. The next commit will fix that bug, but we need to fix the setup code first. These checks should probably go into configure/meson, but this is better than nothing and allows fixing the bug in the END block. Backpatch to all supported versions. Discussion: https://www.postgresql.org/message-id/fb898a70-3a88-4629-88e9-f2375020061d@iki.fi
This commit is contained in:
parent
f159f18141
commit
c8df46b657
@ -16,44 +16,77 @@ if ($ENV{with_ldap} ne 'yes')
|
|||||||
{
|
{
|
||||||
plan skip_all => 'LDAP not supported by this build';
|
plan skip_all => 'LDAP not supported by this build';
|
||||||
}
|
}
|
||||||
elsif ($^O eq 'darwin' && -d '/opt/homebrew/opt/openldap')
|
# Find the OpenLDAP server binary and directory containing schema
|
||||||
|
# definition files.
|
||||||
|
elsif ($^O eq 'darwin')
|
||||||
|
{
|
||||||
|
if (-d '/opt/homebrew/opt/openldap')
|
||||||
{
|
{
|
||||||
# typical paths for Homebrew on ARM
|
# typical paths for Homebrew on ARM
|
||||||
$slapd = '/opt/homebrew/opt/openldap/libexec/slapd';
|
$slapd = '/opt/homebrew/opt/openldap/libexec/slapd';
|
||||||
$ldap_schema_dir = '/opt/homebrew/etc/openldap/schema';
|
$ldap_schema_dir = '/opt/homebrew/etc/openldap/schema';
|
||||||
}
|
}
|
||||||
elsif ($^O eq 'darwin' && -d '/usr/local/opt/openldap')
|
elsif (-d '/usr/local/opt/openldap')
|
||||||
{
|
{
|
||||||
# typical paths for Homebrew on Intel
|
# typical paths for Homebrew on Intel
|
||||||
$slapd = '/usr/local/opt/openldap/libexec/slapd';
|
$slapd = '/usr/local/opt/openldap/libexec/slapd';
|
||||||
$ldap_schema_dir = '/usr/local/etc/openldap/schema';
|
$ldap_schema_dir = '/usr/local/etc/openldap/schema';
|
||||||
}
|
}
|
||||||
elsif ($^O eq 'darwin' && -d '/opt/local/etc/openldap')
|
elsif (-d '/opt/local/etc/openldap')
|
||||||
{
|
{
|
||||||
# typical paths for MacPorts
|
# typical paths for MacPorts
|
||||||
$slapd = '/opt/local/libexec/slapd';
|
$slapd = '/opt/local/libexec/slapd';
|
||||||
$ldap_schema_dir = '/opt/local/etc/openldap/schema';
|
$ldap_schema_dir = '/opt/local/etc/openldap/schema';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plan skip_all => "OpenLDAP server installation not found";
|
||||||
|
}
|
||||||
|
}
|
||||||
elsif ($^O eq 'linux')
|
elsif ($^O eq 'linux')
|
||||||
|
{
|
||||||
|
if (-d '/etc/ldap/schema')
|
||||||
{
|
{
|
||||||
$slapd = '/usr/sbin/slapd';
|
$slapd = '/usr/sbin/slapd';
|
||||||
$ldap_schema_dir = '/etc/ldap/schema' if -d '/etc/ldap/schema';
|
$ldap_schema_dir = '/etc/ldap/schema';
|
||||||
$ldap_schema_dir = '/etc/openldap/schema' if -d '/etc/openldap/schema';
|
}
|
||||||
|
elsif (-d '/etc/openldap/schema')
|
||||||
|
{
|
||||||
|
$slapd = '/usr/sbin/slapd';
|
||||||
|
$ldap_schema_dir = '/etc/openldap/schema';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plan skip_all => "OpenLDAP server installation not found";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ($^O eq 'freebsd')
|
elsif ($^O eq 'freebsd')
|
||||||
|
{
|
||||||
|
if (-d '/usr/local/etc/openldap/schema')
|
||||||
{
|
{
|
||||||
$slapd = '/usr/local/libexec/slapd';
|
$slapd = '/usr/local/libexec/slapd';
|
||||||
$ldap_schema_dir = '/usr/local/etc/openldap/schema';
|
$ldap_schema_dir = '/usr/local/etc/openldap/schema';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plan skip_all => "OpenLDAP server installation not found";
|
||||||
|
}
|
||||||
|
}
|
||||||
elsif ($^O eq 'openbsd')
|
elsif ($^O eq 'openbsd')
|
||||||
|
{
|
||||||
|
if (-d '/usr/local/share/examples/openldap/schema')
|
||||||
{
|
{
|
||||||
$slapd = '/usr/local/libexec/slapd';
|
$slapd = '/usr/local/libexec/slapd';
|
||||||
$ldap_schema_dir = '/usr/local/share/examples/openldap/schema';
|
$ldap_schema_dir = '/usr/local/share/examples/openldap/schema';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plan skip_all =>
|
plan skip_all => "OpenLDAP server installation not found";
|
||||||
"ldap tests not supported on $^O or dependencies not installed";
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plan skip_all => "ldap tests not supported on $^O";
|
||||||
}
|
}
|
||||||
|
|
||||||
# make your own edits here
|
# make your own edits here
|
||||||
|
Loading…
x
Reference in New Issue
Block a user