]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_set/zpool_set_002_neg.ksh
a4c8a28992d98513c5c2d212ef4ce504f06d65e5
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) 2012, 2015 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
37 # Malformed zpool set commands are rejected
40 # 1. Create an array of many different malformed zfs set arguments
41 # 2. Run zpool set for each arg checking each will exit with status code 1
45 verify_runnable
"global"
47 # note to self - need to make sure there isn't a pool called bootfs
48 # before running this test...
52 $RM /tmp
/zpool_set_002.$$.dat
55 log_assert
"Malformed zpool set commands are rejected"
59 log_unsupported
"Unable to run test on a machine with a pool called \
65 # build up an array of bad arguments.
66 set -A arguments
"rubbish " \
72 "bootfs=bootfs/123 " \
73 "bootfs=bootfs@val " \
86 # here, we build up a large string.
87 # a word to the ksh-wary, ${#array[@]} gives you the
88 # total number of entries in an array, so array[${#array[@]}]
89 # will index the last entry+1, ksh arrays start at index 0.
91 while [ $COUNT -le 1025 ]
94 COUNT
=$
(( $COUNT + 1 ))
97 # add an argument of maximum length property name
98 arguments
[${#arguments[@]}]="$bigname=value"
100 # add an argument of maximum length property value
101 arguments
[${#arguments[@]}]="bootfs=$bigname"
103 # Create a pool called bootfs (so-called, so as to trip any clashes between
104 # property name, and pool name)
105 # Also create a filesystem in this pool
106 log_must
$MKFILE $MINVDEVSIZE /tmp
/zpool_set_002.$$.dat
107 log_must
$ZPOOL create bootfs
/tmp
/zpool_set_002.$$.dat
108 log_must
$ZFS create bootfs
/root
111 while [ $i -lt "${#arguments[@]}" ]
113 log_mustnot
eval "$ZPOOL set ${arguments[$i]} > /dev/null 2>&1"
115 # now also try with a valid pool in the argument list
116 log_mustnot
eval "$ZPOOL set ${arguments[$i]}bootfs > /dev/null 2>&1"
118 # now also try with two valid pools in the argument list
119 log_mustnot
eval "$ZPOOL set ${arguments[$i]}bootfs bootfs > /dev/null"
123 log_pass
"Malformed zpool set commands are rejected"