]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_001_neg.ksh
MFC r353117-r353118, r353281-r353282, r353284-r353289, r353309-r353310, r353360-r3533...
[FreeBSD/FreeBSD.git] / tests / sys / cddl / zfs / tests / cli_root / zdb / zdb_001_neg.ksh
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 2008 Sun Microsystems, Inc.  All rights reserved.
27 # Use is subject to license terms.
28 #
29 # ident "@(#)zdb_001_neg.ksh    1.4     08/02/27 SMI"
30 #
31 . $STF_SUITE/include/libtest.kshlib
32
33 ################################################################################
34 #
35 # __stc_assertion_start
36 #
37 # ID: zdb_001_neg
38 #
39 # DESCRIPTION:
40 # A badly formed parameter passed to zdb(1) should
41 # return an error.
42 #
43 # STRATEGY:
44 # 1. Create an array containg bad zdb parameters.
45 # 2. For each element, execute the sub-command.
46 # 3. Verify it returns an error.
47 #
48 # TESTABILITY: explicit
49 #
50 # TEST_AUTOMATION_LEVEL: automated
51 #
52 # CODING_STATUS: COMPLETED (2005-09-28)
53 #
54 # __stc_assertion_end
55 #
56 ################################################################################
57
58 verify_runnable "global"
59
60 set -A args "create" "add" "destroy" "import fakepool" \
61     "export fakepool" "create fakepool" "add fakepool" \
62     "create mirror" "create raidz" \
63     "create mirror fakepool" "create raidz fakepool" \
64     "create raidz1 fakepool" "create raidz2 fakepool" \
65     "create fakepool mirror" "create fakepool raidz" \
66     "create fakepool raidz1" "create fakepool raidz2" \
67     "add fakepool mirror" "add fakepool raidz" \
68     "add fakepool raidz1" "add fakepool raidz2" \
69     "add mirror fakepool" "add raidz fakepool" \
70     "add raidz1 fakepool" "add raidz2 fakepool" \
71     "setvprop" "blah blah" "-%" "--?" "-*" "-=" \
72     "-a" "-f" "-g" "-h" "-j" "-m" "-n" "-p" "-p /tmp" \
73     "-r" "-t" "-w" "-x" "-y" "-z" \
74     "-D" "-E" "-G" "-H" "-I" "-J" "-K" "-M" \
75     "-N" "-Q" "-T" "-W"
76
77 log_assert "Execute zdb using invalid parameters."
78
79 typeset -i i=0
80 while [[ $i -lt ${#args[*]} ]]; do
81         log_mustnot $ZDB ${args[i]}
82
83         ((i = i + 1))
84 done
85
86 log_pass "Badly formed zdb parameters fail as expected."