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]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2017 by Fan Yong. Fan rights reserved.
32 . $STF_SUITE/tests/functional/projectquota/projectquota_common.kshlib
36 # Check the zfs projectspace with kinds of parameters
40 # 1. set zfs projectspace to a fs
41 # 2. write some data to the fs with specified project ID
42 # 3. use zfs projectspace with all possible parameters to check the result
43 # 4. use zfs projectspace with some bad parameters to check the result
48 if datasetexists $snap_fs; then
49 log_must zfs destroy $snap_fs
52 log_must cleanup_projectquota
55 if ! lsattr -pd > /dev/null 2>&1; then
56 log_unsupported "Current e2fsprogs does not support set/show project ID"
61 log_assert "Check the zfs projectspace with all possible parameters"
63 set -A good_params -- "-H" "-p" "-o type,name,used,quota" "-o name,used,quota" \
64 "-o used,quota" "-o objused" "-o quota" "-s type" "-s name" "-s used" \
65 "-s quota" "-S type" "-S name" "-S used" "-S quota"
67 typeset snap_fs=$QFS@snap
69 log_must zfs set projectquota@$PRJID1=100m $QFS
70 log_must zfs set projectobjquota@$PRJID1=100 $QFS
72 log_must user_run $PUSER mkdir $PRJDIR
73 log_must chattr +P -p $PRJID1 $PRJDIR
74 log_must user_run $PUSER mkfile 50m $PRJDIR/qf
77 log_must zfs snapshot $snap_fs
79 for param in "${good_params[@]}"; do
80 log_must eval "zfs projectspace $param $QFS >/dev/null 2>&1"
81 log_must eval "zfs projectspace $param $snap_fs >/dev/null 2>&1"
84 log_assert "Check the zfs projectspace with some bad parameters"
86 set -A bad_params -- "-i" "-n" "-P" "-t posixuser"
88 for param in "${bad_params[@]}"; do
89 log_mustnot eval "zfs projectspace $param $QFS >/dev/null 2>&1"
90 log_mustnot eval "zfs projectspace $param $snap_fs >/dev/null 2>&1"
93 log_pass "zfs projectspace with kinds of parameters pass"