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