summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-06-16 11:56:53 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-06-16 05:44:15 +0200
commitd1d36d2563685a71874e5d584662dfd8de9418a5 (patch)
tree2d93175cf8ae90d510950b6977301f9fbac06b7b
parentfa223eb26b07bba9e8055c35584886e6deb6e4a2 (diff)
downloadsamba-d1d36d2563685a71874e5d584662dfd8de9418a5.tar.gz
samba-d1d36d2563685a71874e5d584662dfd8de9418a5.tar.bz2
samba-d1d36d2563685a71874e5d584662dfd8de9418a5.zip
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@samba.org> Autobuild-Date(master): Sat Jun 16 05:44:15 CEST 2012 on sn-devel-104
-rwxr-xr-xsource4/selftest/tests.py2
-rwxr-xr-xtestprogs/blackbox/dbcheck-alpha13.sh42
2 files changed, 44 insertions, 0 deletions
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 8e868dc291..ece032568d 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 0000000000..00cb97a48f
--- /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