heimdal_build: Improve error and warning handling on old and new compilers
[samba.git] / source4 / setup / tests / blackbox_upgradeprovision.sh
1 #!/bin/sh
2
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: blackbox_upgradeprovision.sh PREFIX
6 EOF
7 exit 1;
8 fi
9
10 PREFIX="$1"
11 shift 1
12
13 . `dirname $0`/../../../testprogs/blackbox/subunit.sh
14
15 [ ! -d $PREFIX ] && mkdir $PREFIX
16
17 upgradeprovision_reference() {
18   if [ -d $PREFIX/upgradeprovision_reference ]; then
19     rm -fr $PREFIX/upgradeprovision_reference
20   fi
21         $PYTHON $BINDIR/samba-tool domain provision --host-name=bar --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/upgradeprovision_reference" --server-role="dc" --use-ntvfs --base-schema=2008_R2
22 }
23
24 upgradeprovision() {
25   if [ -d $PREFIX/upgradeprovision ]; then
26     rm -fr $PREFIX/upgradeprovision
27   fi
28         $PYTHON $BINDIR/samba-tool domain provision --host-name=bar --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/upgradeprovision" --server-role="dc" --use-ntvfs --base-schema=2008_R2
29         $PYTHON $BINDIR/samba_upgradeprovision --configfile="$PREFIX/upgradeprovision/etc/smb.conf" --debugchange
30 }
31
32 upgradeprovision_full() {
33   if [ -d $PREFIX/upgradeprovision_full ]; then
34     rm -fr $PREFIX/upgradeprovision_full
35   fi
36         $PYTHON $BINDIR/samba-tool domain provision --host-name=bar --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/upgradeprovision_full" --server-role="dc" --use-ntvfs --base-schema=2008_R2
37         $PYTHON $BINDIR/samba_upgradeprovision --configfile="$PREFIX/upgradeprovision_full/etc/smb.conf" --full --debugchange
38 }
39
40 # The ldapcmp runs here are to ensure that a 'null' run of
41 # upgradeprovision (because we did a provision with the same template)
42 # really doesn't change anything.
43
44 ldapcmp() {
45         $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --skip-missing-dn
46 }
47
48 ldapcmp_full() {
49         $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision_full/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --skip-missing-dn
50 }
51
52 ldapcmp_sd() {
53         $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --sd --skip-missing-dn
54 }
55
56 ldapcmp_full_sd() {
57         $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision_full/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --sd --skip-missing-dn
58 }
59
60 testit "upgradeprovision" upgradeprovision
61 testit "upgradeprovision_full" upgradeprovision_full
62 testit "upgradeprovision_reference" upgradeprovision_reference
63 testit "ldapcmp" ldapcmp
64 testit "ldapcmp_full" ldapcmp_full
65 testit "ldapcmp_sd" ldapcmp_sd
66 testit "ldapcmp_full_sd" ldapcmp_full_sd
67
68 if [ -d $PREFIX/upgradeprovision ]; then
69   rm -fr $PREFIX/upgradeprovision
70 fi
71
72 if [ -d $PREFIX/upgradeprovision_full ]; then
73   rm -fr $PREFIX/upgradeprovision_full
74 fi
75
76 if [ -d $PREFIX/upgradeprovision_reference ]; then
77   rm -fr $PREFIX/upgradeprovision_reference
78 fi
79
80 exit $failed