WHATSNEW: SMB3 Directory Leases
[Samba.git] / testprogs / blackbox / demote-saveddb.sh
blob4af9e977e0000ee0bf7c6f918c0500fdd388b14d
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: demote-saveddb.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=$(system_or_builddir_binary tdbrestore "${BINDIR}")
22 # The undump script and the provision data is not part of release tarballs,
23 # skip the tests in this case!
24 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
25 if [ ! -x $samba_undump ] || [ ! -d $samba_tree_dir ]; then
26 subunit_start_test "undump"
27 subunit_skip_test "undump" <<EOF
28 EOF
30 subunit_start_test "undump"
31 subunit_skip_test "undump" <<EOF
32 Skipping tests - no provision!
33 EOF
35 subunit_start_test "demote-q-0-0"
36 subunit_skip_test "demote-q-0-0" <<EOF
37 Skipping tests - no provision!
38 EOF
39 subunit_start_test "demote-q-0-1"
40 subunit_skip_test "demote-q-0-1" <<EOF
41 Skipping tests - no provision!
42 EOF
43 subunit_start_test "demote-q-1-0"
44 subunit_skip_test "demote-q-1-0" <<EOF
45 Skipping tests - no provision!
46 EOF
47 subunit_start_test "demote-q-1-1"
48 subunit_skip_test "demote-q-1-1" <<EOF
49 Skipping tests - no provision!
50 EOF
52 exit 0
55 undump()
57 $SRCDIR_ABS/source4/selftest/provisions/undump.sh $samba_tree_dir $PREFIX_ABS $samba_tdbrestore
60 demote()
62 $PYTHON $BINDIR/samba-tool domain demote -H tdb://$PREFIX_ABS/private/sam.ldb --remove-other-dead-server=$1
65 remove_directory $PREFIX_ABS
67 testit "undump" undump || failed=$(expr $failed + 1)
68 testit "demote-q-0-0" demote "q-0-0" || failed=$(expr $failed + 1)
69 # The database was copied of q-0-1 so this will fail
70 # as we can't remove our own name
71 testit_expect_failure "demote-q-0-1" demote "q-0-1" || failed=$(expr $failed + 1)
72 testit "demote-q-1-0" demote "q-1-0" || failed=$(expr $failed + 1)
73 testit "demote-q-1-1" demote "q-1-1" || failed=$(expr $failed + 1)
75 remove_directory $PREFIX_ABS
77 exit $failed