annotate usr/src/test/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh @ 13899:0bcf78798346

3311 Want a test framework for arbitrary OS unit tests 3312 Add a testrunner package for OS unit tests 3313 Add a testrunner package to convert ZFS tests from STF Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com> Reviewed by: Will Guyette <will.guyette@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Adam Leventhal <ahl@delphix.com> Reviewed by: Henrik Mattson <henrik.mattson@delphix.com> Reviewed by: Sonu Pillai <sonu.pillai@delphix.com> Reviewed by: Christopher Siden <chris.siden@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Richard Lowe <richlowe@richlowe.net>
author John Wren Kennedy <john.kennedy@delphix.com>
date Wed, 05 Dec 2012 22:04:50 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13899
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
1 #!/bin/ksh -p
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
2 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
3 # CDDL HEADER START
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
4 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
5 # The contents of this file are subject to the terms of the
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
6 # Common Development and Distribution License (the "License").
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
7 # You may not use this file except in compliance with the License.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
8 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
10 # or http://www.opensolaris.org/os/licensing.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
11 # See the License for the specific language governing permissions
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
12 # and limitations under the License.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
13 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
14 # When distributing Covered Code, include this CDDL HEADER in each
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
16 # If applicable, add the following below this CDDL HEADER, with the
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
17 # fields enclosed by brackets "[]" replaced with your own identifying
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
18 # information: Portions Copyright [yyyy] [name of copyright owner]
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
19 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
20 # CDDL HEADER END
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
21 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
22
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
23 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
25 # Use is subject to license terms.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
26 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
27
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
28 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
29 # Copyright (c) 2012 by Delphix. All rights reserved.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
30 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
31
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
32 . $STF_SUITE/include/libtest.shlib
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
33 . $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create.cfg
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
34
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
35 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
36 # DESCRIPTION:
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
37 # 'zfs create' should return an error with badly formed parameters.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
38 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
39 # STRATEGY:
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
40 # 1. Create an array of parameters
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
41 # 2. For each parameter in the array, execute 'zfs create'
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
42 # 3. Verify an error is returned.
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
43 #
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
44
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
45 verify_runnable "both"
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
46
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
47 function cleanup
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
48 {
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
49 if datasetexists $TESTPOOL/$TESTFS1 ; then
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
50 log_must $ZFS destroy -f $TESTPOOL/$TESTFS1
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
51 fi
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
52 }
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
53
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
54 log_onexit cleanup
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
55
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
56 set -A args "ab" "-?" "-cV" "-Vc" "-c -V" "c" "V" "--c" "-e" "-s" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
57 "-blah" "-cV 12k" "-s -cV 1P" "-sc" "-Vs 5g" "-o" "--o" "-O" "--O" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
58 "-o QuOta=none" "-o quota=non" "-o quota=abcd" "-o quota=0" "-o quota=" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
59 "-o ResErVaTi0n=none" "-o reserV=none" "-o reservation=abcd" "-o reserv=" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
60 "-o recorDSize=64k" "-o recordsize=256K" "-o recordsize=256" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
61 "-o recsize=" "-o recsize=zero" "-o recordsize=0" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
62 "-o mountPoint=/tmp/tmpfile$$" "-o mountpoint=non0" "-o mountpoint=" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
63 "-o mountpoint=LEGACY" "-o mounpoint=none" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
64 "-o sharenfs=ON" "-o ShareNFS=off" "-o sharenfs=sss" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
65 "-o checkSUM=on" "-o checksum=SHA256" "-o chsum=off" "-o checksum=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
66 "-o checkSUM=on -V $VOLSIZE" "-o checksum=SHA256 -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
67 "-o chsum=off -V $VOLSIZE" "-o checksum=aaa -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
68 "-o compression=of" "-o ComPression=lzjb" "-o compress=ON" "-o compress=a" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
69 "-o compression=of -V $VOLSIZE" "-o ComPression=lzjb -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
70 "-o compress=ON -V $VOLSIZE" "-o compress=a -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
71 "-o atime=ON" "-o ATime=off" "-o atime=bbb" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
72 "-o deviCes=on" "-o devices=OFF" "-o devices=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
73 "-o exec=ON" "-o EXec=off" "-o exec=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
74 "-o readonly=ON" "-o reADOnly=off" "-o rdonly=OFF" "-o rdonly=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
75 "-o readonly=ON -V $VOLSIZE" "-o reADOnly=off -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
76 "-o rdonly=OFF -V $VOLSIZE" "-o rdonly=aaa -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
77 "-o zoned=ON" "-o ZoNed=off" "-o zoned=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
78 "-o snapdIR=hidden" "-o snapdir=VISible" "-o snapdir=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
79 "-o aclmode=DIScard" "-o aclmODE=groupmask" "-o aclmode=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
80 "-o aclinherit=deny" "-o aclinHerit=secure" "-o aclinherit=aaa" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
81 "-o type=volume" "-o type=snapshot" "-o type=filesystem" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
82 "-o type=volume -V $VOLSIZE" "-o type=snapshot -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
83 "-o type=filesystem -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
84 "-o creation=aaa" "-o creation=aaa -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
85 "-o used=10K" "-o used=10K -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
86 "-o available=10K" "-o available=10K -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
87 "-o referenced=10K" "-o referenced=10K -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
88 "-o compressratio=1.00x" "-o compressratio=1.00x -V $VOLSIZE" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
89 "-o version=0" "-o version=1.234" "-o version=10K" "-o version=-1" \
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
90 "-o version=aaa" "-o version=999"
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
91
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
92 log_assert "'zfs create' should return an error with badly-formed parameters."
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
93
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
94 typeset -i i=0
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
95 while [[ $i -lt ${#args[*]} ]]; do
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
96 log_mustnot $ZFS create ${args[i]} $TESTPOOL/$TESTFS1
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
97 log_mustnot $ZFS create -p ${args[i]} $TESTPOOL/$TESTFS1
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
98 ((i = i + 1))
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
99 done
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
100
0bcf78798346 3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff changeset
101 log_pass "'zfs create' with badly formed parameters failed as expected."