xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/projectquota/projecttree_003_neg.ksh (revision f67950b21e185934ccabe311516f4dcbdb00ef79)
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 2009 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27
28#
29# Copyright (c) 2017 by Fan Yong. All rights reserved.
30#
31
32. $STF_SUITE/tests/functional/projectquota/projectquota_common.kshlib
33
34#
35#
36# DESCRIPTION:
37#	Check 'zfs project' invalid options combinations
38#
39#
40# STRATEGY:
41#	Verify the following:
42#	1. "-c" only supports "-d", "-p", "-r" and "-0".
43#	2. "-C" only supports "-r" and "-k".
44#	3. "-s" only supports "-r" and "-p".
45#	4. "-c", "-C" and "-s" can NOT be specified together.
46#	5. "-d" can overwirte former "-r".
47#	6. "-r" can overwirte former "-d".
48#	7. "-0" must be together with "-c".
49#	8. "-d" must be on directory.
50#	9. "-r" must be on directory.
51#	10. "-p" must be together with "-c -r" or "-s".
52#
53
54function cleanup
55{
56	log_must rm -rf $PRJDIR
57}
58
59log_onexit cleanup
60
61log_assert "Check 'zfs project' invalid options combinations"
62
63log_must mkdir $PRJDIR
64log_must mkdir $PRJDIR/a1
65log_must touch $PRJDIR/a2
66
67log_mustnot zfs project -c
68log_mustnot zfs project -c -k $PRJDIR/a1
69log_mustnot zfs project -c -C $PRJDIR/a1
70log_mustnot zfs project -c -s $PRJDIR/a1
71log_must zfs project -c -d -r $PRJDIR/a1
72log_must zfs project -c -r -d $PRJDIR/a1
73log_mustnot zfs project -c -d $PRJDIR/a2
74log_mustnot zfs project -c -r $PRJDIR/a2
75
76log_mustnot zfs project -C
77log_mustnot zfs project -C -c $PRJDIR/a1
78log_mustnot zfs project -C -d $PRJDIR/a1
79log_mustnot zfs project -C -p 100 $PRJDIR/a1
80log_mustnot zfs project -C -s $PRJDIR/a1
81log_mustnot zfs project -C -r -0 $PRJDIR/a1
82log_mustnot zfs project -C -0 $PRJDIR/a1
83
84log_mustnot zfs project -s
85log_mustnot zfs project -s -d $PRJDIR/a1
86log_mustnot zfs project -s -k $PRJDIR/a1
87log_mustnot zfs project -s -r -0 $PRJDIR/a1
88log_mustnot zfs project -s -0 $PRJDIR/a1
89log_mustnot zfs project -s -r $PRJDIR/a2
90
91log_mustnot zfs project -p 100
92log_mustnot zfs project -p -1 $PRJDIR/a2
93log_mustnot zfs project -p 100 -d $PRJDIR/a1
94log_mustnot zfs project -p 100 -k $PRJDIR/a1
95log_mustnot zfs project -p 100 -0 $PRJDIR/a1
96log_mustnot zfs project -p 100 -r -0 $PRJDIR/a1
97
98log_mustnot zfs project
99log_mustnot zfs project -0 $PRJDIR/a2
100log_mustnot zfs project -k $PRJDIR/a2
101log_mustnot zfs project -S $PRJDIR/a1
102
103log_pass "Check 'zfs project' invalid options combinations"
104