aboutsummaryrefslogtreecommitdiff
path: root/tests/zfs-tests/tests/functional/poolversion
diff options
context:
space:
mode:
authorBrian Behlendorf <behlendorf1@llnl.gov>2015-07-01 22:23:09 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2016-03-16 20:46:16 +0000
commit6bb24f4dc7b7267699e3c3a4ca1ca062fe564b9e (patch)
treeaabbb51e18eadc173599f8ed700ab98e198d6ffd /tests/zfs-tests/tests/functional/poolversion
parent887d1e60ef1f20a1b13e7c7b0d208f10b13b9cbe (diff)
downloadsrc-6bb24f4dc7b7267699e3c3a4ca1ca062fe564b9e.tar.gz
src-6bb24f4dc7b7267699e3c3a4ca1ca062fe564b9e.zip
Diffstat (limited to 'tests/zfs-tests/tests/functional/poolversion')
-rw-r--r--tests/zfs-tests/tests/functional/poolversion/Makefile.am6
-rwxr-xr-xtests/zfs-tests/tests/functional/poolversion/cleanup.ksh42
-rwxr-xr-xtests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh58
-rwxr-xr-xtests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh71
-rwxr-xr-xtests/zfs-tests/tests/functional/poolversion/setup.ksh45
5 files changed, 222 insertions, 0 deletions
diff --git a/tests/zfs-tests/tests/functional/poolversion/Makefile.am b/tests/zfs-tests/tests/functional/poolversion/Makefile.am
new file mode 100644
index 000000000000..51c2046457df
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/poolversion/Makefile.am
@@ -0,0 +1,6 @@
+pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/poolversion
+dist_pkgdata_SCRIPTS = \
+ setup.ksh \
+ cleanup.ksh \
+ poolversion_001_pos.ksh \
+ poolversion_002_pos.ksh
diff --git a/tests/zfs-tests/tests/functional/poolversion/cleanup.ksh b/tests/zfs-tests/tests/functional/poolversion/cleanup.ksh
new file mode 100755
index 000000000000..6555a0d156dc
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/poolversion/cleanup.ksh
@@ -0,0 +1,42 @@
+#!/bin/ksh -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.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+log_must $ZPOOL destroy $TESTPOOL
+log_must $ZPOOL destroy $TESTPOOL2
+
+log_must $RM /tmp/zpool_version_1.dat
+log_must $RM /tmp/zpool2_version_1.dat
+
+default_cleanup
diff --git a/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh b/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh
new file mode 100755
index 000000000000..662221303cd3
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -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 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+#
+# zpool set version can upgrade a pool
+#
+# STRATEGY:
+# 1. Taking a version 1 pool
+# 2. For all known versions, set the version of the pool using zpool set
+# 3. Verify that pools version
+#
+
+verify_runnable "global"
+log_assert "zpool set version can upgrade a pool"
+for version in 1 2 3 4 5 6 7 8
+do
+ log_must $ZPOOL set version=$version $TESTPOOL
+ ACTUAL=$($ZPOOL get version $TESTPOOL | $GREP version \
+ | $AWK '{print $3}')
+ if [ "$ACTUAL" != "$version" ]
+ then
+ log_fail "v. $ACTUAL set for $TESTPOOL, expected v. $version!"
+ fi
+done
+
+log_pass "zpool set version can upgrade a pool"
diff --git a/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh b/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh
new file mode 100755
index 000000000000..9c51a8846a5d
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh
@@ -0,0 +1,71 @@
+#!/bin/ksh -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 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+#
+# zpool set version can only increment pool version
+#
+# STRATEGY:
+# 1. Set a version 1 pool to be a version 6 pool
+# 2. Verify it's set to version 6
+# 3. Attempt to set prior versions
+# 4. Verify it's still set to version 6
+#
+
+verify_runnable "global"
+log_assert "zpool set version can only increment pool version"
+
+log_must $ZPOOL set version=6 $TESTPOOL2
+# verify it's actually that version - by checking the version property
+# and also by trying to set bootfs (which should fail if it is not version 6)
+
+VERSION=$($ZPOOL get version $TESTPOOL2| $GREP version | $AWK '{print $3}')
+if [ "$VERSION" != "6" ]
+then
+ log_fail "Version $VERSION set for $TESTPOOL2 expected version 6!"
+fi
+log_must $ZPOOL set bootfs=$TESTPOOL2 $TESTPOOL2
+
+# now verify we can't downgrade the version
+log_mustnot $ZPOOL set version=5 $TESTPOOL2
+log_mustnot $ZPOOL set version=-1 $TESTPOOL2
+
+# verify the version is still 6
+VERSION=$($ZPOOL get version $TESTPOOL2 | $GREP version | $AWK '{print $3}')
+if [ "$VERSION" != "6" ]
+then
+ log_fail "Version $VERSION set for $TESTPOOL2, expected version 6!"
+fi
+
+log_pass "zpool set version can only increment pool version"
diff --git a/tests/zfs-tests/tests/functional/poolversion/setup.ksh b/tests/zfs-tests/tests/functional/poolversion/setup.ksh
new file mode 100755
index 000000000000..cfe14a030a21
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/poolversion/setup.ksh
@@ -0,0 +1,45 @@
+#!/bin/ksh -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.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+# create a version 1 pool
+log_must $MKFILE 64m /tmp/zpool_version_1.dat
+log_must $ZPOOL create -o version=1 $TESTPOOL /tmp/zpool_version_1.dat
+
+
+# create another version 1 pool
+log_must $MKFILE 64m /tmp/zpool2_version_1.dat
+log_must $ZPOOL create -o version=1 $TESTPOOL2 /tmp/zpool2_version_1.dat
+
+log_pass