xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh (revision f012ee0c3db17469b492c2cf757226f3d7b1ebbc)
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) 2015, 2016 by Delphix. All rights reserved.
30#
31
32. $STF_SUITE/include/libtest.shlib
33
34#
35# DESCRIPTION:
36# 'zpool create -O' should return an error with badly formed parameters.
37#
38# STRATEGY:
39# 1. Create an array of parameters with '-O'
40# 2. For each parameter in the array, execute 'zpool create -O'
41# 3. Verify an error is returned.
42#
43
44verify_runnable "global"
45
46function cleanup
47{
48	datasetexists $TESTPOOL && log_must zpool destroy $TESTPOOL
49}
50
51log_onexit cleanup
52
53set -A args "QuOta=none" "quota=non" "quota=abcd" "quota=0" "quota=" \
54    "ResErVaTi0n=none" "reserV=none" "reservation=abcd" "reserv=" \
55    "recorDSize=64k" "recordsize=2M" "recordsize=2048K" \
56    "recordsize=256" "recsize=" "recsize=zero" "recordsize=0" \
57    "mountPoint=/tmp/tmpfile$$" "mountpoint=non0" "mountpoint=" \
58    "mountpoint=LEGACY" "mounpoint=none" \
59    "sharenfs=ON" "ShareNFS=off" "sharenfs=sss" \
60    "checkSUM=on" "checksum=SHA256" "chsum=off" "checksum=aaa" \
61    "compression=of" "ComPression=lzjb" "compress=ON" "compress=a" \
62    "atime=ON" "ATime=off" "atime=bbb" \
63    "deviCes=on" "devices=OFF" "devices=aaa" \
64    "exec=ON" "EXec=off" "exec=aaa" \
65    "readonly=ON" "reADOnly=off" "rdonly=OFF" "rdonly=aaa" \
66    "zoned=ON" "ZoNed=off" "zoned=aaa" \
67    "snapdIR=hidden" "snapdir=VISible" "snapdir=aaa" \
68    "aclmode=DIScard" "aclmODE=groupmask" "aclmode=aaa" \
69    "aclinherit=deny" "aclinHerit=secure" "aclinherit=aaa" \
70    "type=volume" "type=snapshot" "type=filesystem" \
71    "creation=aaa" "used=10K" "available=10K" \
72    "referenced=10K" "compressratio=1.00x" \
73    "version=0" "version=1.234" "version=10K" "version=-1" \
74    "version=aaa" "version=999"
75
76log_assert "'zpool create -O' should return an error with badly formed parameters."
77
78typeset -i i=0
79while (( $i < ${#args[*]} )); do
80	log_mustnot zpool create -O ${args[i]} -f $TESTPOOL $DISKS
81	((i = i + 1))
82done
83
84log_pass "'zpool create -O' should return an error with badly formed parameters."
85
86