From 9cf2118afce0b1534c0daea4ab97f29225f7fcb1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 21 Oct 2020 07:43:08 +0200 Subject: [PATCH 1/9] python: Create targetdir recursively This fixes `make test` in a release tarball. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- python/samba/netcmd/domain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index 000688f4e7a..5f08ddf6007 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -445,7 +445,7 @@ class cmd_domain_provision(Command): if targetdir is not None: if not os.path.isdir(targetdir): - os.mkdir(targetdir) + os.makedirs(targetdir) eadb = True -- GitLab From f69a5a15550a2330710ba09e06daf826deedeb34 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 22 Oct 2020 11:39:04 +0200 Subject: [PATCH 2/9] testprogs: Add remove_directory to common test functions BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- testprogs/blackbox/common_test_fns.inc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testprogs/blackbox/common_test_fns.inc b/testprogs/blackbox/common_test_fns.inc index a5611c63fa0..7b421e9eb08 100755 --- a/testprogs/blackbox/common_test_fns.inc +++ b/testprogs/blackbox/common_test_fns.inc @@ -107,3 +107,14 @@ kerberos_kinit() { fi return $status } + +remove_directory() { + local xdir=${1} + shift + + if [ "$xdir" == "/" ] || [ ! -d "$xdir" ] || [ ! $(ls -A "$xdir") ]; then + return + fi + + rm -rf "$xdir" +} -- GitLab From 5c65e1a9e99d9dcfadb90433b2465db277814666 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 20 Oct 2020 20:47:43 +0200 Subject: [PATCH 3/9] testprogs: Fix and improve demote-saveddb test This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- testprogs/blackbox/demote-saveddb.sh | 75 ++++++++++++++++------------ 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/testprogs/blackbox/demote-saveddb.sh b/testprogs/blackbox/demote-saveddb.sh index 3d5fabd72e3..d8fccf32011 100755 --- a/testprogs/blackbox/demote-saveddb.sh +++ b/testprogs/blackbox/demote-saveddb.sh @@ -10,58 +10,69 @@ fi PREFIX_ABS="$1" shift 1 -. `dirname $0`/subunit.sh +failed=0 -tree_dir=`dirname $0`/../../source4/selftest/provisions/multi-dc-samba-master-c596ac6 +. `dirname $0`/subunit.sh +. `dirname $0`/common_test_fns.inc -undump() { - if test -x $BINDIR/tdbrestore; - then - `dirname $0`/../../source4/selftest/provisions/undump.sh $tree_dir $PREFIX_ABS $BINDIR/tdbrestore - else - `dirname $0`/../../source4/selftest/provisions/undump.sh $tree_dir $PREFIX_ABS - fi -} +samba_tree_dir="$SRCDIR_ABS/source4/selftest/provisions/multi-dc-samba-master-c596ac6" -demote() { - $PYTHON $BINDIR/samba-tool domain demote -H tdb://$PREFIX_ABS/private/sam.ldb --remove-other-dead-server=$1 -} +samba_tdbrestore="tdbrestore" +if [ -x $BINDIR/tdbrestore ]; then + samba_tdbrestore="$BINDIR/tdbrestore" +fi +# The undump script and the provision data is not part of release tarballs, +# skip the tests in this case! +samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh" +if [ ! -x $samba_undump ] || [ ! -d $samba_tree_dir ]; then + subunit_start_test "undump" + subunit_skip_test "undump" < Date: Wed, 21 Oct 2020 17:04:12 +0200 Subject: [PATCH 4/9] testprogs: Fix and improve tombstones-expunge test This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- testprogs/blackbox/tombstones-expunge.sh | 94 +++++++++++++----------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/testprogs/blackbox/tombstones-expunge.sh b/testprogs/blackbox/tombstones-expunge.sh index aa37cfe278f..9e0588377d7 100755 --- a/testprogs/blackbox/tombstones-expunge.sh +++ b/testprogs/blackbox/tombstones-expunge.sh @@ -11,9 +11,12 @@ PREFIX_ABS="$1" RELEASE="$2" shift 2 +failed=0 + . `dirname $0`/subunit.sh +. `dirname $0`/common_test_fns.inc -release_dir=`dirname $0`/../../source4/selftest/provisions/$RELEASE +release_dir="$SRCDIR_ABS/source4/selftest/provisions/$RELEASE" ldbadd="ldbadd" if [ -x "$BINDIR/ldbadd" ]; then @@ -35,13 +38,28 @@ if [ -x "$BINDIR/ldbsearch" ]; then ldbsearch="$BINDIR/ldbsearch" fi +samba_tdbrestore="tdbrestore" +if [ -x "$BINDIR/tdbrestore" ]; then + samba_tdbrestore="$BINDIR/tdbrestore" +fi + +samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh" +if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then + subunit_start_test $RELEASE + subunit_skip_test $RELEASE < Date: Wed, 21 Oct 2020 17:35:34 +0200 Subject: [PATCH 5/9] testprogs: Fix and improve runtime-links test This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- testprogs/blackbox/common-links.sh | 16 +++---- testprogs/blackbox/runtime-links.sh | 65 ++++++++++++++++------------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/testprogs/blackbox/common-links.sh b/testprogs/blackbox/common-links.sh index ee7310b5108..363234ae11c 100644 --- a/testprogs/blackbox/common-links.sh +++ b/testprogs/blackbox/common-links.sh @@ -1,4 +1,4 @@ -release_dir=`dirname $0`/../../source4/selftest/provisions/$RELEASE +release_dir=$SRCDIR_ABS/source4/selftest/provisions/$RELEASE ldbadd="ldbadd" if [ -x "$BINDIR/ldbadd" ]; then @@ -25,13 +25,15 @@ if [ -x "$BINDIR/ldbrename" ]; then ldbrename="$BINDIR/ldbrename" fi +samba_tdbrestore="tdbrestore" +if [ -x "$BINDIR/tdbrestore" ]; then + samba_tdbrestore="$BINDIR/tdbrestore" +fi + +samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh" + undump() { - if test -x $BINDIR/tdbrestore; - then - `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 + $samba_undump $release_dir $PREFIX_ABS/$RELEASE $samba_tdbrestore } add_dangling_link() { diff --git a/testprogs/blackbox/runtime-links.sh b/testprogs/blackbox/runtime-links.sh index 344b822f07e..f8de66c60e7 100755 --- a/testprogs/blackbox/runtime-links.sh +++ b/testprogs/blackbox/runtime-links.sh @@ -11,10 +11,28 @@ PREFIX_ABS="$1" RELEASE="$2" shift 2 +failed=0 + . `dirname $0`/subunit.sh . `dirname $0`/common-links.sh +. `dirname $0`/common_test_fns.inc + +if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then + subunit_start_test $RELEASE + subunit_skip_test $RELEASE < Date: Wed, 21 Oct 2020 17:41:27 +0200 Subject: [PATCH 6/9] testprogs: Fix and improve dbcheck-links test This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- testprogs/blackbox/dbcheck-links.sh | 160 ++++++++++++++-------------- 1 file changed, 82 insertions(+), 78 deletions(-) diff --git a/testprogs/blackbox/dbcheck-links.sh b/testprogs/blackbox/dbcheck-links.sh index eb0e0b3163f..ead59d691e0 100755 --- a/testprogs/blackbox/dbcheck-links.sh +++ b/testprogs/blackbox/dbcheck-links.sh @@ -14,6 +14,23 @@ shift 2 . `dirname $0`/subunit.sh . `dirname $0`/common-links.sh +. `dirname $0`/common_test_fns.inc + +failed=0 + +if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then + subunit_start_test $RELEASE + subunit_skip_test $RELEASE < Date: Wed, 21 Oct 2020 17:54:54 +0200 Subject: [PATCH 7/9] testprogs: Fix and improve functionalprep test This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- testprogs/blackbox/functionalprep.sh | 77 ++++++++++++++++------------ 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/testprogs/blackbox/functionalprep.sh b/testprogs/blackbox/functionalprep.sh index 1d37611ef7a..a5ac4b8bc7f 100755 --- a/testprogs/blackbox/functionalprep.sh +++ b/testprogs/blackbox/functionalprep.sh @@ -10,45 +10,56 @@ fi PREFIX_ABS="$1" shift 1 +failed=0 + . `dirname $0`/subunit.sh +. `dirname $0`/common_test_fns.inc RELEASE="release-4-8-0-pre1" -release_dir=`dirname $0`/../../source4/selftest/provisions/$RELEASE +release_dir="$SRCDIR_ABS/source4/selftest/provisions/$RELEASE" OLD_RELEASE="release-4-1-0rc3" -old_release_dir=`dirname $0`/../../source4/selftest/provisions/$OLD_RELEASE +old_release_dir="$SRCDIR_ABS/source4/selftest/provisions/$OLD_RELEASE" -cleanup_output_directories() -{ - if [ -d $PREFIX_ABS/2012R2_schema ]; then - rm -fr $PREFIX_ABS/2012R2_schema - fi +samba_tdbrestore="tdbrestore" +if [ -x "$BINDIR/tdbrestore" ]; then + samba_tdbrestore="$BINDIR/tdbrestore" +fi + +samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh" + +if [ ! -x $samba_undump ] || [ ! -d $release_dir ] || [ ! -d $old_release_dir ]; then + subunit_start_test $RELEASE + subunit_skip_test $RELEASE < Date: Wed, 21 Oct 2020 18:03:25 +0200 Subject: [PATCH 8/9] testprogs: Fix and improve dbcheck-oldrelease test This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- testprogs/blackbox/dbcheck-oldrelease.sh | 240 ++++++++++++----------- 1 file changed, 123 insertions(+), 117 deletions(-) diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh index 41c55178d4e..9e9924654be 100755 --- a/testprogs/blackbox/dbcheck-oldrelease.sh +++ b/testprogs/blackbox/dbcheck-oldrelease.sh @@ -11,7 +11,10 @@ PREFIX_ABS="$1" RELEASE="$2" shift 2 +failed=0 + . `dirname $0`/subunit.sh +. `dirname $0`/common_test_fns.inc release_dir=`dirname $0`/../../source4/selftest/provisions/$RELEASE @@ -30,13 +33,94 @@ if [ -x "$BINDIR/ldbsearch" ]; then ldbsearch="$BINDIR/ldbsearch" fi +samba_tdbrestore="tdbrestore" +if [ -x "$BINDIR/tdbrestore" ]; then + samba_tdbrestore="$BINDIR/tdbrestore" +fi + +samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh" +if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then + subunit_start_test $RELEASE + subunit_skip_test $RELEASE < Date: Wed, 21 Oct 2020 19:14:32 +0200 Subject: [PATCH 9/9] testprogs: Fix and improve upgradeprovision-oldrelease test This fixes running `make test` in a release tarball! BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider --- .../blackbox/upgradeprovision-oldrelease.sh | 254 +++++++++--------- 1 file changed, 121 insertions(+), 133 deletions(-) diff --git a/testprogs/blackbox/upgradeprovision-oldrelease.sh b/testprogs/blackbox/upgradeprovision-oldrelease.sh index 208baa54a02..5b095fca05e 100755 --- a/testprogs/blackbox/upgradeprovision-oldrelease.sh +++ b/testprogs/blackbox/upgradeprovision-oldrelease.sh @@ -11,37 +11,113 @@ PREFIX_ABS="$1" RELEASE="$2" shift 2 +failed=0 + . `dirname $0`/subunit.sh +. `dirname $0`/common_test_fns.inc -release_dir=`dirname $0`/../../source4/selftest/provisions/${RELEASE} +release_dir="$SRCDIR_ABS/source4/selftest/provisions/${RELEASE}" LDBDEL_BIN=ldbdel if [ -x "$BINDIR/ldbdel" ]; then LDBDEL_BIN=$BINDIR/ldbdel fi +samba_tdbrestore="tdbrestore" +if [ -x "$BINDIR/tdbrestore" ]; then + samba_tdbrestore="$BINDIR/tdbrestore" +fi + +samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh" +if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then + subunit_start_test "${RELEASE}" + subunit_skip_test "${RELEASE}" < $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 + $samba_undump $release_dir $PREFIX_ABS/${RELEASE}_upgrade $samba_tdbrestore + $samba_undump $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full $samba_tdbrestore + + 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/ + sed -e "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade|g" $release_dir/etc/smb.conf.template \ + > $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/ + sed -e "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade_full|g" $release_dir/etc/smb.conf.template \ + > $PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf } remove_dns_user() { @@ -122,116 +198,28 @@ 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 - testit_expect_failure "dbcheck" dbcheck - testit_expect_failure "dbcheck_full" dbcheck_full - testit "dbcheck_clean" dbcheck_clean - testit "dbcheck_full_clean" dbcheck_full_clean - testit "dbcheck_full_clean_well_known_acls" dbcheck_full_clean_well_known_acls - 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}" <