From owner-svn-src-all@freebsd.org Thu Mar 15 12:40:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44DCFF4E8EE; Thu, 15 Mar 2018 12:40:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC34D7E8DB; Thu, 15 Mar 2018 12:40:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE65D162A4; Thu, 15 Mar 2018 12:40:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2FCehmP055698; Thu, 15 Mar 2018 12:40:43 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2FCehPa055697; Thu, 15 Mar 2018 12:40:43 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803151240.w2FCehPa055697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 15 Mar 2018 12:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330993 - head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy X-SVN-Commit-Revision: 330993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2018 12:40:44 -0000 Author: avg Date: Thu Mar 15 12:40:43 2018 New Revision: 330993 URL: https://svnweb.freebsd.org/changeset/base/330993 Log: zfs test suite: align zfs_destroy_005_neg: with upstream The change is to account for a different order in which the recursive destroy may be attempted. If we first try a dataset that can be destroyed then it will be destroyed, but if we first try a dataset that cannot be destroyed then we will not attempt to destroy the other dataset. Modified: head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh Modified: head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh ============================================================================== --- head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh Thu Mar 15 12:35:22 2018 (r330992) +++ head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh Thu Mar 15 12:40:43 2018 (r330993) @@ -121,10 +121,30 @@ negative_test "-r -rf" "$CTR $FS $VOL" typeset mtpt_dir=$(get_prop mountpoint $FS) make_dir_busy $mtpt_dir negative_test "-R -rR" $CTR -check_dataset datasetexists $CTR $FS $VOL $VOLSNAP $VOLCLONE -log_must datasetnonexists $FSSNAP $FSCLONE # +# Checking the outcome of the test above is tricky, because the order in +# which datasets are destroyed is not deterministic. Both $FS and $VOL are +# busy, and the remaining datasets will be different depending on whether we +# tried (and failed) to delete $FS or $VOL first. + +# The following datasets will exist independent of the order +check_dataset datasetexists $CTR $FS $VOL + +if datasetexists $VOLSNAP && datasetnonexists $FSSNAP; then + # The recursive destroy failed on $FS + check_dataset datasetnonexists $FSSNAP $FSCLONE + check_dataset datasetexists $VOLSNAP $VOLCLONE +elif datasetexists $FSSNAP && datasetnonexists $VOLSNAP; then + # The recursive destroy failed on $VOL + check_dataset datasetnonexists $VOLSNAP $VOLCLONE + check_dataset datasetexists $FSSNAP $FSCLONE +else + log_must zfs list -rtall + log_fail "Unexpected datasets remaining" +fi + +# # Create the clones for test environment, then verify 'zfs destroy $FS' # failed without '-f'. # @@ -148,7 +168,17 @@ if is_global_zone; then make_dir_busy $TESTDIR1 negative_test "-R -rR" $CTR log_must datasetexists $CTR $VOL - log_must datasetnonexists $FS $FSSNAP $FSCLONE $VOLSNAP $VOLCLONE + log_must datasetnonexists $VOLSNAP $VOLCLONE + + # Here again, the non-determinism of destroy order is a factor. $FS, + # $FSSNAP and $FSCLONE will still exist here iff we attempted to destroy + # $VOL (and failed) first. So check that either all of the datasets are + # present, or they're all gone. + if datasetexists $FS; then + check_dataset datasetexists $FS $FSSNAP $FSCLONE + else + check_dataset datasetnonexists $FS $FSSNAP $FSCLONE + fi # # Create the clones for test environment and make the volume busy.