r3742: make test-ldap give a sane error message when the openldap schema files are...
authorAndrew Tridgell <tridge@samba.org>
Mon, 15 Nov 2004 00:15:25 +0000 (00:15 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:49 +0000 (13:05 -0500)
and auto-link the files if they are found in /etc/ldap/schema/

source/lib/ldb/tests/test-ldap.sh

index 29b40ff4550c7661e8d003e5e6fd47b236aecc96..3e285a39a95bb29b588399a22dd8c81a780f1bc4 100755 (executable)
@@ -1,5 +1,24 @@
 #!/bin/sh
 
+SCHEMA_NEEDED="core nis cosine inetorgperson openldap"
+
+# setup needed schema files
+for f in $SCHEMA_NEEDED; do
+    if [ ! -r tests/schema/$f.schema ]; then
+       mkdir -p tests/schema
+       if [ -r /etc/ldap/schema/$f.schema ]; then
+           ln -s /etc/ldap/schema/$f.schema tests/schema/$f.schema
+           continue;
+       fi
+
+       echo "ERROR: you need the following OpenLDAP schema files in tests/schema/"
+       for f in $SCHEMA_NEEDED; do
+           echo "  $f.schema"
+       done
+       exit 1
+    fi
+done
+
 tests/init_slapd.sh
 tests/start_slapd.sh