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 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_create
/zpool_create.shlib
37 # 'zpool create' should return an error with badly formed parameters.
40 # 1. Create an array of parameters
41 # 2. For each parameter in the array, execute 'zpool create'
42 # 3. Verify an error is returned.
45 verify_runnable
"global"
47 if [[ -n $DISK ]]; then
53 set -A args
"" "-?" "-n" "-f" "-nf" "-fn" "-f -n" "--f" "-e" "-s" \
54 "-m" "-R" "-m -R" "-Rm" "-mR" "-m $TESTDIR $TESTPOOL" \
55 "-R $TESTDIR $TESTPOOL" "-m nodir $TESTPOOL $disk" \
56 "-R nodir $TESTPOOL $disk" "-m nodir -R nodir $TESTPOOL $disk" \
57 "-R nodir -m nodir $TESTPOOL $disk" "-R $TESTDIR -m nodir $TESTPOOL $disk" \
58 "-R nodir -m $TESTDIR $TESTPOOL $disk" \
59 "-blah" "$TESTPOOL" "$TESTPOOL blah" "$TESTPOOL c?t0d0" \
60 "$TESTPOOL c0txd0" "$TESTPOOL c0t0dx" "$TESTPOOL cxtxdx" \
61 "$TESTPOOL mirror" "$TESTPOOL raidz" "$TESTPOOL mirror raidz" \
62 "$TESTPOOL raidz1" "$TESTPOOL mirror raidz1" \
63 "$TESTPOOL mirror c?t?d?" "$TESTPOOL mirror $disk c0t1d?" \
64 "$TESTPOOL RAIDZ ${disk}s${SLICE0} ${disk}s${SLICE1}" \
65 "$TESTPOOL ${disk}s${SLICE0} log ${disk}s${SLICE1} \
66 log ${disk}s${SLICE3}" \
67 "$TESTPOOL ${disk}s${SLICE0} spare ${disk}s${SLICE1} \
68 spare ${disk}s${SLICE3}" \
69 "$TESTPOOL RAIDZ1 ${disk}s${SLICE0} ${disk}s${SLICE1}" \
70 "$TESTPOOL MIRROR $disk" "$TESTPOOL raidz $disk" \
71 "$TESTPOOL raidz1 $disk" \
72 "1tank $disk" "1234 $disk" "?tank $disk" \
73 "tan%k $disk" "ta@# $disk" "tan+k $disk" \
74 "$BYND_MAX_NAME $disk"
76 log_assert
"'zpool create' should return an error with badly-formed parameters."
77 log_onexit default_cleanup_noexit
80 while [[ $i -lt ${#args[*]} ]]; do
81 log_mustnot
$ZPOOL create
${args[i]}
85 log_pass
"'zpool create' with badly formed parameters failed as expected."