From owner-svn-src-projects@freebsd.org  Thu Feb  8 21:27:20 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
Delivered-To: svn-src-projects@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 DE445F063FC
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Thu,  8 Feb 2018 21:27:19 +0000 (UTC)
 (envelope-from asomers@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 51F947EE68;
 Thu,  8 Feb 2018 21:27:19 +0000 (UTC)
 (envelope-from asomers@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 4B26A1B94D;
 Thu,  8 Feb 2018 21:27:19 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w18LRJjk068522;
 Thu, 8 Feb 2018 21:27:19 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w18LRIWi068515;
 Thu, 8 Feb 2018 21:27:18 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201802082127.w18LRIWi068515@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Thu, 8 Feb 2018 21:27:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r329037 - in projects/zfsd/head: etc/mtree
 tests/sys/cddl/zfs/tests/clean_mirror
 tests/sys/cddl/zfs/tests/clean_mirror/assertion_001
 tests/sys/cddl/zfs/tests/clean_mirror/assertion_002 ...
X-SVN-Group: projects
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: in projects/zfsd/head: etc/mtree
 tests/sys/cddl/zfs/tests/clean_mirror
 tests/sys/cddl/zfs/tests/clean_mirror/assertion_001
 tests/sys/cddl/zfs/tests/clean_mirror/assertion_002
 tests/sys/cddl/zfs/tests/...
X-SVN-Commit-Revision: 329037
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-projects@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Feb 2018 21:27:20 -0000

Author: asomers
Date: Thu Feb  8 21:27:18 2018
New Revision: 329037
URL: https://svnweb.freebsd.org/changeset/base/329037

Log:
  Combine all clean_mirror tests into a single directory
  
  There was never any good reason for using a separate subdirectory for each
  test.
  
  Sponsored by:	Spectra Logic Corp

Added:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_001_pos.ksh
     - copied unchanged from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_001/clean_mirror_001_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_002_pos.ksh
     - copied unchanged from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_002/clean_mirror_002_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_003_pos.ksh
     - copied unchanged from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_003/clean_mirror_003_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_004_pos.ksh
     - copied unchanged from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_004/clean_mirror_004_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_test.sh   (contents, props changed)
Deleted:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_001/
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_002/
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_003/
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_004/
Modified:
  projects/zfsd/head/etc/mtree/BSD.tests.dist
  projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/Makefile

Modified: projects/zfsd/head/etc/mtree/BSD.tests.dist
==============================================================================
--- projects/zfsd/head/etc/mtree/BSD.tests.dist	Thu Feb  8 21:17:54 2018	(r329036)
+++ projects/zfsd/head/etc/mtree/BSD.tests.dist	Thu Feb  8 21:27:18 2018	(r329037)
@@ -450,14 +450,6 @@
                     cachefile
                     ..
                     clean_mirror
-                        assertion_001
-                        ..
-                        assertion_002
-                        ..
-                        assertion_003
-                        ..
-                        assertion_004
-                        ..
                     ..
                     cli_root
                         zfs_upgrade

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/Makefile
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/Makefile	Thu Feb  8 21:17:54 2018	(r329036)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/Makefile	Thu Feb  8 21:27:18 2018	(r329037)
@@ -6,14 +6,15 @@ PACKAGE=tests
 TESTSDIR=${TESTSBASE}/sys/cddl/zfs/tests/clean_mirror
 FILESDIR=${TESTSDIR}
 
-${PACKAGE}FILES+=	setup.ksh
-${PACKAGE}FILES+=	default.cfg
-${PACKAGE}FILES+=	cleanup.ksh
-${PACKAGE}FILES+=	clean_mirror_common.kshlib
+ATF_TESTS_KSH93+=	clean_mirror_test
 
-TESTS_SUBDIRS+=	assertion_001
-TESTS_SUBDIRS+=	assertion_002
-TESTS_SUBDIRS+=	assertion_003
-TESTS_SUBDIRS+=	assertion_004
+${PACKAGE}FILES+=	clean_mirror_001_pos.ksh
+${PACKAGE}FILES+=	clean_mirror_002_pos.ksh
+${PACKAGE}FILES+=	clean_mirror_003_pos.ksh
+${PACKAGE}FILES+=	clean_mirror_004_pos.ksh
+${PACKAGE}FILES+=	clean_mirror_common.kshlib
+${PACKAGE}FILES+=	cleanup.ksh
+${PACKAGE}FILES+=	default.cfg
+${PACKAGE}FILES+=	setup.ksh
 
 .include <bsd.test.mk>

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_001_pos.ksh (from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_001/clean_mirror_001_pos.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_001_pos.ksh	Thu Feb  8 21:27:18 2018	(r329037, copy of r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_001/clean_mirror_001_pos.ksh)
@@ -0,0 +1,65 @@
+#! /usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)clean_mirror_001_pos.ksh	1.2	07/01/09 SMI"
+#
+
+. $STF_SUITE/include/libtest.kshlib
+. $STF_SUITE/tests/clean_mirror/clean_mirror_common.kshlib
+
+###############################################################################
+#
+# __stc_assertion_start
+#
+# ID: clean_mirror_001_pos
+#
+# DESCRIPTION:
+# The primary side of a zpool mirror can be zeroed without causing damage
+# to the data in the pool
+#
+# STRATEGY:
+# 1) Write several files to the ZFS filesystem mirror
+# 2) dd from /dev/zero over the primary side of the mirror
+# 3) verify that all the file contents are unchanged on the file system
+#
+# TESTABILITY: explicit
+#
+# TEST_AUTOMATION_LEVEL: automated
+#
+# CODING_STATUS: COMPLETED (2005-07-04)
+#
+# __stc_assertion_end
+#
+################################################################################
+
+verify_runnable "global"
+
+log_assert "The primary side of a zpool mirror may be completely wiped" \
+	"without affecting the content of the pool"
+
+overwrite_verify_mirror $SIDE_PRIMARY /dev/zero
+
+log_pass "The overwrite had no effect on the data"

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_002_pos.ksh (from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_002/clean_mirror_002_pos.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_002_pos.ksh	Thu Feb  8 21:27:18 2018	(r329037, copy of r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_002/clean_mirror_002_pos.ksh)
@@ -0,0 +1,65 @@
+#! /usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)clean_mirror_002_pos.ksh	1.2	07/01/09 SMI"
+#
+
+. $STF_SUITE/include/libtest.kshlib
+. $STF_SUITE/tests/clean_mirror/clean_mirror_common.kshlib
+
+###############################################################################
+#
+# __stc_assertion_start
+#
+# ID: clean_mirror_002_pos
+#
+# DESCRIPTION:
+# The secondary side of a zpool mirror can be zeroed without causing damage
+# to the data in the pool
+#
+# STRATEGY:
+# 1) Write several files to the ZFS filesystem in the mirrored pool
+# 2) dd from /dev/zero over the secondary side of the mirror
+# 3) verify that all the file contents are unchanged on the file system
+#
+# TESTABILITY: explicit
+#
+# TEST_AUTOMATION_LEVEL: automated
+#
+# CODING_STATUS: COMPLETED (2005-07-04)
+#
+# __stc_assertion_end
+#
+################################################################################
+
+verify_runnable "global"
+
+log_assert "The primary side of a zpool mirror may be completely wiped" \
+	"without affecting the content of the pool"
+
+overwrite_verify_mirror $SIDE_SECONDARY /dev/zero
+
+log_pass "The overwrite had no effect on the data"

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_003_pos.ksh (from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_003/clean_mirror_003_pos.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_003_pos.ksh	Thu Feb  8 21:27:18 2018	(r329037, copy of r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_003/clean_mirror_003_pos.ksh)
@@ -0,0 +1,65 @@
+#! /usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)clean_mirror_003_pos.ksh	1.2	07/01/09 SMI"
+#
+
+. $STF_SUITE/include/libtest.kshlib
+. $STF_SUITE/tests/clean_mirror/clean_mirror_common.kshlib
+
+###############################################################################
+#
+# __stc_assertion_start
+#
+# ID: clean_mirror_003_pos
+#
+# DESCRIPTION:
+# The primary side of a zpool mirror can be mangled without causing damage
+# to the data in the pool
+#
+# STRATEGY:
+# 1) Write several files to the ZFS filesystem mirror
+# 2) dd from /dev/urandom over the primary side of the mirror
+# 3) verify that all the file contents are unchanged on the file system
+#
+# TESTABILITY: explicit
+#
+# TEST_AUTOMATION_LEVEL: automated
+#
+# CODING_STATUS: COMPLETED (2005-07-04)
+#
+# __stc_assertion_end
+#
+################################################################################
+
+verify_runnable "global"
+
+log_assert "The primary side of a zpool mirror may be completely mangled" \
+	"without affecting the content of the pool"
+
+overwrite_verify_mirror $SIDE_PRIMARY /dev/urandom
+
+log_pass "The overwrite did not have any effect on the data"

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_004_pos.ksh (from r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_004/clean_mirror_004_pos.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_004_pos.ksh	Thu Feb  8 21:27:18 2018	(r329037, copy of r329036, projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/assertion_004/clean_mirror_004_pos.ksh)
@@ -0,0 +1,65 @@
+#! /usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)clean_mirror_004_pos.ksh	1.2	07/01/09 SMI"
+#
+
+. $STF_SUITE/include/libtest.kshlib
+. $STF_SUITE/tests/clean_mirror/clean_mirror_common.kshlib
+
+###############################################################################
+#
+# __stc_assertion_start
+#
+# ID: clean_mirror_004_pos
+#
+# DESCRIPTION:
+# The secondary side of a zpool mirror can be mangled without causing damage
+# to the data in the pool
+#
+# STRATEGY:
+# 1) Write several files to the ZFS filesystem in the mirrored pool
+# 2) dd from /dev/urandom over the secondary side of the mirror
+# 3) verify that all the file contents are unchanged on the file system
+#
+# TESTABILITY: explicit
+#
+# TEST_AUTOMATION_LEVEL: automated
+#
+# CODING_STATUS: COMPLETED (2005-07-04)
+#
+# __stc_assertion_end
+#
+################################################################################
+
+verify_runnable "global"
+
+log_assert "The primary side of a zpool mirror may be completely mangled" \
+	"without affecting the content of the pool"
+
+overwrite_verify_mirror $SIDE_SECONDARY /dev/urandom
+
+log_pass "The overwrite had no effect on the data"

Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_test.sh	Thu Feb  8 21:27:18 2018	(r329037)
@@ -0,0 +1,131 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2018 Spectra Logic.  All rights reserved.
+# Use is subject to license terms.
+#
+
+
+atf_test_case clean_mirror_001_pos cleanup
+clean_mirror_001_pos_head()
+{
+	atf_set "descr" "The primary side of a zpool mirror may be completely wipedwithout affecting the content of the pool"
+}
+clean_mirror_001_pos_body()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	verify_disk_count "$DISKS" 1
+	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
+	ksh93 $(atf_get_srcdir)/clean_mirror_001_pos.ksh || atf_fail "Testcase failed"
+}
+clean_mirror_001_pos_cleanup()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+}
+
+atf_test_case clean_mirror_002_pos cleanup
+clean_mirror_002_pos_head()
+{
+	atf_set "descr" "The primary side of a zpool mirror may be completely wipedwithout affecting the content of the pool"
+}
+clean_mirror_002_pos_body()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	verify_disk_count "$DISKS" 1
+	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
+	ksh93 $(atf_get_srcdir)/clean_mirror_002_pos.ksh || atf_fail "Testcase failed"
+}
+clean_mirror_002_pos_cleanup()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+}
+
+atf_test_case clean_mirror_003_pos cleanup
+clean_mirror_003_pos_head()
+{
+	atf_set "descr" "The primary side of a zpool mirror may be completely mangledwithout affecting the content of the pool"
+}
+clean_mirror_003_pos_body()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	verify_disk_count "$DISKS" 1
+	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
+	ksh93 $(atf_get_srcdir)/clean_mirror_003_pos.ksh || atf_fail "Testcase failed"
+}
+clean_mirror_003_pos_cleanup()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+}
+
+atf_test_case clean_mirror_004_pos cleanup
+clean_mirror_004_pos_head()
+{
+	atf_set "descr" "The primary side of a zpool mirror may be completely mangledwithout affecting the content of the pool"
+}
+clean_mirror_004_pos_body()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	verify_disk_count "$DISKS" 1
+	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
+	ksh93 $(atf_get_srcdir)/clean_mirror_004_pos.ksh || atf_fail "Testcase failed"
+}
+clean_mirror_004_pos_cleanup()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/clean_mirror_common.kshlib
+	. $(atf_get_srcdir)/default.cfg
+
+	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+}
+
+
+atf_init_test_cases()
+{
+
+	atf_add_test_case clean_mirror_001_pos
+	atf_add_test_case clean_mirror_002_pos
+	atf_add_test_case clean_mirror_003_pos
+	atf_add_test_case clean_mirror_004_pos
+}