mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-06-01 19:54:10 +03:00
Add the ZFS Test Suite
Add the ZFS Test Suite and test-runner framework from illumos.
This is a continuation of the work done by Turbo Fredriksson to
port the ZFS Test Suite to Linux. While this work was originally
conceived as a stand alone project integrating it directly with
the ZoL source tree has several advantages:
* Allows the ZFS Test Suite to be packaged in zfs-test package.
* Facilitates easy integration with the CI testing.
* Users can locally run the ZFS Test Suite to validate ZFS.
This testing should ONLY be done on a dedicated test system
because the ZFS Test Suite in its current form is destructive.
* Allows the ZFS Test Suite to be run directly in the ZoL source
tree enabled developers to iterate quickly during development.
* Developers can easily add/modify tests in the framework as
features are added or functionality is changed. The tests
will then always be in sync with the implementation.
Full documentation for how to run the ZFS Test Suite is available
in the tests/README.md file.
Warning: This test suite is designed to be run on a dedicated test
system. It will make modifications to the system including, but
not limited to, the following.
* Adding new users
* Adding new groups
* Modifying the following /proc files:
* /proc/sys/kernel/core_pattern
* /proc/sys/kernel/core_uses_pid
* Creating directories under /
Notes:
* Not all of the test cases are expected to pass and by default
these test cases are disabled. The failures are primarily due
to assumption made for illumos which are invalid under Linux.
* When updating these test cases it should be done in as generic
a way as possible so the patch can be submitted back upstream.
Most existing library functions have been updated to be Linux
aware, and the following functions and variables have been added.
* Functions:
* is_linux - Used to wrap a Linux specific section.
* block_device_wait - Waits for block devices to be added to /dev/.
* Variables: Linux Illumos
* ZVOL_DEVDIR "/dev/zvol" "/dev/zvol/dsk"
* ZVOL_RDEVDIR "/dev/zvol" "/dev/zvol/rdsk"
* DEV_DSKDIR "/dev" "/dev/dsk"
* DEV_RDSKDIR "/dev" "/dev/rdsk"
* NEWFS_DEFAULT_FS "ext2" "ufs"
* Many of the disabled test cases fail because 'zfs/zpool destroy'
returns EBUSY. This is largely causes by the asynchronous nature
of device handling on Linux and is expected, the impacted test
cases will need to be updated to handle this.
* There are several test cases which have been disabled because
they can trigger a deadlock. A primary example of this is to
recursively create zpools within zpools. These tests have been
disabled until the root issue can be addressed.
* Illumos specific utilities such as (mkfile) should be added to
the tests/zfs-tests/cmd/ directory. Custom programs required by
the test scripts can also be added here.
* SELinux should be either is permissive mode or disabled when
running the tests. The test cases should be updated to conform
to a standard policy.
* Redundant test functionality has been removed (zfault.sh).
* Existing test scripts (zconfig.sh) should be migrated to use
the framework for consistency and ease of testing.
* The DISKS environment variable currently only supports loopback
devices because of how the ZFS Test Suite expects partitions to
be named (p1, p2, etc). Support must be added to generate the
correct partition name based on the device location and name.
* The ZFS Test Suite is part of the illumos code base at:
https://github.com/illumos/illumos-gate/tree/master/usr/src/test
Original-patch-by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #6
Closes #1534
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/refquota
|
||||
dist_pkgdata_SCRIPTS = \
|
||||
setup.ksh \
|
||||
cleanup.ksh \
|
||||
refquota_001_pos.ksh \
|
||||
refquota_002_pos.ksh \
|
||||
refquota_003_pos.ksh \
|
||||
refquota_004_pos.ksh \
|
||||
refquota_005_pos.ksh \
|
||||
refquota_006_neg.ksh
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
verify_runnable "both"
|
||||
default_cleanup
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# refquota limits the amount of space a dataset can consume, but does
|
||||
# not include space used by descendents.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Setting refquota in given filesystem
|
||||
# 2. Create descendent filesystem
|
||||
# 3. Verify refquota limits the amount of space a dataset can consume
|
||||
# 4. Verify the limit does not impact descendents
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rf $TESTPOOL/$TESTFS
|
||||
log_must $ZFS create $TESTPOOL/$TESTFS
|
||||
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||
}
|
||||
|
||||
log_assert "refquota limits the amount of space a dataset can consume, " \
|
||||
"but does not include space used by descendents."
|
||||
log_onexit cleanup
|
||||
|
||||
fs=$TESTPOOL/$TESTFS
|
||||
sub=$fs/sub
|
||||
log_must $ZFS create $sub
|
||||
|
||||
log_must $ZFS set refquota=10M $fs
|
||||
mntpnt=$(get_prop mountpoint $fs)
|
||||
|
||||
log_mustnot $MKFILE 11M $mntpnt/file
|
||||
log_must $MKFILE 9M $mntpnt/file
|
||||
log_must $ZFS snapshot $fs@snap
|
||||
log_mustnot $MKFILE 2M $mntpnt/file2
|
||||
|
||||
mntpnt=$(get_prop mountpoint $sub)
|
||||
log_must $MKFILE 10M $mntpnt/file
|
||||
log_must $ZFS snapshot $sub@snap
|
||||
log_must $MKFILE 10 $mntpnt/file2
|
||||
|
||||
log_pass "refquota limits the amount of space a dataset can consume, " \
|
||||
"but does not include space used by descendents."
|
||||
@@ -0,0 +1,90 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Quotas are enforced using the minimum of the two properties:
|
||||
# quota & refquota
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Set value for quota and refquota. Quota less than refquota.
|
||||
# 2. Creating file which should be limited by quota.
|
||||
# 3. Switch the value of quota and refquota.
|
||||
# 4. Verify file should be limited by refquota.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rf $TESTPOOL/$TESTFS
|
||||
log_must $ZFS create $TESTPOOL/$TESTFS
|
||||
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||
}
|
||||
|
||||
log_assert "Quotas are enforced using the minimum of the two properties"
|
||||
log_onexit cleanup
|
||||
|
||||
TESTFILE='testfile'
|
||||
fs=$TESTPOOL/$TESTFS
|
||||
log_must $ZFS set quota=15M $fs
|
||||
log_must $ZFS set refquota=25M $fs
|
||||
|
||||
mntpnt=$(get_prop mountpoint $fs)
|
||||
log_mustnot $MKFILE 20M $mntpnt/$TESTFILE
|
||||
typeset -i used quota
|
||||
used=$(get_prop used $fs)
|
||||
quota=$(get_prop quota $fs)
|
||||
((used = used / (1024 * 1024)))
|
||||
((quota = quota / (1024 * 1024)))
|
||||
if [[ $used -ne $quota ]]; then
|
||||
log_fail "ERROR: $used -ne $quota Quotas are not limited by quota"
|
||||
fi
|
||||
|
||||
#
|
||||
# Switch the value of them and try again
|
||||
#
|
||||
log_must $RM $mntpnt/$TESTFILE
|
||||
log_must $ZFS set quota=25M $fs
|
||||
log_must $ZFS set refquota=15M $fs
|
||||
|
||||
log_mustnot $MKFILE 20M $mntpnt/$TESTFILE
|
||||
used=$(get_prop used $fs)
|
||||
refquota=$(get_prop refquota $fs)
|
||||
((used = used / (1024 * 1024)))
|
||||
((refquota = refquota / (1024 * 1024)))
|
||||
if [[ $used -ne $refquota ]]; then
|
||||
log_fail "ERROR: $used -ne $refquota Quotas are not limited by refquota"
|
||||
fi
|
||||
|
||||
log_pass "Quotas are enforced using the minimum of the two properties"
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Sub-filesystem quotas are not enforced by property 'refquota'
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Setting quota and refquota for parent. refquota < quota
|
||||
# 2. Verify sub-filesystem will not be limited by refquota
|
||||
# 3. Verify sub-filesystem will only be limited by quota
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rf $TESTPOOL/$TESTFS
|
||||
log_must $ZFS create $TESTPOOL/$TESTFS
|
||||
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||
}
|
||||
|
||||
log_assert "Sub-filesystem quotas are not enforced by property 'refquota'"
|
||||
log_onexit cleanup
|
||||
|
||||
TESTFILE='testfile'
|
||||
fs=$TESTPOOL/$TESTFS
|
||||
log_must $ZFS set quota=25M $fs
|
||||
log_must $ZFS set refquota=10M $fs
|
||||
log_must $ZFS create $fs/subfs
|
||||
|
||||
mntpnt=$(get_prop mountpoint $fs/subfs)
|
||||
log_must $MKFILE 20M $mntpnt/$TESTFILE
|
||||
|
||||
typeset -i used quota refquota
|
||||
used=$(get_prop used $fs)
|
||||
refquota=$(get_prop refquota $fs)
|
||||
((used = used / (1024 * 1024)))
|
||||
((refquota = refquota / (1024 * 1024)))
|
||||
if [[ $used -lt $refquota ]]; then
|
||||
log_fail "ERROR: $used < $refquota subfs quotas are limited by refquota"
|
||||
fi
|
||||
|
||||
log_mustnot $MKFILE 20M $mntpnt/$TESTFILE.2
|
||||
used=$(get_prop used $fs)
|
||||
quota=$(get_prop quota $fs)
|
||||
((used = used / (1024 * 1024)))
|
||||
((quota = quota / (1024 * 1024)))
|
||||
if [[ $used -gt $quota ]]; then
|
||||
log_fail "ERROR: $used > $quota subfs quotas aren't limited by quota"
|
||||
fi
|
||||
|
||||
log_pass "Sub-filesystem quotas are not enforced by property 'refquota'"
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# refquotas are not limited by snapshots.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Setting refquota < quota
|
||||
# 2. Create file in filesytem, take snapshot and remove the file
|
||||
# 3. Verify snapshot will not consume refquota
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rf $TESTPOOL/$TESTFS
|
||||
log_must $ZFS create $TESTPOOL/$TESTFS
|
||||
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||
}
|
||||
|
||||
log_assert "refquotas are not limited by snapshots."
|
||||
log_onexit cleanup
|
||||
|
||||
TESTFILE='testfile'
|
||||
fs=$TESTPOOL/$TESTFS
|
||||
log_must $ZFS set quota=25M $fs
|
||||
log_must $ZFS set refquota=15M $fs
|
||||
|
||||
mntpnt=$(get_prop mountpoint $fs)
|
||||
typeset -i i=0
|
||||
while ((i < 3)); do
|
||||
log_must $MKFILE 7M $mntpnt/$TESTFILE.$i
|
||||
log_must $ZFS snapshot $fs@snap.$i
|
||||
log_must $RM $mntpnt/$TESTFILE.$i
|
||||
|
||||
((i += 1))
|
||||
done
|
||||
|
||||
#
|
||||
# Verify out of the limitation of 'quota'
|
||||
#
|
||||
log_mustnot $MKFILE 7M $mntpnt/$TESTFILE
|
||||
|
||||
log_pass "refquotas are not limited by snapshots."
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# refquotas are not limited by sub-filesystem snapshots.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Setting refquota < quota for parent
|
||||
# 2. Create file in sub-filesytem, take snapshot and remove the file
|
||||
# 3. Verify sub-filesystem snapshot will not consume refquota
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rf $TESTPOOL/$TESTFS
|
||||
log_must $ZFS create $TESTPOOL/$TESTFS
|
||||
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||
}
|
||||
|
||||
log_assert "refquotas are not limited by sub-filesystem snapshots."
|
||||
log_onexit cleanup
|
||||
|
||||
TESTFILE='testfile'
|
||||
fs=$TESTPOOL/$TESTFS
|
||||
log_must $ZFS set quota=25M $fs
|
||||
log_must $ZFS set refquota=15M $fs
|
||||
log_must $ZFS create $fs/subfs
|
||||
|
||||
mntpnt=$(get_prop mountpoint $fs/subfs)
|
||||
typeset -i i=0
|
||||
while ((i < 3)); do
|
||||
log_must $MKFILE 7M $mntpnt/$TESTFILE.$i
|
||||
log_must $ZFS snapshot $fs/subfs@snap.$i
|
||||
log_must $RM $mntpnt/$TESTFILE.$i
|
||||
|
||||
((i += 1))
|
||||
done
|
||||
|
||||
#
|
||||
# Verify out of the limitation of 'quota'
|
||||
#
|
||||
log_mustnot $MKFILE 7M $mntpnt/$TESTFILE
|
||||
|
||||
log_pass "refquotas are not limited by sub-filesystem snapshots"
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# 'zfs set refquota/refreserv' can handle incorrect arguments correctly.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Setup incorrect arguments arrays.
|
||||
# 2. Set the bad argument to refquota.
|
||||
# 3. Verify zfs can handle it correctly.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS set refquota=none $TESTPOOL/$TESTFS
|
||||
log_must $ZFS set refreserv=none $TESTPOOL/$TESTFS
|
||||
}
|
||||
|
||||
log_assert "'zfs set refquota' can handle incorrect arguments correctly."
|
||||
log_onexit cleanup
|
||||
|
||||
set -A badopt \
|
||||
"None" "-1" "1TT" "%5" \
|
||||
"123!" "@456" "7#89" "0\$" \
|
||||
"abc123%" "123%s" "12%s3" "%c123" \
|
||||
"123%d" "%x123" "12%p3" "^def456" \
|
||||
"\0" "x0"
|
||||
|
||||
typeset -i i=0
|
||||
while ((i < ${#badopt[@]})); do
|
||||
log_mustnot $ZFS set refquota=${badopt[$i]} $TESTPOOL/$TESTFS
|
||||
log_mustnot $ZFS set refreserv=${badopt[$i]} $TESTPOOL/$TESTFS
|
||||
|
||||
((i += 1))
|
||||
done
|
||||
|
||||
log_pass "'zfs set refquota' can handle incorrect arguments correctly."
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
verify_runnable "both"
|
||||
DISK=${DISKS%% *}
|
||||
default_setup $DISK
|
||||
Reference in New Issue
Block a user