mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
testprogs: Fix and improve demote-saveddb test
This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
parent
3770f28c62
commit
e58ccdaa1a
@ -10,58 +10,69 @@ fi
|
||||
PREFIX_ABS="$1"
|
||||
shift 1
|
||||
|
||||
. `dirname $0`/subunit.sh
|
||||
failed=0
|
||||
|
||||
tree_dir=`dirname $0`/../../source4/selftest/provisions/multi-dc-samba-master-c596ac6
|
||||
. `dirname $0`/subunit.sh
|
||||
. `dirname $0`/common_test_fns.inc
|
||||
|
||||
samba_tree_dir="$SRCDIR_ABS/source4/selftest/provisions/multi-dc-samba-master-c596ac6"
|
||||
|
||||
samba_tdbrestore="tdbrestore"
|
||||
if [ -x $BINDIR/tdbrestore ]; then
|
||||
samba_tdbrestore="$BINDIR/tdbrestore"
|
||||
fi
|
||||
|
||||
# The undump script and the provision data is not part of release tarballs,
|
||||
# skip the tests in this case!
|
||||
samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
|
||||
if [ ! -x $samba_undump ] || [ ! -d $samba_tree_dir ]; then
|
||||
subunit_start_test "undump"
|
||||
subunit_skip_test "undump" <<EOF
|
||||
EOF
|
||||
|
||||
subunit_start_test "undump"
|
||||
subunit_skip_test "undump" <<EOF
|
||||
Skipping tests - no provision!
|
||||
EOF
|
||||
|
||||
subunit_start_test "demote-q-0-0"
|
||||
subunit_skip_test "demote-q-0-0" <<EOF
|
||||
Skipping tests - no provision!
|
||||
EOF
|
||||
subunit_start_test "demote-q-0-1"
|
||||
subunit_skip_test "demote-q-0-1" <<EOF
|
||||
Skipping tests - no provision!
|
||||
EOF
|
||||
subunit_start_test "demote-q-1-0"
|
||||
subunit_skip_test "demote-q-1-0" <<EOF
|
||||
Skipping tests - no provision!
|
||||
EOF
|
||||
subunit_start_test "demote-q-1-1"
|
||||
subunit_skip_test "demote-q-1-1" <<EOF
|
||||
Skipping tests - no provision!
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
undump() {
|
||||
if test -x $BINDIR/tdbrestore;
|
||||
then
|
||||
`dirname $0`/../../source4/selftest/provisions/undump.sh $tree_dir $PREFIX_ABS $BINDIR/tdbrestore
|
||||
else
|
||||
`dirname $0`/../../source4/selftest/provisions/undump.sh $tree_dir $PREFIX_ABS
|
||||
fi
|
||||
$SRCDIR_ABS/source4/selftest/provisions/undump.sh $samba_tree_dir $PREFIX_ABS $samba_tdbrestore
|
||||
}
|
||||
|
||||
demote() {
|
||||
$PYTHON $BINDIR/samba-tool domain demote -H tdb://$PREFIX_ABS/private/sam.ldb --remove-other-dead-server=$1
|
||||
}
|
||||
|
||||
remove_directory $PREFIX_ABS
|
||||
|
||||
if [ -d $tree_dir ]; then
|
||||
testit "undump" undump
|
||||
testit "demote-q-0-0" demote "q-0-0"
|
||||
# The database was copied of q-0-1 so this will fail
|
||||
# as we can't remove our own name
|
||||
testit_expect_failure "demote-q-0-1" demote "q-0-1"
|
||||
testit "demote-q-1-0" demote "q-1-0"
|
||||
testit "demote-q-1-1" demote "q-1-1"
|
||||
else
|
||||
subunit_start_test "undump"
|
||||
subunit_skip_test "undump" <<EOF
|
||||
no test provision
|
||||
EOF
|
||||
testit "undump" undump || failed=`expr $failed + 1`
|
||||
testit "demote-q-0-0" demote "q-0-0" || failed=`expr $failed + 1`
|
||||
# The database was copied of q-0-1 so this will fail
|
||||
# as we can't remove our own name
|
||||
testit_expect_failure "demote-q-0-1" demote "q-0-1" || failed=`expr $failed + 1`
|
||||
testit "demote-q-1-0" demote "q-1-0" || failed=`expr $failed + 1`
|
||||
testit "demote-q-1-1" demote "q-1-1" || failed=`expr $failed + 1`
|
||||
|
||||
subunit_start_test "demote-q-0-0"
|
||||
subunit_skip_test "demote-q-0-0" <<EOF
|
||||
no test provision
|
||||
EOF
|
||||
subunit_start_test "demote-q-0-1"
|
||||
subunit_skip_test "demote-q-0-1" <<EOF
|
||||
no test provision
|
||||
EOF
|
||||
subunit_start_test "demote-q-1-1"
|
||||
subunit_skip_test "demote-q-0-1" <<EOF
|
||||
no test provision
|
||||
EOF
|
||||
subunit_start_test "demote-q-1-1"
|
||||
subunit_skip_test "demote-q-1-1" <<EOF
|
||||
no test provision
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ -d $PREFIX_ABS ]; then
|
||||
rm -fr $PREFIX_ABS
|
||||
fi
|
||||
remove_directory $PREFIX_ABS
|
||||
|
||||
exit $failed
|
||||
|
Loading…
Reference in New Issue
Block a user