]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_001_neg.ksh
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.
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.
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]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_snapshot
/zfs_snapshot.cfg
37 # Try each 'zfs snapshot' with inapplicable scenarios to make sure
38 # it returns an error. include:
39 # * No arguments given.
40 # * The argument contains invalid characters for the ZFS namesapec
41 # * Leading slash in snapshot name
42 # * The argument contains an empty component.
43 # * Missing '@' delimiter.
44 # * Multiple '@' delimiters in snapshot name.
45 # * The snapshot already exist.
46 # * Create snapshot upon the pool.
47 # (Be removed since pool is treated as filesystem as well)
48 # * Create snapshot upon a non-existent filesystem.
49 # * Too many arguments.
52 # 1. Create an array of parameters
53 # 2. For each parameter in the array, execute the sub-command
54 # 3. Verify an error is returned.
57 verify_runnable
"both"
60 "$TESTPOOL/$TESTFS@blah*" "$TESTPOOL/$TESTFS@blah?" \
61 "$TESTPOOL/$TESTVOL@blah*" "$TESTPOOL/$TESTVOL@blah?" \
62 "/$TESTPOOL/$TESTFS@$TESTSNAP" "/$TESTPOOL/$TESTVOL@$TESTSNAP" \
63 "@$TESTSNAP" "$TESTPOOL/$TESTFS@" "$TESTPOOL/$TESTVOL@" \
64 "$TESTPOOL//$TESTFS@$TESTSNAP" "$TESTPOOL//$TESTVOL@$TESTSNAP" \
65 "$TESTPOOL/$TESTFS/$TESTSNAP" "$TESTPOOL/$TESTVOL/$TESTSNAP" \
66 "$TESTPOOL/$TESTFS@$TESTSNAP@$TESTSNAP1" \
67 "$TESTPOOL/$TESTVOL@$TESTSNAP@$TESTSNAP1" \
68 "$SNAPFS" "$SNAPFS1" \
75 log_note
"Create snapshots and mount them..."
77 for snap
in $SNAPFS $SNAPFS1; do
78 if ! snapexists
$snap; then
79 log_must
$ZFS snapshot
$snap
90 while (( i
< ${#args[*]} )); do
91 for snap
in ${args[i]}; do
92 snapexists
$snap && log_must
$ZFS destroy
-f $snap
97 for mtpt
in $SNAPDIR $SNAPDIR1; do
98 [[ -d $mtpt ]] && log_must
$RM -rf $mtpt
104 log_assert
"Badly-formed 'zfs snapshot' with inapplicable scenarios " \
105 "should return an error."
106 log_onexit cleanup_all
111 while (( i
< ${#args[*]} )); do
112 log_mustnot
$ZFS snapshot
${args[i]}
116 log_pass
"Badly formed 'zfs snapshot' with inapplicable scenarios " \