1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/testprogs/blackbox/dbcheck-oldrelease.sh
Andrew Bartlett 08f0562240 selftest: Run dbcheck and improved upgrdeprovision tests against release-4-0-0
The improved upgradeprovision tests now call ldapcmp to verify the
changes made do actually bring the database in line with a fresh
provision.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-04 08:32:25 +01:00

66 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
if [ $# -lt 1 ]; then
cat <<EOF
Usage: dbcheck.sh PREFIX RELEASE
EOF
exit 1;
fi
PREFIX_ABS="$1"
RELEASE="$2"
shift 2
. `dirname $0`/subunit.sh
release_dir=`dirname $0`/../../source4/selftest/provisions/$RELEASE
undump() {
if test -x $BINDIR/tdbrestore;
then
`dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/$RELEASE $BINDIR/tdbrestore
else
`dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/$RELEASE
fi
}
reindex() {
$BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}/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/${RELEASE}/private/sam.ldb $@
}
# But having fixed it all up, this should pass
dbcheck_clean() {
$BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
}
if [ -d $release_dir ]; then
testit $RELEASE undump
testit "reindex" reindex
testit_expect_failure "dbcheck" dbcheck
testit "dbcheck_clean" dbcheck_clean
else
subunit_start_test $RELEASE
subunit_skip_test $RELEASE <<EOF
no test provision
EOF
subunit_start_test "reindex"
subunit_skip_test "reindex" <<EOF
no test provision
EOF
subunit_start_test "dbcheck"
subunit_skip_test "dbcheck" <<EOF
no test provision
EOF
subunit_start_test "dbcheck_clean"
subunit_skip_test "dbcheck_clean" <<EOF
no test provision
EOF
fi
exit $failed