xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh (revision 7e12ceb3ebc63aeb71e91b496032ca22ca55f660)
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. $STF_SUITE/include/libtest.shlib
24
25verify_runnable "both"
26
27function cleanup
28{
29        if datasetexists $LDNPOOL ; then
30                log_must zpool destroy -f $LDNPOOL
31        fi
32}
33
34log_onexit cleanup
35
36log_assert "feature correctly switches between enabled and active"
37
38LDNPOOL=ldnpool
39LDNFS=$LDNPOOL/large_dnode
40log_must mkfile 64M  $TESTDIR/$LDNPOOL
41log_must zpool create $LDNPOOL $TESTDIR/$LDNPOOL
42
43
44state=$(zpool list -Ho feature@large_dnode $LDNPOOL)
45if [[ "$state" != "enabled" ]]; then
46        log_fail "large_dnode has state $state (expected enabled)"
47fi
48
49log_must zfs create -o dnodesize=1k $LDNFS
50log_must touch /$LDNFS/foo
51log_must zfs unmount $LDNFS
52
53state=$(zpool list -Ho feature@large_dnode $LDNPOOL)
54if [[ "$state" != "active" ]]; then
55        log_fail "large_dnode has state $state (expected active)"
56fi
57
58log_must zfs destroy $LDNFS
59
60state=$(zpool list -Ho feature@large_dnode $LDNPOOL)
61if [[ "$state" != "enabled" ]]; then
62        log_fail "large_dnode has state $state (expected enabled)"
63fi
64
65log_pass
66