]> git.sur5r.net Git - openldap/commitdiff
works with IBM db2 as well; at this point the tsts are assumed to wok with any RDBMS...
authorPierangelo Masarati <ando@openldap.org>
Wed, 25 Aug 2004 11:28:14 +0000 (11:28 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 25 Aug 2004 11:28:14 +0000 (11:28 +0000)
tests/scripts/acfiltersort.sh [new file with mode: 0755]
tests/scripts/defines.sh
tests/scripts/ldifsort.awk [new file with mode: 0644]
tests/scripts/sql-test900-write

diff --git a/tests/scripts/acfiltersort.sh b/tests/scripts/acfiltersort.sh
new file mode 100755 (executable)
index 0000000..fe7b947
--- /dev/null
@@ -0,0 +1,18 @@
+#! /bin/sh
+# $OpenLDAP$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2004 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+#
+# Strip comments
+#
+egrep -iv '^#' | awk -f $LDIFSORT
index 2a4aca3887cb29b5c5474df2f72df1e061709ca6..ec2c62f8a95044c708c183a9554cc136d687e045 100755 (executable)
@@ -93,6 +93,8 @@ CLIENTDIR=../clients/tools
 
 LDIFFILTER=$SRCDIR/scripts/acfilter.sh
 CONFFILTER=$SRCDIR/scripts/conf.sh
+LDIFFILTERSORT=$SRCDIR/scripts/acfiltersort.sh
+LDIFSORT=$SRCDIR/scripts/ldifsort.awk
 
 SLAPADD="../servers/slapd/slapd -Ta $LDAP_VERBOSE"
 SLAPCAT="../servers/slapd/slapd -Tc $LDAP_VERBOSE"
diff --git a/tests/scripts/ldifsort.awk b/tests/scripts/ldifsort.awk
new file mode 100644 (file)
index 0000000..5e8f9f6
--- /dev/null
@@ -0,0 +1,51 @@
+# Parses LDIF files, eliminating contnuations, and sorts
+# Author: Pierangelo Masarati <ando@sys-net.it>
+
+func parse_line( line ) {
+       getline;
+
+       while ($0 != "") {
+               c = substr($0, 1, 1);
+               if (c == "#") {
+                       continue;
+               }
+               if (c != " ") {
+                       break;
+               }
+
+               line = line substr($0, 2, length($0));
+
+               getline;
+       }
+
+       return line;
+}
+
+/^dn: / {
+       /* FIXME: works only if DN is on one line... */
+       dn = $0;
+       dn = parse_line(dn);
+
+       while (1) {
+               if ($0 == "") {
+                       break;
+               }
+               line = $0;
+               line = parse_line(line);
+               attrs[line] = line
+       }
+
+       entry[dn] = dn "\n";
+       n = asort(attrs);
+       for (i = 1; i <= n; i++) {
+               entry[dn] = entry[dn] attrs[i] "\n"
+       }
+       delete attrs
+}
+
+END {
+       n = asort(entry);
+       for (i = 1; i <= n; i++) {
+               print entry[i];
+       }
+}
index c225490f52f0323f4ba2999ecfd78c575e56c4dd..bb85af0f83a1eb4b89a2d56a7314b9b89d061d68 100755 (executable)
@@ -315,9 +315,9 @@ EOMODS
        fi
 
        echo "Filtering ldapsearch results..."
-       . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+       . $LDIFFILTERSORT < $SEARCHOUT > $SEARCHFLT
        echo "Filtering modified ldif..."
-       . $LDIFFILTER < $SQLWRITE > $LDIFFLT
+       . $LDIFFILTERSORT < $SQLWRITE > $LDIFFLT
        echo "Comparing filter output..."
        $CMP $SEARCHFLT $LDIFFLT > $CMPOUT