svn commit: r323270 - in projects/zfsd/head: etc/mtree tests/sys/cddl/zfs/include tests/sys/cddl/zfs/tests/cli_root/zpool_import tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles

Alan Somers asomers at FreeBSD.org
Thu Sep 7 15:30:54 UTC 2017


Author: asomers
Date: Thu Sep  7 15:30:52 2017
New Revision: 323270
URL: https://svnweb.freebsd.org/changeset/base/323270

Log:
  Fix zpool_import_013_neg from the ZFS test suite
  
  This test is supposed to check that ZFS will refuse to import a foreign,
  in-use pool without the "-f" flag.  But it's always failed, because the
  blockfiles it tested were all from exported pools.  I'm importing the change
  that Illumos made, which adds a new blockfile and tests only that.  Also, in
  the interest of reducing runtime, I'm eliminating the setup and cleanup
  steps for this test, which create a pool for temporary storage.  It's fine
  to just use TMPDIR.
  
  etc/mtree/BSD.tests.dist
  	Add the blockfiles directory
  
  tests/sys/cddl/zfs/include/commands.txt
  	Add bzcat to the list of commands
  
  tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile
  tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/Makefile
  tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/README
  tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/unclean_export.dat.bz2
  tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_013_neg.ksh
  	Use the new blockfile instead of the ones from zpool_upgrade, and
  	dispense with the temporary pool.
  
  tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh
  	Clear the expected failure
  
  Sponsored by:	Spectra Logic Corp

Added:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/Makefile   (contents, props changed)
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/README
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/unclean_export.dat.bz2   (contents, props changed)
Modified:
  projects/zfsd/head/etc/mtree/BSD.tests.dist
  projects/zfsd/head/tests/sys/cddl/zfs/include/commands.txt
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_013_neg.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh

Modified: projects/zfsd/head/etc/mtree/BSD.tests.dist
==============================================================================
--- projects/zfsd/head/etc/mtree/BSD.tests.dist	Thu Sep  7 15:30:13 2017	(r323269)
+++ projects/zfsd/head/etc/mtree/BSD.tests.dist	Thu Sep  7 15:30:52 2017	(r323270)
@@ -483,6 +483,8 @@
                         zpool_clear
                         ..
                         zpool_import
+                            blockfiles
+                            ..
                         ..
                         zpool
                         ..

Modified: projects/zfsd/head/tests/sys/cddl/zfs/include/commands.txt
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/include/commands.txt	Thu Sep  7 15:30:13 2017	(r323269)
+++ projects/zfsd/head/tests/sys/cddl/zfs/include/commands.txt	Thu Sep  7 15:30:52 2017	(r323270)
@@ -39,6 +39,7 @@
 /usr/bin/awk
 /usr/sbin/arp
 /usr/bin/basename
+/usr/bin/bzcat
 /bin/cat
 /usr/bin/cd
 /usr/bin/chgrp

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile	Thu Sep  7 15:30:13 2017	(r323269)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile	Thu Sep  7 15:30:52 2017	(r323270)
@@ -34,4 +34,6 @@ ${PACKAGE}FILES+=	zpool_import_008_pos.ksh
 ${PACKAGE}FILES+=	zpool_import_004_pos.ksh
 ${PACKAGE}FILES+=	zpool_import.kshlib
 
+SUBDIR+=	blockfiles
+
 .include <bsd.test.mk>

Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/Makefile	Thu Sep  7 15:30:52 2017	(r323270)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PACKAGE=tests
+TESTSDIR=${TESTSBASE}/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles
+FILESDIR=${TESTSDIR}
+
+${PACKAGE}FILES+=	README
+${PACKAGE}FILES+=	unclean_export.dat.bz2
+
+.include <bsd.test.mk>

Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/README
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/README	Thu Sep  7 15:30:52 2017	(r323270)
@@ -0,0 +1,29 @@
+#
+# 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 (c) 2012 by Delphix. All rights reserved.
+#
+
+Unless otherwise noted, all files in this distribution are released
+under the Common Development and Distribution License (CDDL).
+
+This directory contains compressed blockfiles for zpool import testing.

Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/unclean_export.dat.bz2
==============================================================================
Binary file. No diff available.

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_013_neg.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_013_neg.ksh	Thu Sep  7 15:30:13 2017	(r323269)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_013_neg.ksh	Thu Sep  7 15:30:52 2017	(r323270)
@@ -56,55 +56,30 @@
 
 verify_runnable "global"
 
