[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Jun 15 21:45:03 MDT 2012


The branch, master has been updated
       via  d1d36d2 s4-selftest: Add tests for dbcheck on an old database that needs repair
       via  fa223eb s4-dbcheck: Always specify the dhcheck control
       via  72953b1 selftest: Add targetdir and tdbrestore parameters to undump.sh
      from  7a723c6 build: Remove support for non-64bit sendfile()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d1d36d2563685a71874e5d584662dfd8de9418a5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 16 11:56:53 2012 +1000

    s4-selftest: Add tests for dbcheck on an old database that needs repair
    
    We changed a lot since alpha13, so there are lots of legitimate errors to fix.
    
    Andrew Bartlett
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Sat Jun 16 05:44:15 CEST 2012 on sn-devel-104

commit fa223eb26b07bba9e8055c35584886e6deb6e4a2
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 16 11:51:22 2012 +1000

    s4-dbcheck: Always specify the dhcheck control
    
    This will then allow us to make schema modifications, overriding the default ban.
    
    Andrew Bartlett

commit 72953b1eb8fa42257c7f8eff603e04c953fac361
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 16 11:06:59 2012 +1000

    selftest: Add targetdir and tdbrestore parameters to undump.sh

-----------------------------------------------------------------------

Summary of changes:
 source4/scripting/python/samba/dbchecker.py |    1 +
 source4/selftest/provisions/undump.sh       |   27 ++++++++++++++---
 source4/selftest/tests.py                   |    2 +
 testprogs/blackbox/dbcheck-alpha13.sh       |   42 +++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 5 deletions(-)
 create mode 100755 testprogs/blackbox/dbcheck-alpha13.sh


Changeset truncated at 500 lines:

diff --git a/source4/scripting/python/samba/dbchecker.py b/source4/scripting/python/samba/dbchecker.py
index 95be1ce..72d0604 100644
--- a/source4/scripting/python/samba/dbchecker.py
+++ b/source4/scripting/python/samba/dbchecker.py
@@ -118,6 +118,7 @@ class dbcheck(object):
         if self.verbose:
             self.report(self.samdb.write_ldif(m, ldb.CHANGETYPE_MODIFY))
         try:
+            controls = controls + ["local_oid:%s:0" % dsdb.DSDB_CONTROL_DBCHECK]
             self.samdb.modify(m, controls=controls, validate=validate)
         except Exception, err:
             self.report("%s : %s" % (msg, err))
diff --git a/source4/selftest/provisions/undump.sh b/source4/selftest/provisions/undump.sh
index 07408b7..7ffea3e 100755
--- a/source4/selftest/provisions/undump.sh
+++ b/source4/selftest/provisions/undump.sh
@@ -1,18 +1,35 @@
 #!/bin/sh
 # undump a provision directory
 
-[ "$#" -eq 1 ] || {
-    echo "Usage: undump.sh <DIRECTORY>"
+[ "$#" -gt 0 ] || {
+    echo "Usage: undump.sh <DIRECTORY> [TARGETDIR] [TDBRESTORE]"
     exit 1
 }
+
+TDBRESTORE=tdbrestore
+[ "$#" -lt 3 ] || {
+    TDBRESTORE=$3
+}
+
+
 dirbase="$1"
-for f in $(find $dirbase -name '*.dump'); do
-    dname=$(dirname $f)
+
+TARGETDIR=`pwd`/$dirbase
+
+cd $dirbase
+
+[ "$#" -lt 2 ] || {
+    TARGETDIR=$2
+}
+
+for f in $(find . -name '*.dump'); do
+    dname=$TARGETDIR/$(dirname $f)
+    mkdir -p $dname
     bname=$(basename $f .dump)
     outname=$dname/$bname
     echo "Restoring $outname"
     rm -f $outname
-    bin/tdbrestore $outname < $f || {
+    $TDBRESTORE $outname < $f || {
 	echo "Failed to restore $outname"
 	exit 1
     }
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 8e868dc..ece0325 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -463,6 +463,8 @@ for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
         # isn't available on DCs with Windows 2000 domain function level -
         # therefore skip it in that configuration
         plantestsuite("samba4.ldap.passwords.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/passwords.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN"])
+
+plantestsuite("samba4.blackbox.dbcheck.alpha13", "none" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-alpha13.sh"), '$PREFIX_ABS/provision', configuration])
 planpythontestsuite("dc:local", "samba.tests.upgradeprovisionneeddc")
 planpythontestsuite("none", "samba.tests.upgradeprovision")
 planpythontestsuite("none", "samba.tests.xattr")
diff --git a/testprogs/blackbox/dbcheck-alpha13.sh b/testprogs/blackbox/dbcheck-alpha13.sh
new file mode 100755
index 0000000..00cb97a
--- /dev/null
+++ b/testprogs/blackbox/dbcheck-alpha13.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+cat <<EOF
+Usage: dbcheck.sh PREFIX
+EOF
+exit 1;
+fi
+
+PREFIX_ABS="$1"
+shift 1
+
+. `dirname $0`/subunit.sh
+
+alpha13() {
+       if test -x $BINDIR/tdbrestore;
+       then
+	`dirname $0`/../../source4/selftest/provisions/undump.sh `dirname $0`/../../source4/selftest/provisions/alpha13 $PREFIX_ABS/alpha13 $BINDIR/tdbrestore
+       else 
+	`dirname $0`/../../source4/selftest/provisions/undump.sh `dirname $0`/../../source4/selftest/provisions/alpha13 $PREFIX_ABS/alpha13
+       fi
+}
+
+reindex() {
+       $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/alpha13/private/sam.ldb $@
+}
+
+# This should 'fail', because it returns the number of modified records
+dbcheck() {
+       $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/alpha13/private/sam.ldb $@
+}
+# But having fixed it all up, this should pass
+dbcheck_clean() {
+       $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/alpha13/private/sam.ldb $@
+}
+
+testit "alpha13" alpha13
+testit "reindex" reindex
+testit_expect_failure "dbcheck" dbcheck
+testit "dbcheck_clean" dbcheck_clean
+
+exit $failed


-- 
Samba Shared Repository


More information about the samba-cvs mailing list