g_lock: Fix uninitalized variable reads
[Samba.git] / testprogs / blackbox / functionalprep.sh
bloba5ac4b8bc7f5e8e80eaacd0571eb62ef946db623
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: $0 PREFIX
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 RELEASE="release-4-8-0-pre1"
19 release_dir="$SRCDIR_ABS/source4/selftest/provisions/$RELEASE"
21 OLD_RELEASE="release-4-1-0rc3"
22 old_release_dir="$SRCDIR_ABS/source4/selftest/provisions/$OLD_RELEASE"
24 samba_tdbrestore="tdbrestore"
25 if [ -x "$BINDIR/tdbrestore" ]; then
26 samba_tdbrestore="$BINDIR/tdbrestore"
29 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
31 if [ ! -x $samba_undump ] || [ ! -d $release_dir ] || [ ! -d $old_release_dir ]; then
32 subunit_start_test $RELEASE
33 subunit_skip_test $RELEASE <<EOF
34 no test provision
35 EOF
37 subunit_start_test "functional_prep"
38 subunit_skip_test "functional_prep" <<EOF
39 no test provision
40 EOF
42 subunit_start_test "functional_prep_old"
43 subunit_skip_test "functional_prep_old" <<EOF
44 no test provision
45 EOF
47 exit 0
50 cleanup_output_directories()
52 remove_directory $PREFIX_ABS/2012R2_schema
53 remove_directory $PREFIX_ABS/$RELEASE
54 remove_directory $PREFIX_ABS/$OLD_RELEASE
57 undump() {
58 $samba_undump $release_dir $PREFIX_ABS/$RELEASE $samba_tdbrestore
61 undump_old() {
62 $samba_undump $old_release_dir $PREFIX_ABS/$OLD_RELEASE $samba_tdbrestore
66 PROVISION_OPTS="--use-ntvfs --host-ip6=::1 --host-ip=127.0.0.1"
68 provision_2012r2() {
69 $PYTHON $BINDIR/samba-tool domain provision $PROVISION_OPTS --domain=REALM --realm=REALM.COM --targetdir=$PREFIX_ABS/2012R2_schema --base-schema=2012_R2 --host-name=FLPREP
72 ldapcmp_ignore() {
73 # At some point we will need to ignore, but right now, it should be perfect
74 IGNORE_ATTRS=$1
75 $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2/private/sam.ldb tdb://$PREFIX_ABS/$3/private/sam.ldb --two --skip-missing-dn --filter msDS-SupportedEncryptionTypes
78 ldapcmp() {
79 # Our functional prep doesn't set these values as they were not provided
80 # These are XML schema based enumerations which are used for claims
81 ldapcmp_ignore "msDS-ClaimPossibleValues" "$RELEASE" "2012R2_schema"
84 functional_prep() {
85 $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/2012R2_schema/private/sam.ldb --function-level=2012_R2
88 functional_prep_old() {
89 $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/$OLD_RELEASE/private/sam.ldb --function-level=2012_R2
92 steal_roles() {
93 # Must steal schema master and infrastructure roles first
94 $PYTHON $BINDIR/samba-tool fsmo seize --role=schema -H tdb://$PREFIX_ABS/$OLD_RELEASE/private/sam.ldb --force
95 $PYTHON $BINDIR/samba-tool fsmo seize --role=infrastructure -H tdb://$PREFIX_ABS/$OLD_RELEASE/private/sam.ldb --force
98 schema_upgrade() {
99 $PYTHON $BINDIR/samba-tool domain schemaupgrade -H tdb://$PREFIX_ABS/$OLD_RELEASE/private/sam.ldb --schema=2012_R2
102 # double-check we cleaned up from the last test run
103 cleanup_output_directories
105 testit $RELEASE undump || failed=`expr $failed + 1`
107 # Provision a DC based on 2012R2 schema
108 testit "provision_2012R2_schema" provision_2012r2 || failed=`expr $failed + 1`
110 # Perform functional prep up to 2012 R2 level
111 testit "functional_prep" functional_prep || failed=`expr $failed + 1`
113 # check that the databases are now the same
114 testit "check_databases_same" ldapcmp || failed=`expr $failed + 1`
116 testit $OLD_RELEASE undump_old || failed=`expr $failed + 1`
118 testit "steal_roles" steal_roles || failed=`expr $failed + 1`
120 testit "schema_upgrade" schema_upgrade || failed=`expr $failed + 1`
122 testit "functional_prep_old" functional_prep_old || failed=`expr $failed + 1`
124 cleanup_output_directories
126 exit $failed