diff options
-rw-r--r-- | selftest/tests.py | 6 | ||||
-rwxr-xr-x | testprogs/blackbox/dbcheck-oldrelease.sh (renamed from testprogs/blackbox/dbcheck-alpha13.sh) | 43 | ||||
-rwxr-xr-x | testprogs/blackbox/upgradeprovision-alpha13.sh | 166 | ||||
-rwxr-xr-x | testprogs/blackbox/upgradeprovision-oldrelease.sh | 203 |
4 files changed, 229 insertions, 189 deletions
diff --git a/selftest/tests.py b/selftest/tests.py index 03bedfcad6..9a59e9d0db 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -45,8 +45,10 @@ planpythontestsuite("none", "samba.tests.hostconfig") planpythontestsuite("none", "samba.tests.messaging") planpythontestsuite("none", "samba.tests.samba3sam") planpythontestsuite("none", "wafsamba.tests.test_suite", extra_path=[os.path.join(samba4srcdir, "..", "buildtools"), os.path.join(samba4srcdir, "..", "buildtools", "wafadmin")]) -plantestsuite("samba4.blackbox.dbcheck.alpha13", "none" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-alpha13.sh"), '$PREFIX_ABS/provision', configuration]) -plantestsuite("samba4.blackbox.upgradeprovision.alpha13", "none" , ["PYTHON=%s" % python, os.path.join(bbdir, "upgradeprovision-alpha13.sh"), '$PREFIX_ABS/provision', configuration]) +plantestsuite("samba4.blackbox.dbcheck.alpha13", "none" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"), '$PREFIX_ABS/provision', 'alpha13', configuration]) +plantestsuite("samba4.blackbox.dbcheck.release-4-0-0", "none" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"), '$PREFIX_ABS/provision', 'release-4-0-0', configuration]) +plantestsuite("samba4.blackbox.upgradeprovision.alpha13", "none" , ["PYTHON=%s" % python, os.path.join(bbdir, "upgradeprovision-oldrelease.sh"), '$PREFIX_ABS/provision', 'alpha13', configuration]) +plantestsuite("samba4.blackbox.upgradeprovision.release-4-0-0", "none" , ["PYTHON=%s" % python, os.path.join(bbdir, "upgradeprovision-oldrelease.sh"), '$PREFIX_ABS/provision', 'release-4-0-0', configuration]) planpythontestsuite("none", "samba.tests.upgradeprovision") planpythontestsuite("none", "samba.tests.xattr") planpythontestsuite("none", "samba.tests.ntacls") diff --git a/testprogs/blackbox/dbcheck-alpha13.sh b/testprogs/blackbox/dbcheck-oldrelease.sh index a028116075..6032bbc985 100755 --- a/testprogs/blackbox/dbcheck-alpha13.sh +++ b/testprogs/blackbox/dbcheck-oldrelease.sh @@ -2,62 +2,63 @@ if [ $# -lt 1 ]; then cat <<EOF -Usage: dbcheck.sh PREFIX +Usage: dbcheck.sh PREFIX RELEASE EOF exit 1; fi PREFIX_ABS="$1" -shift 1 +RELEASE="$2" +shift 2 . `dirname $0`/subunit.sh -alpha13_dir=`dirname $0`/../../source4/selftest/provisions/alpha13 +release_dir=`dirname $0`/../../source4/selftest/provisions/$RELEASE -alpha13() { +undump() { if test -x $BINDIR/tdbrestore; then - `dirname $0`/../../source4/selftest/provisions/undump.sh $alpha13_dir $PREFIX_ABS/alpha13 $BINDIR/tdbrestore - else - `dirname $0`/../../source4/selftest/provisions/undump.sh $alpha13_dir $PREFIX_ABS/alpha13 + `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/$RELEASE $BINDIR/tdbrestore + else + `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/$RELEASE fi } reindex() { - $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/alpha13/private/sam.ldb $@ + $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@ } # This should 'fail', because it returns the number of modified records dbcheck() { - $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/alpha13/private/sam.ldb $@ + $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@ } # But having fixed it all up, this should pass dbcheck_clean() { - $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/alpha13/private/sam.ldb $@ + $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@ } -if [ -d $alpha13_dir ]; then - testit "alpha13" alpha13 +if [ -d $release_dir ]; then + testit $RELEASE undump testit "reindex" reindex testit_expect_failure "dbcheck" dbcheck testit "dbcheck_clean" dbcheck_clean else - subunit_start_test "alpha13" - subunit_skip_test "alpha13" <<EOF -no test provision + subunit_start_test $RELEASE + subunit_skip_test $RELEASE <<EOF +no test provision EOF subunit_start_test "reindex" - subunit_skip_test "reindex" <<EOF -no test provision + subunit_skip_test "reindex" <<EOF +no test provision EOF subunit_start_test "dbcheck" - subunit_skip_test "dbcheck" <<EOF -no test provision + subunit_skip_test "dbcheck" <<EOF +no test provision EOF subunit_start_test "dbcheck_clean" - subunit_skip_test "dbcheck_clean" <<EOF -no test provision + subunit_skip_test "dbcheck_clean" <<EOF +no test provision EOF fi diff --git a/testprogs/blackbox/upgradeprovision-alpha13.sh b/testprogs/blackbox/upgradeprovision-alpha13.sh deleted file mode 100755 index 16731b1077..0000000000 --- a/testprogs/blackbox/upgradeprovision-alpha13.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/sh - -if [ $# -lt 1 ]; then -cat <<EOF -Usage: dbcheck.sh PREFIX -EOF -exit 1; -fi - -PREFIX_ABS="$1" -shift 1 - -. `dirname $0`/subunit.sh - -alpha13_dir=`dirname $0`/../../source4/selftest/provisions/alpha13 - -alpha13() { - if test -x $BINDIR/tdbrestore; - then - `dirname $0`/../../source4/selftest/provisions/undump.sh $alpha13_dir $PREFIX_ABS/alpha13_upgrade $BINDIR/tdbrestore - `dirname $0`/../../source4/selftest/provisions/undump.sh $alpha13_dir $PREFIX_ABS/alpha13_upgrade_full $BINDIR/tdbrestore - else - `dirname $0`/../../source4/selftest/provisions/undump.sh $alpha13_dir $PREFIX_ABS/alpha13_upgrade - `dirname $0`/../../source4/selftest/provisions/undump.sh $alpha13_dir $PREFIX_ABS/alpha13_upgrade_full - fi - cp -a $alpha13_dir/private/*.keytab $PREFIX_ABS/alpha13_upgrade/private/ - cp -a $alpha13_dir/sysvol $PREFIX_ABS/alpha13_upgrade/ - mkdir $PREFIX_ABS/alpha13_upgrade/etc/ - cat $alpha13_dir/etc/smb.conf.template | \ - sed "s|@@PREFIX@@|$PREFIX_ABS/alpha13_upgrade|g" \ - > $PREFIX_ABS/alpha13_upgrade/etc/smb.conf - - cp -a $alpha13_dir/private/*.keytab $PREFIX_ABS/alpha13_upgrade_full/private/ - cp -a $alpha13_dir/sysvol $PREFIX_ABS/alpha13_upgrade_full/ - mkdir $PREFIX_ABS/alpha13_upgrade_full/etc/ - cat $alpha13_dir/etc/smb.conf.template | \ - sed "s|@@PREFIX@@|$PREFIX_ABS/alpha13_upgrade_full|g" \ - > $PREFIX_ABS/alpha13_upgrade_full/etc/smb.conf -} - -remove_dns_user() { - # This is done, because otherwise the upgrdeprovision will not run without --full - $BINDIR/ldbdel -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb cn=dns,cn=users,dc=alpha13,dc=samba,dc=corp -} - -reindex() { - $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb $@ -} - -# This should 'fail', because it returns the number of modified records -dbcheck() { - $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb $@ -} - -dbcheck_clean() { - $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb $@ -} - -# This should 'fail', because it returns the number of modified records -dbcheck_full() { - $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/alpha13_upgrade_full/private/sam.ldb $@ -} - -dbcheck_full_clean() { - $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/alpha13_upgrade_full/private/sam.ldb $@ -} - -upgradeprovision() { - $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/alpha13_upgrade/etc/smb.conf" --debugchange -} - -upgradeprovision_full() { - $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/alpha13_upgrade_full/etc/smb.conf" --full --debugchange -} - -samba_upgradedns() { - $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL -s "$PREFIX_ABS/alpha13_upgrade_full/etc/smb.conf" -} - -referenceprovision() { - $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=alpha13.samba.corp --targetdir=$PREFIX_ABS/alpha13_upgrade_reference --use-ntvfs -} - -ldapcmp() { - $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/alpha13_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/alpha13_upgrade_full/private/sam.ldb --two --filter=dNSProperty,dnsRecord,cn,displayName,versionNumber,systemFlags,msDS-HasInstantiatedNCs --skip-missing-dn -} - -if [ -d $PREFIX_ABS/alpha13_upgrade ]; then - rm -fr $PREFIX_ABS/alpha13_upgrade -fi - -if [ -d $PREFIX_ABS/alpha13_upgrade_full ]; then - rm -fr $PREFIX_ABS/alpha13_upgrade_full -fi - -if [ -d $PREFIX_ABS/alpha13_upgrade_reference ]; then - rm -fr $PREFIX_ABS/alpha13_upgrade_reference -fi - -if [ -d $alpha13_dir ]; then - testit "alpha13" alpha13 - testit "remove_dns_user" remove_dns_user - testit "upgradeprovision" upgradeprovision - testit "upgradeprovision_full" upgradeprovision_full - testit "reindex" reindex - testit_expect_failure "dbcheck" dbcheck - testit "dbcheck_clean" dbcheck_clean - testit_expect_failure "dbcheck_full" dbcheck_full - testit "dbcheck_full_clean" dbcheck_full_clean - testit "referenceprovision" referenceprovision - testit "samba_upgradedns" samba_upgradedns - testit "ldapcmp" ldapcmp -else - subunit_start_test "alpha13" - subunit_skip_test "alpha13" <<EOF -no test provision -EOF - - subunit_start_test "remove_dns_user" - subunit_skip_test "remove_dns_user" <<EOF -no test provision -EOF - - subunit_start_test "upgradeprovision" - subunit_skip_test "upgradeprovision" <<EOF -no test provision -EOF - subunit_start_test "upgradeprovision_full" - subunit_skip_test "upgradeprovision_full" <<EOF -no test provision -EOF - subunit_start_test "reindex" - subunit_skip_test "reindex" <<EOF -no test provision -EOF - subunit_start_test "dbcheck" - subunit_skip_test "dbcheck" <<EOF -no test provision -EOF - subunit_start_test "dbcheck_clean" - subunit_skip_test "dbcheck_clean" <<EOF -no test provision -EOF - subunit_start_test "dbcheck_full" - subunit_skip_test "dbcheck_full" <<EOF -no test provision -EOF - subunit_start_test "dbcheck_full_clean" - subunit_skip_test "dbcheck_full_clean" <<EOF -no test provision -EOF - subunit_start_test "samba_dnsupgrade" - subunit_skip_test "samba_dnsupgrade" <<EOF -no test provision -EOF - subunit_start_test "referenceprovision" - subunit_skip_test "referenceprovision" <<EOF -no test provision -EOF - subunit_start_test "ldapcmp" - subunit_skip_test "ldapcmp" <<EOF -no test provision -EOF -fi - -exit $failed diff --git a/testprogs/blackbox/upgradeprovision-oldrelease.sh b/testprogs/blackbox/upgradeprovision-oldrelease.sh new file mode 100755 index 0000000000..593babcd5a --- /dev/null +++ b/testprogs/blackbox/upgradeprovision-oldrelease.sh @@ -0,0 +1,203 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then +cat <<EOF +Usage: dbcheck.sh PREFIX RELEASE +EOF +exit 1; +fi + +PREFIX_ABS="$1" +RELEASE="$2" +shift 2 + +. `dirname $0`/subunit.sh + +release_dir=`dirname $0`/../../source4/selftest/provisions/${RELEASE} + +undump() { + if test -x $BINDIR/tdbrestore; + then + `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade $BINDIR/tdbrestore + `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full $BINDIR/tdbrestore + else + `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade + `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full + fi + cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade/private/ + cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade/ + mkdir $PREFIX_ABS/${RELEASE}_upgrade/etc/ + cat $release_dir/etc/smb.conf.template | \ + sed "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade|g" \ + > $PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf + + cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade_full/private/ + cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade_full/ + mkdir $PREFIX_ABS/${RELEASE}_upgrade_full/etc/ + cat $release_dir/etc/smb.conf.template | \ + sed "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade_full|g" \ + > $PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf +} + +remove_dns_user() { + if [ x$RELEASE != x"release-4-0-0" ]; then + # This is done, because otherwise the upgrdeprovision will not run without --full + $BINDIR/ldbdel -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb cn=dns,cn=users,dc=${RELEASE},dc=samba,dc=corp + fi +} + +reindex() { + $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@ +} + +# This should 'fail', because it returns the number of modified records +dbcheck() { + $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@ +} + +dbcheck_clean() { + $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@ +} + +# This should 'fail', because it returns the number of modified records +dbcheck_full() { + $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@ +} + +dbcheck_full_clean() { + $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@ +} + +upgradeprovision() { + $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf" --debugchange +} + +upgradeprovision_full() { + $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" --full --debugchange +} + +samba_upgradedns() { + $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" +} + +referenceprovision() { + $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=${RELEASE}.samba.corp --targetdir=$PREFIX_ABS/${RELEASE}_upgrade_reference --use-ntvfs --host-ip=127.0.0.1 --host-ip6=::1 +} + +ldapcmp() { + if [ x$RELEASE != x"alpha13" ]; then + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --two --skip-missing-dn --filter=dnsRecord + fi +} + +ldapcmp_full() { + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --two --filter=dNSProperty,dnsRecord,cn,displayName,versionNumber,systemFlags,msDS-HasInstantiatedNCs --skip-missing-dn +} + +ldapcmp_sd() { + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --two --sd --skip-missing-dn +} + +ldapcmp_full_sd() { + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --two --sd --skip-missing-dn +} + +if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then + rm -fr $PREFIX_ABS/${RELEASE}_upgrade +fi + +if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then + rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full +fi + +if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then + rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference +fi + +if [ -d $release_dir ]; then + testit $RELEASE undump + testit "remove_dns_user" remove_dns_user + testit "upgradeprovision" upgradeprovision + testit "upgradeprovision_full" upgradeprovision_full + testit "reindex" reindex + # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run + if [ x$RELEASE != x"release-4-0-0" ]; then + testit_expect_failure "dbcheck" dbcheck + fi + testit_expect_failure "dbcheck_full" dbcheck_full + testit "dbcheck_clean" dbcheck_clean + testit "dbcheck_full_clean" dbcheck_full_clean + testit "referenceprovision" referenceprovision + testit "samba_upgradedns" samba_upgradedns + testit "ldapcmp" ldapcmp + testit "ldapcmp_sd" ldapcmp_sd + testit "ldapcmp_full_sd" ldapcmp_full_sd +else + subunit_start_test "${RELEASE}" + subunit_skip_test "${RELEASE}" <<EOF +no test provision +EOF + + subunit_start_test "remove_dns_user" + subunit_skip_test "remove_dns_user" <<EOF +no test provision +EOF + + subunit_start_test "upgradeprovision" + subunit_skip_test "upgradeprovision" <<EOF +no test provision +EOF + subunit_start_test "upgradeprovision_full" + subunit_skip_test "upgradeprovision_full" <<EOF +no test provision +EOF + subunit_start_test "reindex" + subunit_skip_test "reindex" <<EOF +no test provision +EOF + subunit_start_test "dbcheck" + subunit_skip_test "dbcheck" <<EOF +no test provision +EOF + subunit_start_test "dbcheck_clean" + subunit_skip_test "dbcheck_clean" <<EOF +no test provision +EOF + # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run + if [ x$RELEASE != x"release-4-0-0" ]; then + subunit_start_test "dbcheck_full" + subunit_skip_test "dbcheck_full" <<EOF +no test provision +EOF + fi + subunit_start_test "dbcheck_full_clean" + subunit_skip_test "dbcheck_full_clean" <<EOF +no test provision +EOF + subunit_start_test "samba_dnsupgrade" + subunit_skip_test "samba_dnsupgrade" <<EOF +no test provision +EOF + subunit_start_test "referenceprovision" + subunit_skip_test "referenceprovision" <<EOF +no test provision +EOF + subunit_start_test "ldapcmp" + subunit_skip_test "ldapcmp" <<EOF +no test provision +EOF + subunit_start_test "ldapcmp_full" + subunit_skip_test "ldapcmp_full" <<EOF +no test provision +EOF + subunit_start_test "ldapcmp_sd" + subunit_skip_test "ldapcmp_sd" <<EOF +no test provision +EOF + subunit_start_test "ldapcmp_full_sd" + subunit_skip_test "ldapcmp_full_sd" <<EOF +no test provision +EOF +fi + +exit $failed |