]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_set/version_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 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 .
$STF_SUITE/include
/libtest.shlib
29 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_upgrade
/zfs_upgrade.kshlib
33 # Valid version values should be positive integers only.
36 # 1) Form an array of invalid reservation values (negative and
38 # 2) Attempt to set each invalid version value in turn on a
39 # filesystem and volume.
40 # 3) Verify that attempt fails and the version value remains
44 verify_runnable
"both"
46 log_assert
"Verify invalid version values are rejected"
48 typeset values
=('' '-1' '-1.0' '-1.8' '-9999999999999999' \
49 '0x1' '0b' '1b' '1.1b' '0' '0.000' '1.234')
52 # Function to loop through a series of bad reservation
53 # values, checking they are when we attempt to set them
56 function set_n_check
# data-set
62 orig_val
=$
(get_prop version
$obj)
64 while (($i < ${#values[*]})); do
65 $ZFS set version
=${values[$i]} $obj > /dev
/null
2>&1
66 if [[ $?
-eq 0 ]]; then
67 log_note
"$ZFS set version=${values[$i]} $obj"
68 log_fail
"The above version set returned 0!"
71 new_val
=$
(get_prop version
$obj)
73 if [[ $new_val != $orig_val ]]; then
74 log_fail
"$obj : version values changed " \
75 "($orig_val : $new_val)"
82 for dataset
in $TESTPOOL/$TESTFS $TESTPOOL/$TESTCTR $TESTPOOL/$TESTVOL
87 log_pass
"Invalid version values correctly rejected"