-if (( ZPOOL_VERSION < 6 )); then
-	log_unsupported "This case need zpool version >= 6"
-fi
+POOL_NAME=unclean_export
+POOL_FILE=unclean_export.dat
 
-function create_old_pool
+function uncompress_pool
 {
-	VERSION=$1
-	POOL_FILES=$($ENV | grep "ZPOOL_VERSION_${VERSION}_FILES"\
-		| $AWK -F= '{print $2}')
-	POOL_NAME=$($ENV|grep "ZPOOL_VERSION_${VERSION}_NAME"\
-		| $AWK -F= '{print $2}')
-
-	log_note "Creating $POOL_NAME from $POOL_FILES"
-	for pool_file in $POOL_FILES; do
-		$CP $STF_SUITE/tests/cli_root/zpool_upgrade/blockfiles/$pool_file.Z \
-		/$TESTPOOL
-		$UNCOMPRESS /$TESTPOOL/$pool_file.Z
-	done
+	log_note "Creating pool from $POOL_FILE"
+	log_must $BZCAT \
+           $STF_SUITE/tests/cli_root/zpool_import/blockfiles/$POOL_FILE.bz2 \
+           > $TMPDIR/$POOL_FILE
 	return 0
 }
 
 function cleanup
 {
-	if [[ -z $POOL_NAME ]]; then
-		return 1
-	fi
-	destroy_pool $POOL_NAME
-	for file in $POOL_FILES; do
-		if [[ -e /$TESTPOOL/$file ]]; then
-			$RM /$TESTPOOL/$file
-		fi
-	done
+	poolexists $POOL_NAME && log_must zpool destroy $POOL_NAME
+	[[ -e $TMPDIR/$POOL_FILE ]] && rm $TMPDIR/$POOL_FILE
 	return 0
 }
 
-log_assert "'zpool import' fail while pool may be in use from other system," \
-	"it need import forcefully."
+log_assert "'zpool import' fails for pool that was not cleanly exported"
 log_onexit cleanup
 
-typeset POOL_FILES
-typeset POOL_NAME
-# $CONFIGS gets set in the .cfg script
-for config in $CONFIGS
-do
-	create_old_pool $config
-	log_mustnot $ZPOOL import -d /$TESTPOOL $POOL_NAME
-	log_must $ZPOOL import -d /$TESTPOOL -f $POOL_NAME
-	destroy_upgraded_pool
-done
-
-log_pass "'zpool import' fail while pool may be in use from other system," \
-	"import forcefully succeed as expected."
+uncompress_pool
+log_mustnot zpool import -d $TMPDIR $POOL_NAME
+log_must zpool import -d $TMPDIR -f $POOL_NAME
+ 
+log_pass "'zpool import' fails for pool that was not cleanly exported"

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh	Thu Sep  7 15:30:13 2017	(r323269)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh	Thu Sep  7 15:30:52 2017	(r323270)
@@ -299,29 +299,18 @@ zpool_import_012_pos_cleanup()
 }
 
 
-atf_test_case zpool_import_013_neg cleanup
+atf_test_case zpool_import_013_neg
 zpool_import_013_neg_head()
 {
-	atf_set "descr" "'zpool import' fail while pool may be in use from other system,it need import forcefully."
+	atf_set "descr" "'zpool import' fails for pool that was not cleanly exported"
 	atf_set "require.progs"  zfs zpool
-	atf_set "timeout" 2400
 }
 zpool_import_013_neg_body()
 {
-	atf_expect_fail 'BUG26195: "zpool import" without "-f" will import foreign, in-use, downrev pools'
 	. $(atf_get_srcdir)/../../../include/default.cfg
 	. $(atf_get_srcdir)/zpool_import.cfg
 
-	verify_disk_count "$DISKS" 2
-	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/zpool_import_013_neg.ksh || atf_fail "Testcase failed"
-}
-zpool_import_013_neg_cleanup()
-{
-	. $(atf_get_srcdir)/../../../include/default.cfg
-	. $(atf_get_srcdir)/zpool_import.cfg
-
-	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
 }
 
 


More information about the svn-src-projects mailing list