1#!/usr/local/bin/ksh93 -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. $STF_SUITE/include/libtest.kshlib
27
28################################################################################
29#
30# __stc_assertion_start
31#
32# ID: zpool_create_023_neg
33#
34# DESCRIPTION:
35# 'zpool create -O' should return an error with badly formed parameters.
36#
37# STRATEGY:
38# 1. Create an array of parameters with '-O'
39# 2. For each parameter in the array, execute 'zpool create -O'
40# 3. Verify an error is returned.
41#
42# TESTABILITY: explicit
43#
44# TEST_AUTOMATION_LEVEL: automated
45#
46# CODING_STATUS: COMPLETED (2009-04-27)
47#
48# __stc_assertion_end
49#
50################################################################################
51
52if ! $(check_zpool_opt_support "create" "-O") ; then
53	log_unsupported "-O option is not supported yet."
54fi
55
56verify_runnable "global"
57
58function cleanup
59{
60	destroy_pool $TESTPOOL
61}
62
63log_onexit cleanup
64
65set -A args "QuOta=none" "quota=non" "quota=abcd" "quota=0" "quota=" \
66    "ResErVaTi0n=none" "reserV=none" "reservation=abcd" "reserv=" \
67    "recorDSize=64k" "recordsize=32M" "recordsize=256" \
68    "recsize=" "recsize=zero" "recordsize=0" \
69    "mountPoint=/tmp/tmpfile${TESTCASE_ID}" "mountpoint=non0" "mountpoint=" \
70    "mountpoint=LEGACY" "mounpoint=none" \
71    "sharenfs=ON" "ShareNFS=off" "sharenfs=sss" \
72    "checkSUM=on" "checksum=SHA256" "chsum=off" "checksum=aaa" \
73    "compression=of" "ComPression=lzjb" "compress=ON" "compress=a" \
74    "atime=ON" "ATime=off" "atime=bbb" \
75    "deviCes=on" "devices=OFF" "devices=aaa" \
76    "exec=ON" "EXec=off" "exec=aaa" \
77    "readonly=ON" "reADOnly=off" "rdonly=OFF" "rdonly=aaa" \
78    "zoned=ON" "ZoNed=off" "zoned=aaa" \
79    "snapdIR=hidden" "snapdir=VISible" "snapdir=aaa" \
80    "aclmode=DIScard" "aclmODE=groupmask" "aclmode=aaa" \
81    "aclinherit=deny" "aclinHerit=secure" "aclinherit=aaa" \
82    "type=volume" "type=snapshot" "type=filesystem" \
83    "creation=aaa" "used=10K" "available=10K" \
84    "referenced=10K" "compressratio=1.00x" \
85    "version=0" "version=1.234" "version=10K" "version=-1" \
86    "version=aaa" "version=999"
87
88log_assert "'zpool create -O' should return an error with badly formed parameters."
89
90typeset -i i=0
91while (( $i < ${#args[*]} )); do
92	log_mustnot $ZPOOL create -O ${args[i]} -f $TESTPOOL $DISKS
93	((i = i + 1))
94done
95
96log_pass "'zpool create -O' should return an error with badly formed parameters."
97
98