summaryrefslogtreecommitdiffstats
path: root/src/test/ldap/t
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ldap/t')
-rw-r--r--src/test/ldap/t/001_auth.pl88
1 files changed, 63 insertions, 25 deletions
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 2a7435e..3dd56e9 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -16,44 +16,77 @@ if ($ENV{with_ldap} ne 'yes')
{
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')
{
- # 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
+ {
+ plan skip_all => "OpenLDAP server installation not found";
+ }
}
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
+ {
+ plan skip_all => "OpenLDAP server installation not found";
+ }
}
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
+ {
+ plan skip_all => "OpenLDAP server installation not found";
+ }
}
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
+ {
+ plan skip_all => "OpenLDAP server installation not found";
+ }
}
else
{
- plan skip_all =>
- "ldap tests not supported on $^O or dependencies not installed";
+ plan skip_all => "ldap tests not supported on $^O";
}
# make your own edits here
@@ -130,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);