3311 Want a test framework for arbitrary OS unit tests
[illumos-gate.git] / usr / src / test / zfs-tests / tests / functional / cli_root / zpool_import / zpool_import_features_001_pos.ksh
blobea71acfd2cbd680fff7b37b27fefefd62466a834
1 #!/bin/ksh -p
3 # CDDL HEADER START
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.
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.
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]
20 # CDDL HEADER END
24 # Copyright (c) 2012 by Delphix. All rights reserved.
27 . $STF_SUITE/include/libtest.shlib
28 . $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
30 #################################################################################
32 # Pool can be imported with inactive unsupported features.
34 # 1. Create new pool.
35 # 2. Export and inject unsuppored features with zhack.
36 # 3. Import pool normally with no problems.
37 # 4. Verify that unsupported@ properties exist for the unsupported features.
39 ################################################################################
41 verify_runnable "global"
43 features="com.test:xxx_unsup0 com.test:xxx_unsup1 com.test:xxx_unsup2"
45 function cleanup
47 poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1
49 log_must $RM $VDEV0
50 log_must $MKFILE $FILE_SIZE $VDEV0
53 log_assert "Pool with inactive unsupported features can be imported."
54 log_onexit cleanup
56 log_must $ZPOOL create $TESTPOOL1 $VDEV0
57 log_must $ZPOOL export $TESTPOOL1
59 for feature in $features; do
60 log_must $ZHACK -d $DEVICE_DIR feature enable $TESTPOOL1 $feature
61 done
63 log_must $ZPOOL import -d $DEVICE_DIR $TESTPOOL1
64 for feature in $features; do
65 state=$($ZPOOL list -Ho unsupported@$feature $TESTPOOL1)
66 if [[ "$state" != "inactive" ]]; then
67 log_fail "unsupported@$feature is '$state'"
69 done
71 log_pass