]> git.proxmox.com Git - mirror_zfs.git/blame - tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh
OpenZFS 7290 - ZFS test suite needs to control what utilities it can run
[mirror_zfs.git] / tests / zfs-tests / tests / functional / cli_root / zpool_create / zpool_create_features_002_pos.ksh
CommitLineData
6bb24f4d
BB
1#!/bin/ksh -p
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
c1d9abf9 24# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
6bb24f4d
BB
25#
26
27. $STF_SUITE/include/libtest.shlib
7050a65d 28. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
6bb24f4d
BB
29
30################################################################################
31#
32# When using the '-d' option or specifying '-o version=X' new pools should
33# have all features disabled.
34#
35# 1. Create a new pool with '-d'.
36# 2. Verify that every feature@ property is in the 'disabled' state
37# 3. Destroy pool and re-create with -o version=28
38# 4. Verify again.
39#
40################################################################################
41
42verify_runnable "global"
43
44function cleanup
45{
c1d9abf9 46 datasetexists $TESTPOOL && log_must zpool destroy $TESTPOOL
6bb24f4d
BB
47}
48
49function check_features
50{
c1d9abf9
JWK
51 for prop in $(zpool get all $TESTPOOL | awk '$2 ~ /feature@/ { print $2 }'); do
52 state=$(zpool list -Ho "$prop" $TESTPOOL)
6bb24f4d
BB
53 if [[ "$state" != "disabled" ]]; then
54 log_fail "$prop is enabled on new pool"
55 fi
56 done
57}
58
59log_onexit cleanup
60
61log_assert "'zpool create -d' creates pools with all features disabled"
62
c1d9abf9 63log_must zpool create -f -d $TESTPOOL $DISKS
6bb24f4d 64check_features
c1d9abf9 65log_must zpool destroy -f $TESTPOOL
6bb24f4d 66
c1d9abf9 67log_must zpool create -f -o version=28 $TESTPOOL $DISKS
6bb24f4d
BB
68check_features
69
70log_pass