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 2007 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27# ident	"@(#)zpool_create_010_neg.ksh	1.3	07/02/06 SMI"
28#
29. $STF_SUITE/include/libtest.kshlib
30
31################################################################################
32#
33# __stc_assertion_start
34#
35# ID: zpool_create_010_neg
36#
37# DESCRIPTION:
38# 'zpool create' should return an error with VDEVsof size  <64mb
39#
40# STRATEGY:
41# 1. Create an array of parameters
42# 2. For each parameter in the array, execute 'zpool create'
43# 3. Verify an error is returned.
44#
45# TESTABILITY: explicit
46#
47# TEST_AUTOMATION_LEVEL: automated
48#
49# CODING_STATUS: COMPLETED (2005-09-30)
50#
51# __stc_assertion_end
52#
53################################################################################
54
55log_assert "'zpool create' should return an error with VDEVs <64mb"
56
57verify_runnable "global"
58
59function cleanup
60{
61        poolexists $TOOSMALL && destroy_pool $TOOSMALL
62        poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1
63
64        poolexists $TESTPOOL && destroy_pool $TESTPOOL
65
66	[[ -d $TESTDIR ]] && $RM -rf $TESTDIR
67}
68log_onexit cleanup
69
70if [[ -n $DISK ]]; then
71        disk=$DISK
72else
73        disk=$DISK0
74fi
75
76create_pool $TESTPOOL $disk
77log_must $ZFS create $TESTPOOL/$TESTFS
78log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
79
80VDEV_SIZE=63m
81log_must create_vdevs $TESTDIR/file1 $TESTDIR/file2
82unset VDEV_SIZE
83
84set -A args \
85	"$TOOSMALL $TESTDIR/file1" "$TESTPOOL1 $TESTDIR/file1 $TESTDIR/file2" \
86        "$TOOSMALL mirror $TESTDIR/file1 $TESTDIR/file2" \
87	"$TOOSMALL raidz $TESTDIR/file1 $TESTDIR/file2"
88
89typeset -i i=0
90while [[ $i -lt ${#args[*]} ]]; do
91	log_mustnot $ZPOOL create ${args[i]}
92	((i = i + 1))
93done
94
95log_pass "'zpool create' with badly formed parameters failed as expected."
96