d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#!/bin/ksh -p
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER START
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# The contents of this file are subject to the terms of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Common Development and Distribution License (the "License").
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You may not use this file except in compliance with the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# or http://www.opensolaris.org/os/licensing.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# See the License for the specific language governing permissions
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# and limitations under the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner]
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER END
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Use is subject to license terms.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy. $STF_SUITE/include/libtest.shlib
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create.cfg
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# DESCRIPTION:
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 'zfs create' should return an error with badly formed parameters.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# STRATEGY:
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 1. Create an array of parameters
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 2. For each parameter in the array, execute 'zfs create'
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 3. Verify an error is returned.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyverify_runnable "both"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyfunction cleanup
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy{
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy if datasetexists $TESTPOOL/$TESTFS1 ; then
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zfs destroy -f $TESTPOOL/$TESTFS1
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy fi
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy}
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_onexit cleanup
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyset -A args "ab" "-?" "-cV" "-Vc" "-c -V" "c" "V" "--c" "-e" "-s" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-blah" "-cV 12k" "-s -cV 1P" "-sc" "-Vs 5g" "-o" "--o" "-O" "--O" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o QuOta=none" "-o quota=non" "-o quota=abcd" "-o quota=0" "-o quota=" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o ResErVaTi0n=none" "-o reserV=none" "-o reservation=abcd" "-o reserv=" \
e9316f7696401f3e5e263a5939031cb8d5641a88Joe Stein "-o recorDSize=64k" "-o recordsize=2048K" "-o recordsize=2M" \
e9316f7696401f3e5e263a5939031cb8d5641a88Joe Stein "-o recordsize=256" "-o recsize=" "-o recsize=zero" "-o recordsize=0" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o mountPoint=/tmp/tmpfile$$" "-o mountpoint=non0" "-o mountpoint=" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o mountpoint=LEGACY" "-o mounpoint=none" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o sharenfs=ON" "-o ShareNFS=off" "-o sharenfs=sss" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o checkSUM=on" "-o checksum=SHA256" "-o chsum=off" "-o checksum=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o checkSUM=on -V $VOLSIZE" "-o checksum=SHA256 -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o chsum=off -V $VOLSIZE" "-o checksum=aaa -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o compression=of" "-o ComPression=lzjb" "-o compress=ON" "-o compress=a" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o compression=of -V $VOLSIZE" "-o ComPression=lzjb -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o compress=ON -V $VOLSIZE" "-o compress=a -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o atime=ON" "-o ATime=off" "-o atime=bbb" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o deviCes=on" "-o devices=OFF" "-o devices=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o exec=ON" "-o EXec=off" "-o exec=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o readonly=ON" "-o reADOnly=off" "-o rdonly=OFF" "-o rdonly=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o readonly=ON -V $VOLSIZE" "-o reADOnly=off -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o rdonly=OFF -V $VOLSIZE" "-o rdonly=aaa -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o zoned=ON" "-o ZoNed=off" "-o zoned=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o snapdIR=hidden" "-o snapdir=VISible" "-o snapdir=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o aclmode=DIScard" "-o aclmODE=groupmask" "-o aclmode=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o aclinherit=deny" "-o aclinHerit=secure" "-o aclinherit=aaa" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o type=volume" "-o type=snapshot" "-o type=filesystem" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o type=volume -V $VOLSIZE" "-o type=snapshot -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o type=filesystem -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o creation=aaa" "-o creation=aaa -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o used=10K" "-o used=10K -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o available=10K" "-o available=10K -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o referenced=10K" "-o referenced=10K -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o compressratio=1.00x" "-o compressratio=1.00x -V $VOLSIZE" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o version=0" "-o version=1.234" "-o version=10K" "-o version=-1" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o version=aaa" "-o version=999"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_assert "'zfs create' should return an error with badly-formed parameters."
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset -i i=0
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedywhile [[ $i -lt ${#args[*]} ]]; do
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_mustnot zfs create ${args[i]} $TESTPOOL/$TESTFS1
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_mustnot zfs create -p ${args[i]} $TESTPOOL/$TESTFS1
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy ((i = i + 1))
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedydone
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_pass "'zfs create' with badly formed parameters failed as expected."