mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 04:07:45 +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/snapused
|
||||
dist_pkgdata_SCRIPTS = \
|
||||
snapused.kshlib \
|
||||
setup.ksh \
|
||||
cleanup.ksh \
|
||||
snapused_001_pos.ksh \
|
||||
snapused_002_pos.ksh \
|
||||
snapused_003_pos.ksh \
|
||||
snapused_004_pos.ksh \
|
||||
snapused_005_pos.ksh
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#!/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 2009 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
|
||||
|
||||
default_cleanup
|
||||
+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 2009 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
|
||||
|
||||
DISK=${DISKS%% *}
|
||||
|
||||
default_setup $DISK
|
||||
@@ -0,0 +1,185 @@
|
||||
#
|
||||
# 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 2009 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
|
||||
|
||||
export USEDTEST=$TESTPOOL/$TESTFS/usedtest-snapused
|
||||
|
||||
function _check_used # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
|
||||
if [[ "$(get_prop type $dataset)" == "snapshot" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
used=$(get_prop used $dataset)
|
||||
usedbychildren=$(get_prop usedbychildren $dataset)
|
||||
usedbydataset=$(get_prop usedbydataset $dataset)
|
||||
usedbyrefreservation=$(get_prop usedbyrefreservation $dataset)
|
||||
usedbysnapshots=$(get_prop usedbysnapshots $dataset)
|
||||
((used_sum = usedbychildren + usedbydataset + \
|
||||
usedbyrefreservation + usedbysnapshots))
|
||||
if ((used != used_sum)); then
|
||||
log_fail "$dataset: used($used) is not the sum($used_sum) of usedby*"
|
||||
fi
|
||||
}
|
||||
|
||||
function check_used # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
for child in $($ZFS list -rH -t filesystem,volume -o name $dataset)
|
||||
do
|
||||
_check_used $child
|
||||
done
|
||||
}
|
||||
|
||||
function check_usedbychildren # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
typeset -i usedbychildren_sum=0
|
||||
typeset -i parent_usedbychildren=0
|
||||
for child in $($ZFS list -rH -t filesystem,volume -o name $dataset)
|
||||
do
|
||||
if [[ "$(get_prop type $child)" == "snapshot" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# parent
|
||||
if [[ "$child" == "$dataset" ]]; then
|
||||
parent_usedbychildren=$(get_prop usedbychildren $child)
|
||||
else #child
|
||||
reservation=$(get_prop reservation $child)
|
||||
used=$(get_prop used $child)
|
||||
if ((reservation > used)); then
|
||||
((usedbychildren_sum += reservation))
|
||||
else
|
||||
((usedbychildren_sum += used))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if ((parent_usedbychildren != usedbychildren_sum)); then
|
||||
log_fail "$dataset: usedbychildren($parent_usedbychildren) is not the sum($usedbychildren_sum) of used by children"
|
||||
fi
|
||||
}
|
||||
|
||||
function _check_usedbydataset # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
if [[ "$(get_prop type $dataset)" == "snapshot" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
usedbydataset=$(get_prop usedbydataset $dataset)
|
||||
referenced=$(get_prop referenced $dataset)
|
||||
|
||||
is_cloned=$(get_prop is:cloned $dataset)
|
||||
|
||||
if [[ "$is_cloned" == "yes" ]]; then
|
||||
if ((usedbydataset > referenced)); then
|
||||
log_fail "$dataset(cloned): usedbydataset($usedbydataset) is more than referenced($referenced)"
|
||||
fi
|
||||
else
|
||||
#
|
||||
# if non-clones, should usedbydataset == referenced
|
||||
#
|
||||
if ((usedbydataset != referenced)); then
|
||||
log_fail "$dataset: usedbydataset($usedbydataset) is not equal to referenced($referenced)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function check_usedbydataset # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
for child in $($ZFS list -rH -t filesystem,volume -o name $dataset)
|
||||
do
|
||||
_check_usedbydataset $child
|
||||
done
|
||||
}
|
||||
|
||||
function _check_usedbyrefreservation # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
if [[ "$(get_prop type $dataset)" == "snapshot" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
usedbyrefreservation=$(get_prop usedbyrefreservation $dataset)
|
||||
referenced=$(get_prop referenced $dataset)
|
||||
refreservation=$(get_prop refreservation $dataset)
|
||||
((diff_ref = refreservation - referenced))
|
||||
if ((usedbyrefreservation > refreservation || \
|
||||
usedbyrefreservation < diff_ref)); then
|
||||
log_fail "$dataset: usedbyrefreservation($usedbyrefreservation) checking is not ok"
|
||||
fi
|
||||
}
|
||||
|
||||
function check_usedbyrefreservation # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
for child in $($ZFS list -rH -t filesystem,volume -o name $dataset)
|
||||
do
|
||||
_check_usedbyrefreservation $child
|
||||
done
|
||||
}
|
||||
|
||||
function check_usedbysnapshots # dataset
|
||||
{
|
||||
typeset dataset=$1
|
||||
typeset -i usedbysnapshots_sum=0
|
||||
typeset -i parent_usedbysnapshots=0
|
||||
for child in $($ZFS list -rH -t filesystem,volume,snapshot -o name $dataset)
|
||||
do
|
||||
# parent
|
||||
if [[ "$child" == "$dataset" ]]; then
|
||||
parent_usedbysnapshots=$(get_prop usedbysnapshots $child)
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ "$(get_prop type $child)" != "snapshot" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ "$child" != "$dataset@"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# snapshot
|
||||
used=$(get_prop used $child)
|
||||
((usedbysnapshots_sum += used))
|
||||
done
|
||||
|
||||
if ((parent_usedbysnapshots < usedbysnapshots_sum)); then
|
||||
log_fail "$dataset: usedbysnapshots($parent_usedbysnapshots) is not more than or equal to" \
|
||||
"the sum($usedbysnapshots_sum) of used of snapshots"
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/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 2009 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
|
||||
. $STF_SUITE/tests/functional/snapused/snapused.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify used is correct.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a filesystem.
|
||||
# 2. Set refreservation of the filesystem.
|
||||
# 3. Make file in the filesystem.
|
||||
# 4. Create sub filesystem and make file in it.
|
||||
# 5. Create volume under it.
|
||||
# 6. Snapshot it.
|
||||
# 7. Check used=usedbychildren+usedbydataset+
|
||||
# usedbyrefreservation+usedbysnapshots.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rR $USEDTEST
|
||||
}
|
||||
|
||||
log_assert "Verify used is correct."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must $ZFS create $USEDTEST
|
||||
check_used $USEDTEST
|
||||
|
||||
typeset -i i=0
|
||||
typeset -i r_size=0
|
||||
mntpnt=$(get_prop mountpoint $USEDTEST)
|
||||
while ((i < 5)); do
|
||||
((r_size=(i+1)*16))
|
||||
|
||||
#usedbyrefreservation
|
||||
log_must $ZFS set refreservation="$r_size"M $USEDTEST
|
||||
|
||||
#usedbydataset
|
||||
log_must $MKFILE 16M $mntpnt/file$i
|
||||
|
||||
#usedbychildren
|
||||
log_must $ZFS create $USEDTEST/fs$i
|
||||
log_must $MKFILE 16M $mntpnt/fs$i/file$i
|
||||
|
||||
if is_global_zone; then
|
||||
log_must $ZFS create -V 16M $USEDTEST/vol$i
|
||||
fi
|
||||
|
||||
#usedbysnapshots
|
||||
log_must $ZFS snapshot -r $USEDTEST@snap$i
|
||||
|
||||
check_used $USEDTEST
|
||||
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
log_pass "Verify used is correct."
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/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 2009 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
|
||||
. $STF_SUITE/tests/functional/snapused/snapused.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify usedbychildren is correct.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a filesystem.
|
||||
# 2. Create sub filesystem and make file in it.
|
||||
# 3. Set reservation of the sub filesystem.
|
||||
# 4. Create volume under it.
|
||||
# 5. Snapshot it.
|
||||
# 6. Check usedbychildren is correct.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rR $USEDTEST
|
||||
}
|
||||
|
||||
log_assert "Verify usedbychildren is correct."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must $ZFS create $USEDTEST
|
||||
check_usedbychildren $USEDTEST
|
||||
|
||||
typeset -i i=0
|
||||
typeset -i r_size=0
|
||||
mntpnt=$(get_prop mountpoint $USEDTEST)
|
||||
while ((i < 5)); do
|
||||
((r_size=(i+1)*16))
|
||||
|
||||
log_must $ZFS create $USEDTEST/fs$i
|
||||
log_must $ZFS set reservation="$r_size"M $USEDTEST/fs$i
|
||||
log_must $MKFILE 48M $mntpnt/fs$i/file$i
|
||||
|
||||
if is_global_zone; then
|
||||
log_must $ZFS create -V 32M $USEDTEST/vol$i
|
||||
fi
|
||||
|
||||
log_must $ZFS snapshot -r $USEDTEST@snap$i
|
||||
|
||||
check_usedbychildren $USEDTEST
|
||||
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
log_pass "Verify usedbychildren is correct."
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/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 2009 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
|
||||
. $STF_SUITE/tests/functional/snapused/snapused.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify usedbydataset is correct.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a filesystem.
|
||||
# 2. Make file in the filesystem.
|
||||
# 3. Snapshot it.
|
||||
# 4. Clone it and make file in the cloned filesystem.
|
||||
# 5. Check usedbydataset is correct.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rR $USEDTEST
|
||||
}
|
||||
|
||||
log_assert "Verify usedbydataset is correct."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must $ZFS create $USEDTEST
|
||||
check_usedbydataset $USEDTEST
|
||||
|
||||
typeset -i i=0
|
||||
typeset -i r_size=0
|
||||
mntpnt=$(get_prop mountpoint $USEDTEST)
|
||||
while ((i < 5)); do
|
||||
((r_size=(i+1)*16))
|
||||
|
||||
log_must $MKFILE 16M $mntpnt/file$i
|
||||
log_must $MKFILE "$r_size"M $mntpnt/file_var$i
|
||||
log_must $ZFS snapshot -r $USEDTEST@snap$i
|
||||
|
||||
log_must $ZFS clone $USEDTEST@snap$i $USEDTEST/cln$i
|
||||
log_must $ZFS set is:cloned=yes $USEDTEST/cln$i
|
||||
|
||||
mntpnt_cln=$(get_prop mountpoint $USEDTEST/cln$i)
|
||||
log_must $MKFILE 16M $mntpnt_cln/file_cln$i
|
||||
log_must $MKFILE "$r_size"M $mntpnt_cln/file_cln_var$i
|
||||
|
||||
check_usedbydataset $USEDTEST
|
||||
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
log_pass "Verify usedbydataset is correct."
|
||||
@@ -0,0 +1,95 @@
|
||||
#!/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 2009 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
|
||||
. $STF_SUITE/tests/functional/snapused/snapused.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify usedbyrefreservation is correct.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a filesystem.
|
||||
# 2. Set refreservation of the filesystem.
|
||||
# 3. Make file in the filesystem.
|
||||
# 4. Create sub filesystem and make file in it.
|
||||
# 5. Set refreservation of the sub filesystem.
|
||||
# 6. Create volume under it.
|
||||
# 7. Snapshot it.
|
||||
# 8. Clone it and set refreservation of the cloned filesystem.
|
||||
# 9. Makefile the cloned filesystem.
|
||||
# 10. Check usedbyrefreservation is correct.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rR $USEDTEST
|
||||
}
|
||||
|
||||
log_assert "Verify usedbyrefreservation is correct."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must $ZFS create $USEDTEST
|
||||
check_usedbyrefreservation $USEDTEST
|
||||
|
||||
typeset -i i=0
|
||||
typeset -i r_size=0
|
||||
mntpnt=$(get_prop mountpoint $USEDTEST)
|
||||
while ((i < 5)); do
|
||||
((r_size=(i+1)*16))
|
||||
log_must $ZFS set refreservation="$r_size"M $USEDTEST
|
||||
|
||||
log_must $MKFILE 16M $mntpnt/file$i
|
||||
|
||||
log_must $ZFS create $USEDTEST/fs$i
|
||||
log_must $ZFS set refreservation="$r_size"M $USEDTEST/fs$i
|
||||
log_must $MKFILE 16M $mntpnt/fs$i/file$i
|
||||
|
||||
if is_global_zone; then
|
||||
log_must $ZFS create -V 16M $USEDTEST/vol$i
|
||||
fi
|
||||
|
||||
log_must $ZFS snapshot -r $USEDTEST@snap$i
|
||||
|
||||
log_must $ZFS clone $USEDTEST@snap$i $USEDTEST/cln$i
|
||||
|
||||
mntpnt_cln=$(get_prop mountpoint $USEDTEST/cln$i)
|
||||
log_must $ZFS set refreservation="$r_size"M $USEDTEST/cln$i
|
||||
log_must $MKFILE 16M $mntpnt_cln/file_cln$i
|
||||
|
||||
check_usedbyrefreservation $USEDTEST
|
||||
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
log_pass "Verify usedbyrefreservation is correct."
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/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 2009 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
|
||||
. $STF_SUITE/tests/functional/snapused/snapused.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify usedbysnapshots is correct.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a filesystem.
|
||||
# 2. Make file in the filesystem.
|
||||
# 3. Snapshot it.
|
||||
# 4. Check check_usedbysnapshots is correct.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must $ZFS destroy -rR $USEDTEST
|
||||
}
|
||||
|
||||
log_assert "Verify usedbysnapshots is correct."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must $ZFS create $USEDTEST
|
||||
check_usedbysnapshots $USEDTEST
|
||||
|
||||
typeset -i i=0
|
||||
typeset -i r_size=0
|
||||
mntpnt=$(get_prop mountpoint $USEDTEST)
|
||||
while ((i < 5)); do
|
||||
((r_size=(i+1)*16))
|
||||
|
||||
log_must $MKFILE "$r_size"M $mntpnt/file$i
|
||||
|
||||
log_must $ZFS snapshot $USEDTEST@snap$i
|
||||
check_usedbysnapshots $USEDTEST
|
||||
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
log_pass "Verify usedbysnapshots is correct."
|
||||
Reference in New Issue
Block a user