From f051181042ef144cbd21b56d79953e6753e5ffea Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 5 Feb 2003 14:42:37 +0000 Subject: [PATCH] this will likely fix the problem with partial replication --- tests/scripts/defines.sh | 1 + tests/scripts/stripattr.sh | 5 +++++ tests/scripts/test011-subtree-repl | 12 ++++++++---- tests/scripts/undiff.sh | 8 +++----- 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100755 tests/scripts/stripattr.sh diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh index 236952098c..645024ba42 100755 --- a/tests/scripts/defines.sh +++ b/tests/scripts/defines.sh @@ -35,6 +35,7 @@ LDIFFILTER=$SRCDIR/scripts/acfilter.sh SUBFILTER=$SRCDIR/scripts/subfilter.sh UNDIFFFILTER=$SRCDIR/scripts/undiff.sh CONFFILTER=$SRCDIR/scripts/conf.sh +STRIPATTR=$SRCDIR/scripts/stripattr.sh SLAPADD="../servers/slapd/tools/slapadd $LDAP_VERBOSE" SLAPCAT="../servers/slapd/tools/slapcat $LDAP_VERBOSE" diff --git a/tests/scripts/stripattr.sh b/tests/scripts/stripattr.sh new file mode 100755 index 0000000000..5645e029b3 --- /dev/null +++ b/tests/scripts/stripattr.sh @@ -0,0 +1,5 @@ +#! /bin/sh +# +# Strip attribute from LDIF +# +awk '/^'$1'/ {getline; while (substr($0,1,1) == " ") getline;} /.*/ {print $0}' diff --git a/tests/scripts/test011-subtree-repl b/tests/scripts/test011-subtree-repl index e26941f008..3089ba0779 100755 --- a/tests/scripts/test011-subtree-repl +++ b/tests/scripts/test011-subtree-repl @@ -134,6 +134,10 @@ member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=Univer add: member member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US +- +replace: description +description: A very long description, that is very likely to cause line wrapping in a LDIF file +- dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US changetype: modify @@ -224,7 +228,7 @@ SEARCHOUT=$SUBMASTEROUT LDIF=$SLAVEOUT echo "Filtering master ldapsearch results..." -. $LDIFFILTER < $SEARCHOUT | egrep -iv ^description > $SEARCHFLT +. $LDIFFILTER < $SEARCHOUT | $STRIPATTR "description" > $SEARCHFLT echo "Filtering slave ldapsearch results..." . $LDIFFILTER < $LDIF > $LDIFFLT @@ -239,14 +243,14 @@ fi SEARCHOUT=$MASTEROUT echo "Filtering remaining data" -. $LDIFFILTER < $SEARCHOUT | egrep -iv ^description > $SEARCHFLT +. $LDIFFILTER < $SEARCHOUT | $STRIPATTR "description" > $SEARCHFLT echo "Stripping slave entries from master output..." -$CMP $SEARCHFLT $LDIFFLT | $UNDIFFFILTER > $SUBFLT +$DIFF $SEARCHFLT $LDIFFLT | $UNDIFFFILTER > $SUBFLT echo "Stripping subtree entries from master output..." . $SUBFILTER 'ou=Groups,[ ]?o=University of Michigan,[ ]?c=US' < $SEARCHOUT \ - | $UNDIFFFILTER | egrep -iv ^description > $SUBFLT2 + | $STRIPATTR "description" > $SUBFLT2 echo "Comparing master minus subtree and master minus slave..." $CMP $SUBFLT $SUBFLT2 > $CMPOUT diff --git a/tests/scripts/undiff.sh b/tests/scripts/undiff.sh index cb9e13caf5..a4539938d6 100755 --- a/tests/scripts/undiff.sh +++ b/tests/scripts/undiff.sh @@ -1,8 +1,6 @@ #! /bin/sh # -# Expunge "< " and "> " resulting from diff +# Expunge extra stuff resulting from diff -u +# strip everything, including leading '-', except leading '+' to force errors # -awk '!/^[0-9]/ {print $0}' | \ - sed "s/^< \|^> \|^- \|^+ //" | \ - awk '/.+/ {print $0}' - +awk '/^-/ {if (substr($0,1,3) != "---") print substr($0,2,length($0))} /^+/ {if (substr($0,1,3) != "+++") print $0}' -- 2.39.5