auth:creds: Return bool for cli_credentials_guess()
[Samba.git] / testprogs / blackbox / demote-saveddb.sh
blobd8fccf32011d36a8907c85414319bba47b050cd0
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: demote.sh PREFIX RELEASE
6 EOF
7 exit 1;
8 fi
10 PREFIX_ABS="$1"
11 shift 1
13 failed=0
15 . `dirname $0`/subunit.sh
16 . `dirname $0`/common_test_fns.inc
18 samba_tree_dir="$SRCDIR_ABS/source4/selftest/provisions/multi-dc-samba-master-c596ac6"
20 samba_tdbrestore="tdbrestore"
21 if [ -x $BINDIR/tdbrestore ]; then
22 samba_tdbrestore="$BINDIR/tdbrestore"
25 # The undump script and the provision data is not part of release tarballs,
26 # skip the tests in this case!
27 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
28 if [ ! -x $samba_undump ] || [ ! -d $samba_tree_dir ]; then
29 subunit_start_test "undump"
30 subunit_skip_test "undump" <<EOF
31 EOF
33 subunit_start_test "undump"
34 subunit_skip_test "undump" <<EOF
35 Skipping tests - no provision!
36 EOF
38 subunit_start_test "demote-q-0-0"
39 subunit_skip_test "demote-q-0-0" <<EOF
40 Skipping tests - no provision!
41 EOF
42 subunit_start_test "demote-q-0-1"
43 subunit_skip_test "demote-q-0-1" <<EOF
44 Skipping tests - no provision!
45 EOF
46 subunit_start_test "demote-q-1-0"
47 subunit_skip_test "demote-q-1-0" <<EOF
48 Skipping tests - no provision!
49 EOF
50 subunit_start_test "demote-q-1-1"
51 subunit_skip_test "demote-q-1-1" <<EOF
52 Skipping tests - no provision!
53 EOF
55 exit 0
58 undump() {
59 $SRCDIR_ABS/source4/selftest/provisions/undump.sh $samba_tree_dir $PREFIX_ABS $samba_tdbrestore
62 demote() {
63 $PYTHON $BINDIR/samba-tool domain demote -H tdb://$PREFIX_ABS/private/sam.ldb --remove-other-dead-server=$1
66 remove_directory $PREFIX_ABS
68 testit "undump" undump || failed=`expr $failed + 1`
69 testit "demote-q-0-0" demote "q-0-0" || failed=`expr $failed + 1`
70 # The database was copied of q-0-1 so this will fail
71 # as we can't remove our own name
72 testit_expect_failure "demote-q-0-1" demote "q-0-1" || failed=`expr $failed + 1`
73 testit "demote-q-1-0" demote "q-1-0" || failed=`expr $failed + 1`
74 testit "demote-q-1-1" demote "q-1-1" || failed=`expr $failed + 1`
76 remove_directory $PREFIX_ABS
78 exit $failed