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