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