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:
Brian Behlendorf
2015-07-01 15:23:09 -07:00
parent 887d1e60ef
commit 6bb24f4dc7
1243 changed files with 89497 additions and 1042 deletions
+1
View File
@@ -0,0 +1 @@
SUBDIRS = functional stress
@@ -0,0 +1,55 @@
SUBDIRS = \
acl \
atime \
bootfs \
cache \
cachefile \
casenorm \
clean_mirror \
cli_root \
cli_user \
compression \
ctime \
delegate \
devices \
exec \
features \
grow_pool \
grow_replicas \
history \
inheritance \
inuse \
large_files \
largest_pool \
link_count \
migration \
mmap \
mount \
mv_files \
nestedfs \
no_space \
nopwrite \
online_offline \
pool_names \
poolversion \
privilege \
quota \
redundancy \
refquota \
refreserv \
rename_dirs \
replacement \
reservation \
rootpool \
rsend \
scrub_mirror \
slog \
snapshot \
snapused \
sparse \
threadsappend \
truncate \
userquota \
write_dirs \
xattr \
zvol
@@ -0,0 +1,6 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl
dist_pkgdata_SCRIPTS = \
acl.cfg \
acl_common.kshlib
SUBDIRS = posix
@@ -0,0 +1,64 @@
#
# 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.
#
. $STF_SUITE/include/libtest.shlib
export NISSTAFILE=/var/tmp/nis_state
export TESTFILE=testfile$$
export TESTFILE0=testfile0.$$
export TESTFILE2=testfile2.$$
# Define super user 'zfstest'
export ZFS_ACL_ADMIN=zfstest
export ZFS_ACL_STAFF_GROUP=zfsgrp
export ZFS_ACL_STAFF1=staff1
export ZFS_ACL_STAFF2=staff2
export ZFS_ACL_OTHER_GROUP=othergrp
export ZFS_ACL_OTHER1=other1
export ZFS_ACL_OTHER2=other2
# Define the current user who run 'usr_exec'
export ZFS_ACL_CUR_USER=""
# Define global error string
export ZFS_ACL_ERR_STR=""
# Define test file and test directory which will be operated by chmod
export testfile=$TESTDIR/testfile
export testdir=$TESTDIR/testdir
# Define several directories for trivial ACLs function test.
export RES_DIR=$TESTDIR/RES
export INI_DIR=$TESTDIR/INIT
export TST_DIR=$TESTDIR/TEST
export TMP_DIR=$TESTDIR/TMP
# Define test files and their attributes files number for trivial
# ACLs function test
export NUM_FILE=5
export NUM_ATTR=10
@@ -0,0 +1,626 @@
#
# 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.
#
. $STF_SUITE/tests/functional/acl/acl.cfg
. $STF_SUITE/include/libtest.shlib
#
# Get the given file/directory access mode
#
# $1 object -- file or directroy
#
function get_mode #<obj>
{
typeset obj=$1
if (( ${#obj} == 0 )); then
return 1
fi
$LS -ld $obj | $AWK '{print $1}'
}
#
# Get the given file/directory ACL
#
# $1 object -- file or directroy
#
function get_acl #<obj>
{
typeset obj=$1
if (( ${#obj} == 0 )); then
return 1
fi
$LS -vd $obj | $NAWK '(NR != 1) {print $0}'
}
#
# Get the given file/directory ACL
#
# $1 object -- file or directroy
#
function get_compact_acl #<obj>
{
typeset obj=$1
if (( ${#obj} == 0 )); then
return 1
fi
$LS -Vd $obj | $NAWK '(NR != 1) {print $0}'
}
#
# Check the given two files/directories have the same ACLs
#
# Return 0, if source object acl is equal to target object acl.
#
# $1 source object
# $2 target object
#
function compare_acls #<src> <tgt>
{
typeset src=$1
typeset tgt=$2
(( ${#src} == 0 || ${#tgt} == 0 )) && return 1
[[ $src == $tgt ]] && return 0
typeset tmpsrc=/tmp/compare_acls.src.$$
typeset tmptgt=/tmp/compare_acls.tgt.$$
get_acl $src > $tmpsrc
get_acl $tgt > $tmptgt
typeset -i ret=0
$DIFF $tmpsrc $tmptgt > /dev/null 2>&1
ret=$?
$RM -f $tmpsrc $tmptgt
if (( ret != 0 )); then
return $ret
fi
get_compact_acl $src > $tmpsrc
get_compact_acl $tgt > $tmptgt
$DIFF $tmpsrc $tmptgt > /dev/null 2>&1
ret=$?
$RM -f $tmpsrc $tmptgt
return $ret
}
#
# Check that the given two objects have the same modes.
# Return 0, if their modes are equal with each other. Otherwise, return 1.
#
# $1 source object
# $2 target object
#
function compare_modes #<src> <tgt>
{
typeset src=$1
typeset tgt=$2
typeset -i i=0
set -A mode
(( ${#src} == 0 || ${#tgt} == 0 )) && return 1
[[ $src == $tgt ]] && return 0
typeset obj
for obj in $src $tgt
do
mode[i]=$(get_mode $obj)
(( i = i + 1 ))
done
[[ ${mode[0]} != ${mode[1]} ]] && return 1
return 0
}
#
# Check that the given two objects have the same xattrs.
# Return 0, if their xattrs are equal with each other. Otherwise, return 1.
#
# $1 source object
# $2 target object
#
function compare_xattrs #<src> <tgt>
{
typeset src=$1
typeset tgt=$2
(( ${#src} == 0 || ${#tgt} == 0 )) && return 1
[[ $src == $tgt ]] && return 0
typeset tmpsrc=/tmp/compare_xattrs.src.$$
typeset tmptgt=/tmp/compare_xattrs.tgt.$$
get_xattr $src > $tmpsrc
get_xattr $tgt > $tmptgt
typeset -i ret=0
$DIFF $tmpsrc $tmptgt > /dev/null 2>&1
ret=$?
$RM -f $tmpsrc $tmptgt
return $ret
}
#
# Check '+' is set for a given file/directory with 'ls [-l]' command
#
# $1 object -- file or directory.
#
function plus_sign_check_l #<obj>
{
typeset obj=$1
if (( ${#obj} == 0 )); then
return 1
fi
$LS -ld $obj | $AWK '{print $1}' | $GREP "+\>" > /dev/null
return $?
}
#
# Check '+' is set for a given file/directory with 'ls [-v]' command
#
# $1 object -- file or directory.
#
function plus_sign_check_v #<obj>
{
typeset obj=$1
if (( ${#obj} == 0 )); then
return 1
fi
$LS -vd $obj | $NAWK '(NR == 1) {print $1}' | $GREP "+\>" > /dev/null
return $?
}
#
# A wrapper function of c program
#
# $1 legal login name
# $2-n commands and options
#
function chgusr_exec #<login_name> <commands> [...]
{
$CHG_USR_EXEC $@
return $?
}
#
# Export the current user for the following usr_exec operating.
#
# $1 legal login name
#
function set_cur_usr #<login_name>
{
export ZFS_ACL_CUR_USER=$1
}
#
# Run commands by $ZFS_ACL_CUR_USER
#
# $1-n commands and options
#
function usr_exec #<commands> [...]
{
$CHG_USR_EXEC "$ZFS_ACL_CUR_USER" $@
return $?
}
#
# Count how many ACEs for the speficied file or directory.
#
# $1 file or directroy name
#
function count_ACE #<file or dir name>
{
if [[ ! -e $1 ]]; then
log_note "Need input file or directroy name."
return 1
fi
$LS -vd $1 | $NAWK 'BEGIN {count=0}
(NR != 1)&&(/[0-9]:/) {count++}
END {print count}'
return 0
}
#
# Get specified number ACE content of specified file or directory.
#
# $1 file or directory name
# $2 specified number
#
function get_ACE #<file or dir name> <specified number> <verbose|compact>
{
if [[ ! -e $1 || $2 -ge $(count_ACE $1) ]]; then
return 1
fi
typeset file=$1
typeset -i num=$2
typeset format=${3:-verbose}
typeset -i next_num=-1
typeset tmpfile=/tmp/tmp_get_ACE.$$
typeset line=""
typeset args
case $format in
verbose) args="-vd"
;;
compact) args="-Vd"
;;
*) log_fail "Invalid parameter as ($format), " \
"only verbose|compact is supported."
;;
esac
$LS $args $file > $tmpfile
(( $? != 0 )) && log_fail "FAIL: $LS $args $file > $tmpfile"
while read line; do
[[ -z $line ]] && continue
if [[ $args == -vd ]]; then
if [[ $line == "$num":* ]]; then
(( next_num = num + 1 ))
fi
if [[ $line == "$next_num":* ]]; then
break
fi
if (( next_num != -1 )); then
print -n $line
fi
else
if (( next_num == num )); then
print -n $line
fi
(( next_num += 1 ))
fi
done < $tmpfile
$RM -f $tmpfile
(( $? != 0 )) && log_fail "FAIL: $RM -f $tmpfile"
}
#
# Cleanup exist user/group.
#
function cleanup_user_group
{
del_user $ZFS_ACL_ADMIN
del_user $ZFS_ACL_STAFF1
del_user $ZFS_ACL_STAFF2
del_group $ZFS_ACL_STAFF_GROUP
del_user $ZFS_ACL_OTHER1
del_user $ZFS_ACL_OTHER2
del_group $ZFS_ACL_OTHER_GROUP
return 0
}
#
# Clean up testfile and test directory
#
function cleanup
{
if [[ -d $TESTDIR ]]; then
cd $TESTDIR
$RM -rf $TESTDIR/*
fi
}
#
# According to specified access or acl_spec, do relevant operating by using the
# specified user.
#
# $1 specified user
# $2 node
# $3 acl_spec or access
#
function rwx_node #user node acl_spec|access
{
typeset user=$1
typeset node=$2
typeset acl_spec=$3
if [[ $user == "" || $node == "" || $acl_spec == "" ]]; then
log_note "node or acl_spec are not defined."
return 1
fi
if [[ -d $node ]]; then
case $acl_spec in
*:read_data:*|read_data)
chgusr_exec $user $LS -l $node > /dev/null 2>&1
return $? ;;
*:write_data:*|write_data)
if [[ -f ${node}/tmpfile ]]; then
log_must $RM -f ${node}/tmpfile
fi
chgusr_exec $user $TOUCH ${node}/tmpfile > \
/dev/null 2>&1
return $? ;;
*"execute:"*|execute)
chgusr_exec $user $FIND $node > /dev/null 2>&1
return $? ;;
esac
else
case $acl_spec in
*:read_data:*|read_data)
chgusr_exec $user $CAT $node > /dev/null 2>&1
return $? ;;
*:write_data:*|write_data)
chgusr_exec $user $DD if=/usr/bin/ls of=$node > \
/dev/null 2>&1
return $? ;;
*"execute:"*|execute)
ZFS_ACL_ERR_STR=$(chgusr_exec $user $node 2>&1)
return $? ;;
esac
fi
}
#
# Get the given file/directory xattr
#
# $1 object -- file or directroy
#
function get_xattr #<obj>
{
typeset obj=$1
typeset xattr
if (( ${#obj} == 0 )); then
return 1
fi
for xattr in `$RUNAT $obj $LS | \
/usr/xpg4/bin/egrep -v -e SUNWattr_ro -e SUNWattr_rw` ; do
$RUNAT $obj $SUM $xattr
done
}
#
# Get the owner of a file/directory
#
function get_owner #node
{
typeset node=$1
typeset value
if [[ -z $node ]]; then
log_fail "node are not defined."
fi
if [[ -d $node ]]; then
value=$($LS -dl $node | $AWK '{print $3}')
elif [[ -e $node ]]; then
value=$($LS -l $node | $AWK '{print $3}')
fi
$ECHO $value
}
#
# Get the group of a file/directory
#
function get_group #node
{
typeset node=$1
typeset value
if [[ -z $node ]]; then
log_fail "node are not defined."
fi
if [[ -d $node ]]; then
value=$($LS -dl $node | $AWK '{print $4}')
elif [[ -e $node ]]; then
value=$($LS -l $node | $AWK '{print $4}')
fi
$ECHO $value
}
#
# Get the group name that a UID belongs to
#
function get_user_group #uid
{
typeset uid=$1
typeset value
if [[ -z $uid ]]; then
log_fail "UID not defined."
fi
value=$(id $uid)
if [[ $? -eq 0 ]]; then
value=${value##*\(}
value=${value%%\)*}
$ECHO $value
else
log_fail "Invalid UID (uid)."
fi
}
#
# Get the specified item of the specified string
#
# $1: Item number, count from 0.
# $2-n: strings
#
function getitem
{
typeset -i n=$1
shift
(( n += 1 ))
eval echo \${$n}
}
#
# This function calculate the specified directory files checksum and write
# to the specified array.
#
# $1 directory in which the files will be cksum.
# $2 file array name which was used to store file cksum information.
# $3 attribute array name which was used to store attribute information.
#
function cksum_files #<dir> <file_array_name> <attribute_array_name>
{
typeset dir=$1
typeset farr_name=$2
typeset aarr_name=$3
[[ ! -d $dir ]] && return
typeset oldpwd=$PWD
cd $dir
typeset files=$($LS file*)
typeset -i i=0
typeset -i n=0
while (( i < NUM_FILE )); do
typeset f=$(getitem $i $files)
eval $farr_name[$i]=\$\(\$CKSUM $f\)
typeset -i j=0
while (( j < NUM_ATTR )); do
eval $aarr_name[$n]=\$\(\$RUNAT \$f \$CKSUM \
attribute.$j\)
(( j += 1 ))
(( n += 1 ))
done
(( i += 1 ))
done
cd $oldpwd
}
#
# This function compare two cksum results array.
#
# $1 The array name which stored the cksum before operation.
# $2 The array name which stored the cksum after operation.
#
function compare_cksum #<array1> <array2>
{
typeset before=$1
typeset after=$2
eval typeset -i count=\${#$before[@]}
typeset -i i=0
while (( i < count )); do
eval typeset var1=\${$before[$i]}
eval typeset var2=\${$after[$i]}
if [[ $var1 != $var2 ]]; then
return 1
fi
(( i += 1 ))
done
return 0
}
#
# This function calculate all the files cksum information in current directory
# and output them to the specified file.
#
# $1 directory from which the files will be cksum.
# $2 cksum output file
#
function record_cksum #<outfile>
{
typeset dir=$1
typeset outfile=$2
[[ ! -d ${outfile%/*} ]] && usr_exec $MKDIR -p ${outfile%/*}
usr_exec cd $dir ; $FIND . -depth -type f -exec cksum {} \\\; | \
$SORT > $outfile
usr_exec cd $dir ; $FIND . -depth -type f -xattr -exec runat {} \
cksum attribute* \\\; | $SORT >> $outfile
}
#
# The function create_files creates the directories and files that the script
# will operate on to test extended attribute functionality.
#
# $1 The base directory in which to create directories and files.
#
function create_files #<directory>
{
typeset basedir=$1
[[ ! -d $basedir ]] && usr_exec $MKDIR -m 777 $basedir
[[ ! -d $RES_DIR ]] && usr_exec $MKDIR -m 777 $RES_DIR
[[ ! -d $INI_DIR ]] && usr_exec $MKDIR -m 777 $INI_DIR
[[ ! -d $TST_DIR ]] && usr_exec $MKDIR -m 777 $TST_DIR
[[ ! -d $TMP_DIR ]] && usr_exec $MKDIR -m 777 $TMP_DIR
#
# Create the original file and its attribute files.
#
[[ ! -a $RES_DIR/file ]] && \
usr_exec $FILE_WRITE -o create -f $RES_DIR/file \
-b 1024 -d 0 -c 1
[[ ! -a $RES_DIR/attribute ]] && \
usr_exec $CP $RES_DIR/file $RES_DIR/attribute
typeset oldpwd=$PWD
cd $INI_DIR
typeset -i i=0
while (( i < NUM_FILE )); do
typeset dstfile=$INI_DIR/file.$$.$i
usr_exec $CP $RES_DIR/file $dstfile
typeset -i j=0
while (( j < NUM_ATTR )); do
usr_exec $RUNAT $dstfile \
$CP $RES_DIR/attribute ./attribute.$j
(( j += 1 ))
done
(( i += 1 ))
done
cd $oldpwd
}
@@ -0,0 +1,6 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/posix
dist_pkgdata_SCRIPTS = \
cleanup.ksh \
setup.ksh \
posix_001_pos.ksh \
posix_002_pos.ksh
+33
View File
@@ -0,0 +1,33 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/acl/acl_common.kshlib
cleanup_user_group
default_cleanup
@@ -0,0 +1,68 @@
#!/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.
#
. $STF_SUITE/include/libtest.shlib
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify that user can access file/directory if acltype=posixacl.
#
# STRATEGY:
# 1. Test access to file (mode=rw-)
# a. Can modify file
# b. Can't create new file
# b. Can't execute file
#
verify_runnable "both"
log_assert "Verify acltype=posixacl works on file"
# Test access to FILE
log_note "Testing access to FILE"
log_must $TOUCH $TESTDIR/file.0
log_must $SETFACL -m g:zfsgrp:rw $TESTDIR/file.0
$GETFACL $TESTDIR/file.0 2> /dev/null | $EGREP -q "^group:zfsgrp:rw-$"
if [ "$?" -eq "0" ]; then
# Should be able to write to file
log_must $SU staff1 -c "$ECHO \"$ECHO test > /dev/null\" > $TESTDIR/file.0"
# Should NOT be able to create new file
log_mustnot $SU staff1 -c "$TOUCH $TESTDIR/file.1"
# Root should be able to run file, but not user
chmod +x $TESTDIR/file.0
log_must $TESTDIR/file.0
log_mustnot $SU staff1 -c $TESTDIR/file.0
log_pass "POSIX ACL mode works on files"
else
log_fail "Group 'zfsgrp' does not have 'rw' as specified"
fi
@@ -0,0 +1,62 @@
#!/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.
#
. $STF_SUITE/include/libtest.shlib
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify that user can access file/directory if acltype=posixacl.
#
# STRATEGY:
# 1. Test access to directory (mode=-wx)
# a. Can create file in dir
# b. Can't list directory
#
verify_runnable "both"
log_assert "Verify acltype=posixacl works on directory"
# Test access to DIRECTORY
log_note "Testing access to DIRECTORY"
log_must $MKDIR $TESTDIR/dir.0
log_must $SETFACL -m g:zfsgrp:wx $TESTDIR/dir.0
$GETFACL $TESTDIR/dir.0 2> /dev/null | $EGREP -q "^group:zfsgrp:-wx$"
if [ "$?" -eq "0" ]; then
# Should be able to create file in directory
log_must $SU staff1 -c "$TOUCH $TESTDIR/dir.0/file.0"
# Should NOT be able to list files in directory
log_mustnot $SU staff1 -c "$LS -l $TESTDIR/dir.0"
log_pass "POSIX ACL mode works on directories"
else
log_fail "Group 'zfsgrp' does not have 'rwx' as specified"
fi
+48
View File
@@ -0,0 +1,48 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/acl/acl_common.kshlib
log_must $GETFACL --version
log_must $SETFACL --version
cleanup_user_group
# Create staff group and add user to it
log_must add_group $ZFS_ACL_STAFF_GROUP
log_must add_user $ZFS_ACL_STAFF_GROUP $ZFS_ACL_STAFF1
DISK=${DISKS%% *}
default_setup_noexit $DISK
log_must $CHMOD 777 $TESTDIR
# Use POSIX ACLs on filesystem
log_must $ZFS set acltype=posixacl $TESTPOOL/$TESTFS
log_must $ZFS set xattr=sa $TESTPOOL/$TESTFS
log_pass
@@ -0,0 +1,8 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/atime
dist_pkgdata_SCRIPTS = \
atime.cfg \
atime_common.kshlib \
cleanup.ksh \
setup.ksh \
atime_001_pos.ksh \
atime_002_neg.ksh
@@ -0,0 +1,30 @@
#
# 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.
#
export TESTCLONE=testclone$$
export TESTSNAP=testsnap$$
export TESTFILE=testfile
+66
View File
@@ -0,0 +1,66 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/tests/functional/atime/atime_common.kshlib
#
# DESCRIPTION:
# When atime=on, verify the access time for files is updated when read. It
# is available to fs and clone. To snapshot, it is unavailable.
#
# STRATEGY:
# 1. Create pool and fs.
# 2. Create '$TESTFILE' for fs.
# 3. Create snapshot and clone.
# 4. Setting atime=on on datasets except snapshot, and read '$TESTFILE'.
# 5. Expect the access time is updated on datasets except snapshot.
#
verify_runnable "both"
log_assert "Setting atime=on, the access time for files is updated when read."
log_onexit cleanup
#
# Create $TESTFILE, snapshot and clone.
#
setup_snap_clone
for dst in $TESTPOOL/$TESTFS $TESTPOOL/$TESTCLONE $TESTPOOL/$TESTFS@$TESTSNAP
do
typeset mtpt=$(get_prop mountpoint $dst)
if [[ $dst == $TESTPOOL/$TESTFS@$TESTSNAP ]]; then
mtpt=$(snapshot_mountpoint $dst)
log_mustnot check_atime_updated $mtpt/$TESTFILE
else
log_must $ZFS set atime=on $dst
log_must check_atime_updated $mtpt/$TESTFILE
fi
done
log_pass "Verify the property atime=on passed."
+67
View File
@@ -0,0 +1,67 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/tests/functional/atime/atime_common.kshlib
#
# DESCRIPTION:
# When atime=off, verify the access time for files is not updated when read.
# It is available to pool, fs snapshot and clone.
#
# STRATEGY:
# 1. Create pool, fs.
# 2. Create '$TESTFILE' for fs.
# 3. Create snapshot and clone.
# 4. Setting atime=off on dataset and read '$TESTFILE'.
# 5. Verify the access time is not updated.
#
verify_runnable "both"
log_assert "Setting atime=off, the access time for files will not be updated \
when read."
log_onexit cleanup
#
# Create $TESTFILE, snapshot and clone.
#
setup_snap_clone
for dst in $TESTPOOL/$TESTFS $TESTPOOL/$TESTCLONE $TESTPOOL/$TESTFS@$TESTSNAP
do
typeset mtpt=$(get_prop mountpoint $dst)
if [[ $dst == $TESTPOOL/$TESTFS@$TESTSNAP ]]; then
mtpt=$(snapshot_mountpoint $dst)
else
log_must $ZFS set atime=off $dst
fi
log_mustnot check_atime_updated $mtpt/$TESTFILE
done
log_pass "Verify the property atime=off passed."
@@ -0,0 +1,78 @@
#
# 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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/tests/functional/atime/atime.cfg
. $STF_SUITE/include/libtest.shlib
#
# Check if the access time for specified file is updated.
#
# $1 Given an absolute path to a file name
#
# Return value:
# 0 -> The access time is updated.
# 1 -> The access time is not updated.
#
function check_atime_updated
{
typeset filename=$1
if is_linux; then
typeset before=$(stat -c %X $filename)
sleep 2
else
typeset before=$($LS -Eu $filename | $AWK '{print $7}')
fi
log_must $CAT $filename
if is_linux; then
typeset after=$(stat -c %X $filename)
else
typeset after=$($LS -Eu $filename | $AWK '{print $7}')
fi
if [[ $before != $after ]]; then
return 0
else
return 1
fi
}
function setup_snap_clone
{
# Create two file to verify snapshot.
log_must $TOUCH $TESTDIR/$TESTFILE
create_snapshot $TESTPOOL/$TESTFS $TESTSNAP
create_clone $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTCLONE
}
function cleanup
{
destroy_clone $TESTPOOL/$TESTCLONE
destroy_snapshot $TESTPOOL/$TESTFS@$TESTSNAP
}
+30
View File
@@ -0,0 +1,30 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
default_cleanup
+31
View File
@@ -0,0 +1,31 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
DISK=${DISKS%% *}
default_setup $DISK
@@ -0,0 +1,12 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/bootfs
dist_pkgdata_SCRIPTS = \
cleanup.ksh \
setup.ksh \
bootfs_001_pos.ksh \
bootfs_002_neg.ksh \
bootfs_003_pos.ksh \
bootfs_004_neg.ksh \
bootfs_005_neg.ksh \
bootfs_006_pos.ksh \
bootfs_007_neg.ksh \
bootfs_008_neg.ksh
+78
View File
@@ -0,0 +1,78 @@
#!/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 2015 Nexenta Systems, Inc.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Valid datasets and snapshots are accepted as bootfs property values
#
# STRATEGY:
# 1. Create a set of datasets and snapshots in a test pool
# 2. Try setting them as boot filesystems
#
verify_runnable "global"
function cleanup {
if poolexists $TESTPOOL ; then
log_must $ZPOOL destroy $TESTPOOL
fi
if [[ -f $VDEV ]]; then
log_must $RM -f $VDEV
fi
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
fi
log_assert "Valid datasets are accepted as bootfs property values"
log_onexit cleanup
typeset VDEV=$TESTDIR/bootfs_001_pos_a.$$.dat
log_must $MKFILE 400m $VDEV
create_pool "$TESTPOOL" "$VDEV"
log_must $ZFS create $TESTPOOL/$TESTFS
log_must $ZFS snapshot $TESTPOOL/$TESTFS@snap
log_must $ZFS clone $TESTPOOL/$TESTFS@snap $TESTPOOL/clone
log_must $ZPOOL set bootfs=$TESTPOOL/$TESTFS $TESTPOOL
log_must $ZPOOL set bootfs=$TESTPOOL/$TESTFS@snap $TESTPOOL
log_must $ZPOOL set bootfs=$TESTPOOL/clone $TESTPOOL
log_must $ZFS promote $TESTPOOL/clone
log_must $ZPOOL set bootfs=$TESTPOOL/clone $TESTPOOL
log_pass "Valid datasets are accepted as bootfs property values"
+78
View File
@@ -0,0 +1,78 @@
#!/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 2015 Nexenta Systems, Inc.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Invalid datasets are rejected as boot property values
#
# STRATEGY:
#
# 1. Create a zvol
# 2. Verify that we can't set the bootfs to that dataset
#
verify_runnable "global"
function cleanup {
if datasetexists $TESTPOOL/vol
then
log_must $ZFS destroy $TESTPOOL/vol
fi
if poolexists $TESTPOOL
then
log_must $ZPOOL destroy $TESTPOOL
fi
if [[ -f $VDEV ]]; then
log_must $RM -f $VDEV
fi
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
fi
log_assert "Invalid datasets are rejected as boot property values"
log_onexit cleanup
typeset VDEV=$TESTDIR/bootfs_002_neg_a.$$.dat
log_must $MKFILE 400m $VDEV
create_pool "$TESTPOOL" "$VDEV"
log_must $ZFS create -V 10m $TESTPOOL/vol
block_device_wait
log_mustnot $ZPOOL set bootfs=$TESTPOOL/vol $TESTPOOL
log_pass "Invalid datasets are rejected as boot property values"
+82
View File
@@ -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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Valid pool names are accepted
#
# STRATEGY:
# 1. Using a list of valid pool names
# 2. Create a filesystem in that pool
# 2. Verify we can set the bootfs to that filesystem
#
verify_runnable "global"
set -A pools "pool.$$" "pool123" "mypool"
function cleanup {
if poolexists $POOL ; then
log_must $ZPOOL destroy $POOL
fi
$RM /bootfs_003.$$.dat
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
fi
log_onexit cleanup
log_assert "Valid pool names are accepted by zpool set bootfs"
$MKFILE 64m $TESTDIR/bootfs_003.$$.dat
typeset -i i=0;
while [ $i -lt "${#pools[@]}" ]
do
POOL=${pools[$i]}
log_must $ZPOOL create $POOL $TESTDIR/bootfs_003.$$.dat
log_must $ZFS create $POOL/$TESTFS
log_must $ZPOOL set bootfs=$POOL/$TESTFS $POOL
RES=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' )
if [ $RES != "$POOL/$TESTFS" ]
then
log_fail "Expected $RES == $POOL/$TESTFS"
fi
log_must $ZPOOL destroy $POOL
i=$(( $i + 1 ))
done
log_pass "Valid pool names are accepted by zpool set bootfs"
+91
View File
@@ -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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Invalid pool names are rejected by zpool set bootfs
#
# STRATEGY:
# 1. Try to set bootfs on some non-existent pools
#
#
#
verify_runnable "global"
set -A pools "pool//$$" "pool%d123" "mirror" "c0t0d0s0" "pool*23*" "*po!l" \
"%s££%^"
function cleanup {
if poolexists $POOL; then
log_must $ZPOOL destroy $POOL
fi
$RM /bootfs_004.$$.dat
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
fi
log_assert "Invalid pool names are rejected by zpool set bootfs"
log_onexit cleanup
# here, we build up a large string and add it to the list of pool names
# a word to the ksh-wary, ${#array[@]} gives you the
# total number of entries in an array, so array[${#array[@]}]
# will index the last entry+1, ksh arrays start at index 0.
COUNT=0
while [ $COUNT -le 1025 ]
do
bigname="${bigname}o"
COUNT=$(( $COUNT + 1 ))
done
pools[${#pools[@]}]="$bigname"
$MKFILE 64m $TESTDIR/bootfs_004.$$.dat
typeset -i i=0;
while [ $i -lt "${#pools[@]}" ]
do
POOL=${pools[$i]}/$TESTFS
log_mustnot $ZPOOL create $POOL $TESTDIR/bootfs_004.$$.dat
log_mustnot $ZFS create $POOL/$TESTFS
log_mustnot $ZPOOL set bootfs=$POOL/$TESTFS $POOL
i=$(( $i + 1 ))
done
log_pass "Invalid pool names are rejected by zpool set bootfs"
+79
View File
@@ -0,0 +1,79 @@
#!/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.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib
#
# DESCRIPTION:
#
# Boot properties cannot be set on pools with older versions
#
# STRATEGY:
# 1. Copy and import some pools of older versions
# 2. Create a filesystem on each
# 3. Verify that zpool set bootfs fails on each
#
verify_runnable "global"
function cleanup {
#
# we need destroy pools that created on top of $TESTPOOL first
#
typeset pool_name
for config in $CONFIGS; do
pool_name=$(eval $ECHO \$ZPOOL_VERSION_${config}_NAME)
if poolexists $pool_name; then
log_must $ZPOOL destroy $pool_name
fi
done
if poolexists $TESTPOOL ; then
log_must $ZPOOL destroy $TESTPOOL
fi
}
log_assert "Boot properties cannot be set on pools with older versions"
# These are configs from zpool_upgrade.cfg - see that file for more info.
CONFIGS="1 2 3"
log_onexit cleanup
log_must $ZPOOL create -f $TESTPOOL $DISKS
for config in $CONFIGS
do
create_old_pool $config
POOL_NAME=$(eval $ECHO \$ZPOOL_VERSION_${config}_NAME)
log_must $ZFS create $POOL_NAME/$TESTFS
log_mustnot $ZPOOL set bootfs=$POOL_NAME/$TESTFS $POOL_NAME
log_must destroy_upgraded_pool $config
done
log_pass "Boot properties cannot be set on pools with older versions"
+142
View File
@@ -0,0 +1,142 @@
#!/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.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Pools of correct vdev types accept boot property
#
# STRATEGY:
# 1. create pools of each vdev type (raid, raidz, raidz2, mirror + hotspares)
# 2. verify we can set bootfs on each pool type according to design
#
verify_runnable "global"
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
fi
VDEV1=$TESTDIR/bootfs_006_pos_a.$$.dat
VDEV2=$TESTDIR/bootfs_006_pos_b.$$.dat
VDEV3=$TESTDIR/bootfs_006_pos_c.$$.dat
VDEV4=$TESTDIR/bootfs_006_pos_d.$$.dat
function verify_bootfs { # $POOL
POOL=$1
log_must $ZFS create $POOL/$TESTFS
log_must $ZPOOL set bootfs=$POOL/$TESTFS $POOL
VAL=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' )
if [ $VAL != "$POOL/$TESTFS" ]
then
log_must $ZPOOL status -v $POOL
log_fail \
"set/get failed on $POOL - expected $VAL == $POOL/$TESTFS"
fi
log_must $ZPOOL destroy $POOL
}
function verify_no_bootfs { # $POOL
POOL=$1
log_must $ZFS create $POOL/$TESTFS
log_mustnot $ZPOOL set bootfs=$POOL/$TESTFS $POOL
VAL=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' )
if [ $VAL == "$POOL/$TESTFS" ]
then
log_must $ZPOOL status -v $POOL
log_fail "set/get unexpectedly failed $VAL != $POOL/$TESTFS"
fi
log_must $ZPOOL destroy $POOL
}
function cleanup {
if poolexists $TESTPOOL
then
log_must $ZPOOL destroy $TESTPOOL
fi
log_must $RM $VDEV1 $VDEV2 $VDEV3 $VDEV4
}
log_assert "Pools of correct vdev types accept boot property"
log_onexit cleanup
log_must $MKFILE 64m $VDEV1 $VDEV2 $VDEV3 $VDEV4
## the following configurations are supported bootable pools
# normal
log_must $ZPOOL create $TESTPOOL $VDEV1
verify_bootfs $TESTPOOL
# normal + hotspare
log_must $ZPOOL create $TESTPOOL $VDEV1 spare $VDEV2
verify_bootfs $TESTPOOL
# mirror
log_must $ZPOOL create $TESTPOOL mirror $VDEV1 $VDEV2
verify_bootfs $TESTPOOL
# mirror + hotspare
log_must $ZPOOL create $TESTPOOL mirror $VDEV1 $VDEV2 spare $VDEV3
verify_bootfs $TESTPOOL
## the following configurations are not supported as bootable pools
# stripe
log_must $ZPOOL create $TESTPOOL $VDEV1 $VDEV2
verify_no_bootfs $TESTPOOL
# stripe + hotspare
log_must $ZPOOL create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
verify_no_bootfs $TESTPOOL
# raidz
log_must $ZPOOL create $TESTPOOL raidz $VDEV1 $VDEV2
verify_no_bootfs $TESTPOOL
# raidz + hotspare
log_must $ZPOOL create $TESTPOOL raidz $VDEV1 $VDEV2 spare $VDEV3
verify_no_bootfs $TESTPOOL
# raidz2
log_must $ZPOOL create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3
verify_no_bootfs $TESTPOOL
# raidz2 + hotspare
log_must $ZPOOL create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3 spare $VDEV4
verify_no_bootfs $TESTPOOL
log_pass "Pools of correct vdev types accept boot property"
+67
View File
@@ -0,0 +1,67 @@
#!/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.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Setting bootfs on a pool which was configured with the whole disk
# (i.e. EFI) will fail
#
# STRATEGY:
# 1. create a pool with a whole disk
# 2. create a filesystem on this pool
# 3. verify we can not set bootfs on the filesystem we just created.
#
verify_runnable "global"
function cleanup {
if poolexists $TESTPOOL ; then
destroy_pool "$TESTPOOL"
fi
}
log_onexit cleanup
DISK=${DISKS%% *}
typeset EFI_BOOTFS=$TESTPOOL/efs
typeset assert_mesg="setting bootfs on a pool which was configured with the \
whole disk will fail"
log_assert $assert_mesg
create_pool "$TESTPOOL" "$DISK"
log_must $ZFS create $EFI_BOOTFS
if is_linux; then
log_must $ZPOOL set bootfs=$EFI_BOOTFS $TESTPOOL
else
log_mustnot $ZPOOL set bootfs=$EFI_BOOTFS $TESTPOOL
fi
log_pass $assert_mesg
@@ -0,0 +1,65 @@
#!/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 2015 Nexenta Systems, Inc.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Setting bootfs on a pool which was configured with the whole disk
# (i.e. EFI) works.
#
# STRATEGY:
# 1. create a pool with a whole disk
# 2. create a filesystem on this pool
# 3. verify we can set bootfs on the filesystem we just created.
#
verify_runnable "global"
function cleanup {
if poolexists $TESTPOOL ; then
destroy_pool "$TESTPOOL"
fi
}
log_onexit cleanup
DISK=${DISKS%% *}
typeset EFI_BOOTFS=$TESTPOOL/efs
typeset assert_mesg="setting bootfs on a pool which was configured with the \
whole disk works"
log_assert $assert_mesg
create_pool "$TESTPOOL" "$DISK"
log_must $ZFS create $EFI_BOOTFS
log_must $ZPOOL set bootfs=$EFI_BOOTFS $TESTPOOL
log_pass $assert_mesg
+78
View File
@@ -0,0 +1,78 @@
#!/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.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# setting bootfs on a dataset which has gzip compression enabled will fail
#
# STRATEGY:
# 1. create pools based on a valid vdev
# 2. create a filesytem on this pool and set the compression property to gzip1-9
# 3. set the pool's bootfs property to filesystem we just configured which
# should fail
#
verify_runnable "global"
function cleanup {
if poolexists $TESTPOOL ; then
destroy_pool "$TESTPOOL"
fi
if [[ -f $VDEV ]]; then
log_must $RM -f $VDEV
fi
}
typeset assert_msg="setting bootfs on a dataset which has gzip \
compression enabled will fail"
typeset VDEV=$TESTDIR/bootfs_008_neg_a.$$.dat
typeset COMP_FS=$TESTPOOL/COMP_FS
log_onexit cleanup
log_assert $assert_msg
log_must $MKFILE 300m $VDEV
log_must $ZPOOL create $TESTPOOL $VDEV
log_must $ZFS create $COMP_FS
typeset -i i=0
set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \
"gzip-6" "gzip-7" "gzip-8" "gzip-9"
while (( i < ${#gtype[@]} )); do
log_must $ZFS set compression=${gtype[i]} $COMP_FS
log_mustnot $ZPOOL set bootfs=$COMP_FS $TESTPOOL
log_must $ZFS set compression=off $COMP_FS
(( i += 1 ))
done
log_pass $assert_msg
+34
View File
@@ -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 (c) 2015 by Lawrence Livermore National Security, LLC
# All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
[[ -e $TESTDIR ]] && $RM -rf $TESTDIR
log_pass
+34
View File
@@ -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 (c) 2015 by Lawrence Livermore National Security, LLC.
# All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
log_must $MKDIR $TESTDIR
log_pass
+17
View File
@@ -0,0 +1,17 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cache
dist_pkgdata_SCRIPTS = \
cache.cfg \
cache.kshlib \
cleanup.ksh \
setup.ksh \
cache_001_pos.ksh \
cache_002_pos.ksh \
cache_003_pos.ksh \
cache_004_neg.ksh \
cache_005_neg.ksh \
cache_006_pos.ksh \
cache_007_neg.ksh \
cache_008_neg.ksh \
cache_009_pos.ksh \
cache_010_neg.ksh \
cache_011_pos.ksh
+70
View File
@@ -0,0 +1,70 @@
#
# 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
function set_disks
{
set -A disk_array $(find_disks $DISKS)
typeset -i DISK_ARRAY_NUM=0
if (( ${#disk_array[*]} <= 1 )); then
export DISK=${DISKS%% *}
else
export DISK=""
typeset -i i=0
while (( i < ${#disk_array[*]} )); do
export DISK${i}="${disk_array[$i]}"
DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
(( i = i + 1 ))
done
export DISK_ARRAY_NUM=$i
export DISKSARRAY
fi
if (( $DISK_ARRAY_NUM == 0 )); then
export disk=$DISK
else
export disk=$DISK0
fi
}
set_disks
export SIZE=64M
export VDIR=$TESTDIR/disk.cache
export VDIR2=$TESTDIR/disk2.cache
export VDEV="$VDIR/a $VDIR/b $VDIR/c"
export LDEV="$DISK0"
export VDEV2="$VDIR2/a $VDIR2/b $VDIR2/c"
export LDEV2="$DISK1"
+160
View File
@@ -0,0 +1,160 @@
#
# 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
function cleanup
{
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
fi
if datasetexists $TESTPOOL2 ; then
log_must $ZPOOL destroy -f $TESTPOOL2
fi
}
#
# Try zpool status/iostat for given pool
#
# $1 pool
#
function display_status
{
typeset pool=$1
typeset -i ret=0
$ZPOOL status -xv $pool > /dev/null 2>&1
ret=$?
$ZPOOL iostat > /dev/null 2>&1
((ret |= $?))
typeset mntpnt=$(get_prop mountpoint $pool)
$DD if=/dev/random of=$mntpnt/testfile.$$ &
typeset pid=$!
$ZPOOL iostat -v 1 3 > /dev/null
((ret |= $?))
kill -9 $pid
return $ret
}
#
# Verify the given cache device have correct type and status
#
# $1 pool name
# $2 device name
# $3 device status
# $4 device type
#
function verify_cache_device
{
typeset pool=$1
typeset device=$2
typeset status=$3
typeset type=$4
if [[ -z $pool || -z $device || -z $status ]]; then
log_fail "Usage: verify_cache_device <pool> <device> " \
"<status> [type]"
fi
if [[ $WRAPPER == *"smi"* ]]; then
$ECHO $device | $EGREP "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1
if (( $? == 0 )); then
device=${device}s2
fi
fi
#
# Get all the cache devices and status table like below
#
# mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
#
set -A dev_stat_tab $($ZPOOL status -v $pool | $NAWK 'BEGIN {start=0} \
/\tcache/ {start=1}
/\tmirror/ || /\tspares/ || /^$/ {start=0}
(start==1) && /\t (\/|[a-zA-Z])/ \
{print "stripe:" $1 " " $2}
(start==1) && /\t (\/|[a-zA-Z])/ \
{print "mirror:" $1 " " $2}
# When hotspare is replacing
(start==1) && /\t (\/|[a-zA-Z])/ \
{print "mirror:" $1 " " $2}'
)
typeset -i i=0
typeset find=0
while (( i < ${#dev_stat_tab[@]} )); do
typeset dev=${dev_stat_tab[$i]}
typeset stat=${dev_stat_tab[((i+1))]}
case $dev in
stripe:$device)
if [[ "$type" == 'mirror' ]]; then
log_note "Unexpected type: mirror"
return 1
else
if [[ $stat != $status ]]; then
log_note "Status($stat) " \
"!= Expected stat($status)"
return 1
fi
return 0
fi
;;
mirror:$device)
if [[ -z "$type" || $type == 'stripe' ]]; then
log_note "Unexpected type: stripe"
return 1
else
if [[ $stat != $status ]]; then
log_note "Status($stat) " \
"!= Expected stat($status)"
return 1
fi
return 0
fi
;;
esac
((i += 2))
done
log_note "Can not find device: $device"
return 1
}
function verify_cache_support
{
$ZPOOL upgrade -v | $GREP "Cache devices" > /dev/null 2>&1
return $?
}
+65
View File
@@ -0,0 +1,65 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Creating a pool with a cache device succeeds.
#
# STRATEGY:
# 1. Create pool with separated cache devices.
# 2. Display pool status
# 3. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
log_assert "Creating a pool with a cache device succeeds."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Creating a pool with a cache device succeeds."
+65
View File
@@ -0,0 +1,65 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Adding a cache device to normal pool works.
#
# STRATEGY:
# 1. Create pool
# 2. Add cache devices with different configuration
# 3. Display pool status
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
log_assert "Adding a cache device to normal pool works."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV
log_must $ZPOOL add $TESTPOOL cache $LDEV
log_must display_status $TESTPOOL
typeset ldev=$(random_get $LDEV)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Adding a cache device to normal pool works."
+69
View File
@@ -0,0 +1,69 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Adding an extra cache device works
#
# STRATEGY:
# 1. Create pool with separated cache devices.
# 2. Add an extra cache devices
# 3. Display pool status
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Adding an extra cache device works."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
log_must $ZPOOL add $TESTPOOL \
cache $LDEV2
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV2)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Adding an extra cache device works."
+64
View File
@@ -0,0 +1,64 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Attaching a cache device fails.
#
# STRATEGY:
# 1. Create pool with separated cache devices.
# 2. Attaching a cache device for existing cache device
# 3. Verify the operation fails
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Attaching a cache device fails for an existing cache device."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
ldev=$(random_get $LDEV)
typeset ldev2=$(random_get $LDEV2)
log_mustnot $ZPOOL attach $TESTPOOL $ldev $ldev2
log_must check_vdev_state $TESTPOOL $ldev2 ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Attaching a cache device fails for an existing cache device."
+65
View File
@@ -0,0 +1,65 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Replacing a cache device fails.
#
# STRATEGY:
# 1. Create pool with cache devices.
# 2. Replacing one cache device
# 3. Verify replace fails
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Replacing a cache device fails."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
sdev=$(random_get $LDEV)
tdev=$(random_get $LDEV2)
log_mustnot $ZPOOL replace $TESTPOOL $sdev $tdev
log_must verify_cache_device $TESTPOOL $sdev 'ONLINE'
log_must check_vdev_state $TESTPOOL $tdev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Replacing a cache device fails."
+85
View File
@@ -0,0 +1,85 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Exporting and importing pool with cache devices passes.
#
# STRATEGY:
# 1. Create pool with cache devices.
# 2. Export and import the pool
# 3. Display pool status
# 4. Destroy and import the pool again
# 5. Display pool status
# 6. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Exporting and importing pool with cache devices passes."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
$TESTPOOL $ldev 'ONLINE'
#
# Nomal export/import operating
#
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import -d $VDIR $TESTPOOL
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
$TESTPOOL $ldev 'ONLINE'
#
# Destroy the pool and import again
#
log_must $ZPOOL destroy $TESTPOOL
log_must $ZPOOL import -Df -d $VDIR $TESTPOOL
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
$TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Exporting and importing pool with cache devices passes."
+63
View File
@@ -0,0 +1,63 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# A mirror/raidz/raidz2 cache is not supported.
#
# STRATEGY:
# 1. Try to create pool with unsupported type
# 2. Verify failed to create pool.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "A mirror/raidz/raidz2 cache is not supported."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
for cachetype in "mirror" "raidz" "raidz1" "raidz2"
do
log_mustnot $ZPOOL create $TESTPOOL $type $VDEV \
cache $cachetype $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_mustnot verify_cache_device \
$TESTPOOL $ldev 'ONLINE' $cachetype
log_must datasetnonexists $TESTPOOL
done
done
log_pass "A mirror/raidz/raidz2 cache is not supported."
+67
View File
@@ -0,0 +1,67 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# A mirror/raidz/raidz2 cache can not be added to existed pool.
#
# STRATEGY:
# 1. Create pool with or without cache.
# 2. Add a mirror/raidz/raidz2 cache to this pool.
# 3. Verify failed to add.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "A raidz/raidz2 cache can not be added to existed pool."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
for cachetype in "mirror" "raidz" "raidz1" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
log_mustnot $ZPOOL add $TESTPOOL cache $cachetype $LDEV2
ldev=$(random_get $LDEV2)
log_mustnot verify_cache_device \
$TESTPOOL $ldev 'ONLINE' $cachetype
log_must $ZPOOL destroy $TESTPOOL
done
done
log_pass "A mirror/raidz/raidz2 cache can not be added to existed pool."
+69
View File
@@ -0,0 +1,69 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Offline and online a cache device succeed.
#
# STRATEGY:
# 1. Create pool with mirror cache devices.
# 2. Offine and online a cache device
# 3. Display pool status
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Offline and online a cache device succeed."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_must $ZPOOL offline $TESTPOOL $ldev
log_must display_status $TESTPOOL
log_must verify_cache_device $TESTPOOL $ldev 'OFFLINE' ''
log_must $ZPOOL online $TESTPOOL $ldev
log_must display_status $TESTPOOL
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE' ''
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Offline and online a cache device succeed."
+90
View File
@@ -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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Verify cache device must be a block device.
#
# STRATEGY:
# 1. Create a pool
# 2. Add different object as cache
# 3. Verify character devices and files fail
#
verify_runnable "global"
function cleanup_testenv
{
cleanup
if [[ -n $lofidev ]]; then
log_must $LOFIADM -d $lofidev
fi
}
log_assert "Cache device can only be block devices."
log_onexit cleanup_testenv
TESTVOL=testvol1$$
dsk1=${DISKS%% *}
log_must $ZPOOL create $TESTPOOL ${DISKS#$dsk1}
if is_linux; then
SLICE="p1"
else
SLICE="s0"
fi
# Add nomal ${DEV_RDSKDIR} device
log_mustnot $ZPOOL add $TESTPOOL cache ${DEV_RDSKDIR}/${dsk1}${SLICE}
#log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
# Add nomal file
log_mustnot $ZPOOL add $TESTPOOL cache $VDEV2
# Add /dev/rlofi device
lofidev=${VDEV2%% *}
log_must $LOFIADM -a $lofidev
lofidev=$($LOFIADM $lofidev)
log_mustnot $ZPOOL add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}"
if [[ -n $lofidev ]]; then
log_must $LOFIADM -d $lofidev
lofidev=""
fi
# Add ${ZVOL_RDEVDIR} device
log_must $ZPOOL create $TESTPOOL2 $VDEV2
log_must $ZFS create -V $SIZE $TESTPOOL2/$TESTVOL
log_mustnot $ZPOOL add $TESTPOOL cache ${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
log_pass "Cache device can only be block devices."
+68
View File
@@ -0,0 +1,68 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Remove cache device from pool with spare device should succeed.
#
# STRATEGY:
# 1. Create pool with cache devices and spare devices
# 2. Remove cache device from the pool
# 3. The upper action should succeed
#
verify_runnable "global"
verify_disk_count "$LDEV2"
function cleanup {
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
fi
}
log_assert "Remove cache device from pool with spare device should succeed"
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV spare $LDEV2
log_must $ZPOOL remove $TESTPOOL $LDEV
log_must display_status $TESTPOOL
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Remove cache device from pool with spare device should succeed"
+46
View File
@@ -0,0 +1,46 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
verify_runnable "global"
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
fi
if datasetexists $TESTPOOL2 ; then
log_must $ZPOOL destroy -f $TESTPOOL2
fi
log_must $RM -rf $VDIR $VDIR2
log_pass
+45
View File
@@ -0,0 +1,45 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
verify_runnable "global"
if ! $(is_physical_device $LDEV) ; then
log_unsupported "Only physical disk could be cache device"
fi
log_must $RM -rf $VDIR $VDIR2
log_must $MKDIR -p $VDIR $VDIR2
log_must $MKFILE $SIZE $VDEV $VDEV2
log_pass
@@ -0,0 +1,8 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cachefile
dist_pkgdata_SCRIPTS = \
cachefile.cfg \
cachefile.kshlib \
cachefile_001_pos.ksh \
cachefile_002_pos.ksh \
cachefile_003_pos.ksh \
cachefile_004_pos.ksh
@@ -0,0 +1,33 @@
#
# 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.
#
export CPATH="/etc/zfs/zpool.cache"
export CPATH1=/var/tmp/cachefile.$$
export CPATH2=$TEST_BASE_DIR/cachefile.$$
@@ -0,0 +1,47 @@
#!/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.
#
#
# A function to determine if a given pool name has an entry in cachefile
# returns 1 if the pool is not in the cache, 0 otherwise.
function pool_in_cache {
# checking for the pool name in the strings output of
# the given cachefile, default is /etc/zfs/zpool.cache
typeset cachefile=${2:-$CPATH}
RESULT=$($STRINGS $cachefile | $GREP -w $1)
if [ -z "$RESULT" ]
then
return 1
fi
return 0
}
@@ -0,0 +1,94 @@
#!/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
. $STF_SUITE/tests/functional/cachefile/cachefile.cfg
. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib
#
# DESCRIPTION:
#
# Creating a pool with "cachefile" set doesn't update zpool.cache
#
# STRATEGY:
# 1. Create a pool with the cachefile property set
# 2. Verify that the pool doesn't have an entry in zpool.cache
# 3. Verify the cachefile property is set
# 4. Create a pool without the cachefile property
# 5. Verify the cachefile property isn't set
# 6. Verify that zpool.cache contains an entry for the pool
#
function cleanup
{
typeset file
if poolexists $TESTPOOL ; then
destroy_pool $TESTPOOL
fi
for file in $CPATH1 $CPATH2 ; do
if [[ -f $file ]] ; then
log_must $RM $file
fi
done
}
verify_runnable "global"
log_assert "Creating a pool with \"cachefile\" set doesn't update zpool.cache"
log_onexit cleanup
set -A opts "none" "false" "none" \
"$CPATH" "true" "-" \
"$CPATH1" "true" "$CPATH1" \
"$CPATH2" "true" "$CPATH2"
typeset -i i=0
while (( i < ${#opts[*]} )); do
log_must $ZPOOL create -o cachefile=${opts[i]} $TESTPOOL $DISKS
case ${opts[((i+1))]} in
false) log_mustnot pool_in_cache $TESTPOOL
;;
true) log_must pool_in_cache $TESTPOOL ${opts[i]}
;;
esac
PROP=$(get_pool_prop cachefile $TESTPOOL)
if [[ $PROP != ${opts[((i+2))]} ]]; then
log_fail "cachefile property not set as expected. " \
"Expect: ${opts[((i+2))]}, Current: $PROP"
fi
log_must $ZPOOL destroy $TESTPOOL
(( i = i + 3 ))
done
log_pass "Creating a pool with \"cachefile\" set doesn't update zpool.cache"
@@ -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/cachefile/cachefile.cfg
. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib
#
# DESCRIPTION:
#
# Importing a pool with "cachefile" set doesn't update zpool.cache
#
# STRATEGY:
# 1. Create a pool with the cachefile property set
# 2. Verify the pool doesn't have an entry in zpool.cache
# 3. Export the pool
# 4. Import the pool
# 5. Verify the pool does have an entry in zpool.cache
# 6. Export the pool
# 7. Import the pool -o cachefile=<cachefile>
# 8. Verify the pool doesn't have an entry in zpool.cache
#
function cleanup
{
if poolexists $TESTPOOL ; then
destroy_pool $TESTPOOL
fi
}
verify_runnable "global"
log_assert "Importing a pool with \"cachefile\" set doesn't update zpool.cache"
log_onexit cleanup
log_must $ZPOOL create -o cachefile=none $TESTPOOL $DISKS
typeset DEVICEDIR=$(get_device_dir $DISKS)
log_mustnot pool_in_cache $TESTPOOL
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import -d $DEVICEDIR $TESTPOOL
log_must pool_in_cache $TESTPOOL
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import -o cachefile=none -d $DEVICEDIR $TESTPOOL
log_mustnot pool_in_cache $TESTPOOL
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import -o cachefile=$CPATH -d $DEVICEDIR $TESTPOOL
log_must pool_in_cache $TESTPOOL
log_must $ZPOOL destroy $TESTPOOL
log_pass "Importing a pool with \"cachefile\" set doesn't update zpool.cache"
@@ -0,0 +1,100 @@
#!/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
. $STF_SUITE/tests/functional/cachefile/cachefile.cfg
. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib
#
# DESCRIPTION:
#
# Setting altroot=<path> and cachefile=$CPATH for zpool create is succeed
#
# STRATEGY:
# 1. Attempt to create a pool with -o altroot=<path> -o cachefile=<value>
# 2. Verify the command succeed
#
#
TESTDIR=/altdir.$$
function cleanup
{
typeset file
if poolexists $TESTPOOL ; then
destroy_pool $TESTPOOL
fi
for file in $CPATH1 $CPATH2 ; do
if [[ -f $file ]] ; then
log_must $RM $file
fi
done
if [ -d $TESTDIR ]
then
$RMDIR $TESTDIR
fi
}
verify_runnable "global"
log_assert "Setting altroot=path and cachefile=$CPATH for zpool create succeed."
log_onexit cleanup
typeset -i i=0
set -A opts "none" "none" \
"$CPATH" "-" \
"$CPATH1" "$CPATH1" \
"$CPATH2" "$CPATH2"
while (( i < ${#opts[*]} )); do
log_must $ZPOOL create -o altroot=$TESTDIR -o cachefile=${opts[i]} \
$TESTPOOL $DISKS
if [[ ${opts[i]} != none ]]; then
log_must pool_in_cache $TESTPOOL ${opts[i]}
else
log_mustnot pool_in_cache $TESTPOOL
fi
PROP=$(get_pool_prop cachefile $TESTPOOL)
if [[ $PROP != ${opts[((i+1))]} ]]; then
log_fail "cachefile property not set as expected. " \
"Expect: ${opts[((i+1))]}, Current: $PROP"
fi
log_must $ZPOOL destroy $TESTPOOL
(( i = i + 2 ))
done
log_pass "Setting altroot=path and cachefile=$CPATH for zpool create succeed."
@@ -0,0 +1,124 @@
#!/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/cachefile/cachefile.cfg
. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib
#
# DESCRIPTION:
# Verify set, export and destroy when cachefile is set on pool.
#
# STRATEGY:
# 1. Create two pools with one same cahcefile1.
# 2. Set cachefile of the two pools to another same cachefile2.
# 3. Verify cachefile1 not exist.
# 4. Export the two pools.
# 5. Verify cachefile2 not exist.
# 6. Import the two pools and set cachefile to cachefile2.
# 7. Destroy the two pools.
# 8. Verify cachefile2 not exist.
#
verify_runnable "global"
function cleanup
{
poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1
poolexists $TESTPOOL2 && destroy_pool $TESTPOOL2
mntpnt=$(get_prop mountpoint $TESTPOOL)
typeset -i i=0
while ((i < 2)); do
if [[ -e $mntpnt/vdev$i ]]; then
log_must $RM -f $mntpnt/vdev$i
fi
((i += 1))
done
if poolexists $TESTPOOL ; then
destroy_pool $TESTPOOL
fi
for file in $CPATH1 $CPATH2 ; do
if [[ -f $file ]] ; then
log_must $RM $file
fi
done
}
log_assert "Verify set, export and destroy when cachefile is set on pool."
log_onexit cleanup
log_must $ZPOOL create $TESTPOOL $DISKS
mntpnt=$(get_prop mountpoint $TESTPOOL)
typeset -i i=0
while ((i < 2)); do
log_must $MKFILE 64M $mntpnt/vdev$i
eval vdev$i=$mntpnt/vdev$i
((i += 1))
done
log_must $ZPOOL create -o cachefile=$CPATH1 $TESTPOOL1 $vdev0
log_must pool_in_cache $TESTPOOL1 $CPATH1
log_must $ZPOOL create -o cachefile=$CPATH1 $TESTPOOL2 $vdev1
log_must pool_in_cache $TESTPOOL2 $CPATH1
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL1
log_must pool_in_cache $TESTPOOL1 $CPATH2
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL2
log_must pool_in_cache $TESTPOOL2 $CPATH2
if [[ -f $CPATH1 ]]; then
log_fail "Verify set when cachefile is set on pool."
fi
log_must $ZPOOL export $TESTPOOL1
log_must $ZPOOL export $TESTPOOL2
if [[ -f $CPATH2 ]]; then
log_fail "Verify export when cachefile is set on pool."
fi
log_must $ZPOOL import -d $mntpnt $TESTPOOL1
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL1
log_must pool_in_cache $TESTPOOL1 $CPATH2
log_must $ZPOOL import -d $mntpnt $TESTPOOL2
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL2
log_must pool_in_cache $TESTPOOL2 $CPATH2
log_must $ZPOOL destroy $TESTPOOL1
log_must $ZPOOL destroy $TESTPOOL2
if [[ -f $CPATH2 ]]; then
log_fail "Verify destroy when cachefile is set on pool."
fi
log_pass "Verify set, export and destroy when cachefile is set on pool."
@@ -0,0 +1,22 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/casenorm
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
case_all_values.ksh \
casenorm.cfg \
casenorm.kshlib \
insensitive_formd_delete.ksh \
insensitive_formd_lookup.ksh \
insensitive_none_delete.ksh \
insensitive_none_lookup.ksh \
mixed_formd_delete.ksh \
mixed_formd_lookup_ci.ksh \
mixed_formd_lookup.ksh \
mixed_none_delete.ksh \
mixed_none_lookup_ci.ksh \
mixed_none_lookup.ksh \
norm_all_values.ksh \
sensitive_formd_delete.ksh \
sensitive_formd_lookup.ksh \
sensitive_none_delete.ksh \
sensitive_none_lookup.ksh
@@ -0,0 +1,42 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# Check that we can create FS with any supported casesensitivity value.
#
# STRATEGY:
# For all suported casesensitivity values:
# 1. Create FS with given casesensitivity value.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "Can create FS with any supported casesensitivity value"
for caseval in sensitive insensitive mixed; do
create_testfs "-o casesensitivity=$caseval"
destroy_testfs
done
log_pass "Can create FS with any supported casesensitivity value"
@@ -0,0 +1,27 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
NAME_C_ORIG=$($ECHO 'F\0303\0257L\0303\0253N\0303\0204m\0303\0253')
NAME_C_UPPER=$($ECHO 'F\0303\0217L\0303\0213N\0303\0204M\0303\0213')
NAME_C_LOWER=$($ECHO 'f\0303\0257l\0303\0253n\0303\0244m\0303\0253')
NAME_D_ORIG=$($ECHO 'Fi\0314\0210Le\0314\0210NA\0314\0210me\0314\0210')
NAME_D_UPPER=$($ECHO 'FI\0314\0210LE\0314\0210NA\0314\0210ME\0314\0210')
NAME_D_LOWER=$($ECHO 'fi\0314\0210le\0314\0210na\0314\0210me\0314\0210')
NAMES_ORIG="$NAME_C_ORIG $NAME_D_ORIG"
NAMES_UPPER="$NAME_C_UPPER $NAME_D_UPPER"
NAMES_LOWER="$NAME_C_LOWER $NAME_D_LOWER"
NAMES_C="$NAME_C_ORIG $NAME_C_UPPER $NAME_C_LOWER"
NAMES_D="$NAME_D_ORIG $NAME_D_UPPER $NAME_D_LOWER"
NAMES_ALL="$NAMES_C $NAMES_D"
+119
View File
@@ -0,0 +1,119 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/casenorm/casenorm.cfg
function create_testfs
{
typeset opts=$1
$RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
$MKDIR -p $TESTDIR || log_unresolved Could not create $TESTDIR
log_must $ZFS create $opts $TESTPOOL/$TESTFS
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
}
function destroy_testfs
{
if datasetexists $TESTPOOL/$TESTFS ; then
log_must $ZFS destroy -f $TESTPOOL/$TESTFS
$RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
fi
}
function create_file
{
typeset name=$TESTDIR/$1
$ECHO $name > $name
}
function delete_file
{
typeset name=$TESTDIR/$1
$RM $name >/dev/null 2>&1
if [[ $? -ne 0 ]] ; then
return 1
fi
if [[ -f $name ]] ; then
return 2
fi
}
function lookup_file
{
typeset name=$1
$ZLOOK -l $TESTDIR $name >/dev/null 2>&1
}
function lookup_file_ci
{
typeset name=$1
$ZLOOK -il $TESTDIR $name >/dev/null 2>&1
}
function lookup_any
{
for name in $NAMES_ALL ; do
lookup_file $name
if [[ $? -eq 0 ]] ; then
return 0
fi
done
return 1
}
function switch_norm
{
typeset norm=$(get_norm $1)
if [[ $norm == "C" ]] ; then
print "D"
else
print "C"
fi
}
function get_norm
{
if [[ "${NAMES_C#*$1}" != "${NAMES_C}" ]] ; then
print "C"
elif [[ "${NAMES_D#*$1}" != "${NAMES_D}" ]] ; then
print "D"
else
return 1
fi
}
function get_case
{
if [[ ${NAMES_UPPER#*$1} != ${NAMES_UPPER} ]] ; then
print "UPPER"
elif [[ ${NAMES_LOWER#*$1} != ${NAMES_LOWER} ]] ; then
print "LOWER"
elif [[ ${NAMES_ORIG#*$1} != ${NAMES_ORIG} ]] ; then
print "ORIG"
else
return 1
fi
}
+20
View File
@@ -0,0 +1,20 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
default_cleanup
@@ -0,0 +1,53 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=insensitive, normalization=formD,
# check that file can be deleted using any name form.
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that deleting file using other c/n name forms succeeds.
# 3. Check that file isn't accessible by any c/n name form.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CI-UN FS: delete succeeds using any name form"
# Can delete using any case/normalization form
create_testfs "-o casesensitivity=insensitive -o normalization=formD"
for name1 in $NAMES_ALL ; do
for name2 in $NAMES_ALL ; do
log_must create_file $name1
log_must delete_file $name2
log_mustnot lookup_any
done
done
destroy_testfs
log_pass "CI-UN FS: delete succeeds using any name form"
@@ -0,0 +1,51 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=insensitive, normalization=formD,
# check that lookup succeds using any name form.
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that lookup succeeds for any other c/n name form.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CI-UN FS: lookup succeeds using any name form"
create_testfs "-o casesensitivity=insensitive -o normalization=formD"
for name1 in $NAMES_ALL ; do
log_must create_file $name1
for name2 in $NAMES_ALL ; do
log_must lookup_file $name2
done
delete_file $name1
done
destroy_testfs
log_pass "CI-UN FS: lookup succeeds using any name form"
@@ -0,0 +1,71 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=insensitive, normalization=none,
# check that delete succeeds if (norm=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that delete succeeds if (norm=same).
# 3. Check that file is no longer accessible using any name form.
# 4. Check that delete fails if (norm=other).
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CI-not-UN FS: delete succeeds if (norm=same)"
create_testfs "-o casesensitivity=insensitive -o normalization=none"
for name1 in $NAMES_C ; do
for name2 in $NAMES_C ; do
log_must create_file $name1
log_must delete_file $name2
log_mustnot lookup_any
done
for name2 in $NAMES_D ; do
log_must create_file $name1
log_mustnot delete_file $name2
delete_file $name1
done
done
for name1 in $NAMES_D ; do
for name2 in $NAMES_D ; do
log_must create_file $name1
log_must delete_file $name2
log_mustnot lookup_any
done
for name2 in $NAMES_C ; do
log_must create_file $name1
log_mustnot delete_file $name2
delete_file $name1
done
done
destroy_testfs
log_pass "CI-not-UN FS: delete succeeds if (norm=same)"
@@ -0,0 +1,66 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=insensitive, normalization=none,
# check that lookup succeeds only if (norm=same)
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that lookup succeeds if (norm=same).
# 3. Check that lookup fails if (norm=other).
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CI-not-UN FS: lookup succeeds only if (norm=same)"
create_testfs "-o casesensitivity=insensitive -o normalization=none"
for name1 in $NAMES_C ; do
log_must create_file $name1
for name2 in $NAMES_C ; do
log_must lookup_file $name2
done
for name2 in $NAMES_D; do
log_mustnot lookup_file $name2
done
delete_file $name1
done
for name1 in $NAMES_D ; do
log_must create_file $name1
for name2 in $NAMES_D ; do
log_must lookup_file $name2
done
for name2 in $NAMES_C; do
log_mustnot lookup_file $name2
done
delete_file $name1
done
destroy_testfs
log_pass "CI-not-UN FS: lookup succeeds only if (norm=same)"
@@ -0,0 +1,59 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=mixed, normalization=formD,
# check that delete succeeds if (case=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that delete succeeds if (case=same).
# 3. Check that file is no longer accessible using any name form.
# 4. Check that delete fails for all other name forms other than original.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CM-UN FS: delete succeeds if (case=same)"
create_testfs "-o casesensitivity=mixed -o normalization=formD"
for name1 in $NAMES_ALL; do
typeset -n namen=NAME_$(switch_norm $name1)_$(get_case $name1)
for name2 in $NAMES_ALL; do
log_must create_file $name1
if [[ $name2 == $namen || $name2 == $name1 ]]; then
log_must delete_file $name2
log_mustnot lookup_any
else
log_mustnot delete_file $name2
fi
delete_file $name1
done
done
destroy_testfs
log_pass "CM-UN FS: delete succeeds if (case=same)"
@@ -0,0 +1,56 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=mixed, normalization=formD,
# check that lookup succeeds only if (case=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that lookup succeeds if (case=same).
# 3. Check that lookup fails if (case=other).
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CM-UN FS: lookup succeeds if (case=same)"
create_testfs "-o casesensitivity=mixed -o normalization=formD"
for name1 in $NAMES_ALL; do
log_must create_file $name1
for name2 in $NAMES_ALL; do
if [[ $(get_case $name2) == $(get_case $name1) ]]; then
log_must lookup_file $name2
else
log_mustnot lookup_file $name2
fi
done
delete_file $name1
done
destroy_testfs
log_pass "CM-UN FS: lookup succeeds if (case=same)"
@@ -0,0 +1,51 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=insensitive, normalization=formD,
# check that CI lookup succeeds using any name form.
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that CI lookup succeeds for any c/n name form.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CM-UN FS: CI lookup succeeds using any name form"
create_testfs "-o casesensitivity=mixed -o normalization=formD"
for name1 in $NAMES_ALL ; do
log_must create_file $name1
for name2 in $NAMES_ALL ; do
log_must lookup_file_ci $name2
done
delete_file $name1
done
destroy_testfs
log_pass "CM-UN FS: CI lookup succeeds using any name form"
@@ -0,0 +1,56 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=mixed, normalization=none,
# check that delete succeeds only if (case=same and norm=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file in given c/n name form.
# 2. Check that delete fails for all other name forms.
# 3. Check that delete succeeds if (case=same and norm=same).
# 4. Check that file is no longer accessible by any name form.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CM-not-UN FS: delete succeeds only if using exact name form"
create_testfs "-o casesensitivity=mixed -o normalization=none"
for name1 in $NAMES_ALL ; do
log_must create_file $name1
for name2 in $NAMES_ALL ; do
if [[ $name2 != $name1 ]] ; then
log_mustnot delete_file $name2
fi
done
delete_file $name1
log_mustnot lookup_any
done
destroy_testfs
log_pass "CM-not-UN FS: delete succeeds only if using exact name form"
@@ -0,0 +1,53 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=mixed, normalization=none,
# check that lookup succeeds only if (case=same and norm=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that lookup fails for all other c/n name forms.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CM-not-UN FS: lookup succeeds only if using exact name form"
create_testfs "-o casesensitivity=mixed -o normalization=none"
for name1 in $NAMES_ALL; do
for name2 in $NAMES_ALL; do
log_must create_file $name1
if [[ $name2 != $name1 ]]; then
log_mustnot lookup_file $name2
fi
delete_file $name1
done
done
destroy_testfs
log_pass "CM-not-UN FS: lookup succeeds only if using exact name form"
@@ -0,0 +1,66 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=mixed, normalization=none,
# check that CI lookup succeeds only if (norm=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that CI lookup succeeds if (norm=same).
# 3. Check that CI lookup fails if (norm=other).
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CM-not-UN FS: CI lookup succeeds only if (norm=same)"
create_testfs "-o casesensitivity=mixed -o normalization=none"
for name1 in $NAMES_C ; do
log_must create_file $name1
for name2 in $NAMES_C ; do
log_must lookup_file_ci $name2
done
for name2 in $NAMES_D; do
log_mustnot lookup_file_ci $name2
done
delete_file $name1
done
for name1 in $NAMES_D ; do
log_must create_file $name1
for name2 in $NAMES_D ; do
log_must lookup_file_ci $name2
done
for name2 in $NAMES_C; do
log_mustnot lookup_file_ci $name2
done
delete_file $name1
done
destroy_testfs
log_pass "CM-not-UN FS: CI lookup succeeds only if (norm=same)"
@@ -0,0 +1,57 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# Check that we can create FS with all supported normalization forms.
#
# STRATEGY:
# 1. Create FS with all supported normalization forms.
# 2. Check that utf8only is set on except for normalization=none.
# 3. Check that it's not possible to create FS with utf8only=off
# and normalization other than none.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "Can create FS with all supported normalization forms"
for form in none formC formD formKC formKD; do
create_testfs "-o normalization=$form"
if [[ $form != "none" ]] ; then
utf8only=$($ZFS get -H -o value utf8only $TESTPOOL/$TESTFS)
if [[ $utf8only != "on" ]]; then
log_fail "Turning on normalization didn't set " \
"utf8only to on"
fi
fi
destroy_testfs
done
for form in formC formD formKC formKD; do
log_mustnot $ZFS create -o utf8only=off -o normalization=$form \
$TESTPOOL/$TESTFS
destroy_testfs
done
log_pass "Can create FS with all supported normalization forms"
@@ -0,0 +1,59 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=sensitive, normalization=formD,
# check that delete succeeds if (case=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that delete succeeds if (case=same).
# 3. Check that file is no longer accessible using any name form.
# 4. Check that delete fails for all other name forms.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CS-UN FS: delete succeeds if (case=same)"
create_testfs "-o casesensitivity=sensitive -o normalization=formD"
for name1 in $NAMES_ALL ; do
typeset -n namen=NAME_$(switch_norm $name1)_$(get_case $name1)
for name2 in $NAMES_ALL ; do
log_must create_file $name1
if [[ $name2 == $namen || $name2 == $name1 ]] ; then
log_must delete_file $name2
log_mustnot lookup_any
else
log_mustnot delete_file $name2
fi
delete_file $name1
done
done
destroy_testfs
log_pass "CS-UN FS: delete succeeds if (case=same)"
@@ -0,0 +1,56 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=sensitive, normalization=formD,
# check that lookup only if (case=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that lookup succeeds if (case=same).
# 3. Check that lookup fails if (case=other).
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CS-UN FS: lookup succeeds if (case=same)"
create_testfs "-o casesensitivity=sensitive -o normalization=formD"
for name1 in $NAMES_ALL; do
log_must create_file $name1
for name2 in $NAMES_ALL; do
if [[ $(get_case $name2) == $(get_case $name1) ]]; then
log_must lookup_file $name2
else
log_mustnot lookup_file $name2
fi
done
delete_file $name1
done
destroy_testfs
log_pass "CS-UN FS: lookup succeeds if (case=same)"
@@ -0,0 +1,56 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=sensitive, normalization=none,
# check that delete succeeds only if (case=same and norm=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file in given c/n name form.
# 2. Check that delete fails for all other name forms.
# 3. Check that delete succeeds if (case=same and norm=same).
# 4. Check that file is no longer accessible by any name form.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CS-not-UN FS: delete succeeds only if using exact name form"
create_testfs "-o casesensitivity=sensitive -o normalization=none"
for name1 in $NAMES_ALL ; do
log_must create_file $name1
for name2 in $NAMES_ALL ; do
if [[ $name2 != $name1 ]] ; then
log_mustnot delete_file $name2
fi
done
delete_file $name1
log_mustnot lookup_any
done
destroy_testfs
log_pass "CS-not-UN FS: delete succeeds only if using exact name form"
@@ -0,0 +1,53 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
# For the filesystem with casesensitivity=sensitive, normalization=none,
# check that lookup succeeds only if (case=same and norm=same).
#
# STRATEGY:
# For each c/n name form:
# 1. Create file with given c/n name form.
# 2. Check that lookup fails for all other c/n name forms.
verify_runnable "global"
function cleanup
{
destroy_testfs
}
log_onexit cleanup
log_assert "CS-not-UN FS: lookup succeeds only if using exact name form"
create_testfs "-o casesensitivity=sensitive -o normalization=none"
for name1 in $NAMES_ALL; do
for name2 in $NAMES_ALL; do
log_must create_file $name1
if [[ $name2 != $name1 ]]; then
log_mustnot lookup_file $name2
fi
delete_file $name1
done
done
destroy_testfs
log_pass "CS-not-UN FS: lookup succeeds only if using exact name form"
+23
View File
@@ -0,0 +1,23 @@
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
DISK=${DISKS%% *}
log_must $ZPOOL create $TESTPOOL $DISK
log_pass
@@ -0,0 +1,10 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/clean_mirror
dist_pkgdata_SCRIPTS = \
clean_mirror_common.kshlib \
default.cfg \
cleanup.ksh \
setup.ksh \
clean_mirror_001_pos.ksh \
clean_mirror_002_pos.ksh \
clean_mirror_003_pos.ksh \
clean_mirror_004_pos.ksh
@@ -0,0 +1,53 @@
#! /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 2007 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/clean_mirror/clean_mirror_common.kshlib
#
# DESCRIPTION:
# The primary side of a zpool mirror can be zeroed without causing damage
# to the data in the pool
#
# STRATEGY:
# 1) Write several files to the ZFS filesystem mirror
# 2) dd from /dev/zero over the primary side of the mirror
# 3) verify that all the file contents are unchanged on the file system
#
verify_runnable "global"
log_assert "The primary side of a zpool mirror may be completely wiped" \
"without affecting the content of the pool"
overwrite_verify_mirror $SIDE_PRIMARY /dev/zero
log_pass "The overwrite had no effect on the data"
@@ -0,0 +1,53 @@
#! /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 2007 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/clean_mirror/clean_mirror_common.kshlib
#
# DESCRIPTION:
# The secondary side of a zpool mirror can be zeroed without causing damage
# to the data in the pool
#
# STRATEGY:
# 1) Write several files to the ZFS filesystem in the mirrored pool
# 2) dd from /dev/zero over the secondary side of the mirror
# 3) verify that all the file contents are unchanged on the file system
#
verify_runnable "global"
log_assert "The primary side of a zpool mirror may be completely wiped" \
"without affecting the content of the pool"
overwrite_verify_mirror $SIDE_SECONDARY /dev/zero
log_pass "The overwrite had no effect on the data"
@@ -0,0 +1,53 @@
#! /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 2007 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/clean_mirror/clean_mirror_common.kshlib
#
# DESCRIPTION:
# The primary side of a zpool mirror can be mangled without causing damage
# to the data in the pool
#
# STRATEGY:
# 1) Write several files to the ZFS filesystem mirror
# 2) dd from /dev/urandom over the primary side of the mirror
# 3) verify that all the file contents are unchanged on the file system
#
verify_runnable "global"
log_assert "The primary side of a zpool mirror may be completely mangled" \
"without affecting the content of the pool"
overwrite_verify_mirror $SIDE_PRIMARY /dev/urandom
log_pass "The overwrite did not have any effect on the data"
@@ -0,0 +1,53 @@
#! /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 2007 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/clean_mirror/clean_mirror_common.kshlib
#
# DESCRIPTION:
# The secondary side of a zpool mirror can be mangled without causing damage
# to the data in the pool
#
# STRATEGY:
# 1) Write several files to the ZFS filesystem in the mirrored pool
# 2) dd from /dev/urandom over the secondary side of the mirror
# 3) verify that all the file contents are unchanged on the file system
#
verify_runnable "global"
log_assert "The primary side of a zpool mirror may be completely mangled" \
"without affecting the content of the pool"
overwrite_verify_mirror $SIDE_SECONDARY /dev/urandom
log_pass "The overwrite had no effect on the data"
@@ -0,0 +1,78 @@
#
# 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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/clean_mirror/default.cfg
# Most of the code related to the clearing of mirrors is duplicated in all
# the test cases below this directory, barring a few minor changes
# involving the device to be affected and the 'object' to use to mangle
# the contents of the mirror.
# This code is sourced into each of these test cases.
function overwrite_verify_mirror
{
typeset AFFECTED_DEVICE=$1
typeset OVERWRITING_DEVICE=$2
typeset atfile=0
set -A files
set -A cksums
set -A newcksums
while (( atfile < FILE_COUNT )); do
files[$atfile]=$TESTDIR/file.$atfile
log_must $FILE_WRITE -o create -f $TESTDIR/file.$atfile \
-b $FILE_SIZE -c 1
cksums[$atfile]=$($CKSUM ${files[$atfile]})
(( atfile = atfile + 1 ))
done
# dd the primary side of the mirror
log_must $DD if=$OVERWRITING_DEVICE of=$AFFECTED_DEVICE \
seek=8 bs=$DD_BLOCK count=$(( DD_COUNT - 128 )) conv=notrunc
atfile=0
typeset -i failedcount=0
while (( atfile < FILE_COUNT )); do
files[$atfile]=$TESTDIR/file.$atfile
newcksum=$($CKSUM ${files[$atfile]})
if [[ $newcksum != ${cksums[$atfile]} ]]; then
(( failedcount = failedcount + 1 ))
fi
$RM -f ${files[$atfile]}
(( atfile = atfile + 1 ))
done
if (( $failedcount > 0 )); then
log_fail "of the $FILE_COUNT files $failedcount did not " \
"have the same checksum before and after."
fi
}
+49
View File
@@ -0,0 +1,49 @@
#! /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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/clean_mirror/default.cfg
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
$DF -F zfs -h | $GREP "$TESTFS " >/dev/null
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
destroy_pool $TESTPOOL
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
if [[ -n $SINGLE_DISK ]]; then
log_must cleanup_devices $MIRROR_PRIMARY
else
log_must cleanup_devices $MIRROR_PRIMARY $MIRROR_SECONDARY
fi
log_pass
@@ -0,0 +1,72 @@
#
# 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
typeset -i NUMBER_OF_DISKS=0
for i in $DISKS; do
[[ -n $MIRROR_PRIMARY ]] && MIRROR_SECONDARY=$i
[[ -z $MIRROR_PRIMARY ]] && MIRROR_PRIMARY=$i
done
if [[ -z $MIRROR_SECONDARY ]]; then
# We need to repartition the single disk to two slices
SINGLE_DISK=$MIRROR_PRIMARY
MIRROR_SECONDARY=$MIRROR_PRIMARY
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=1
if is_linux; then
SIDE_PRIMARY=${SINGLE_DISK}p1
SIDE_SECONDARY=${SINGLE_DISK}p2
else
SIDE_PRIMARY=${SINGLE_DISK}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${SINGLE_DISK}s${SIDE_SECONDARY_PART}
fi
else
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=0
if is_linux; then
SIDE_PRIMARY=${MIRROR_PRIMARY}p1
SIDE_SECONDARY=${MIRROR_SECONDARY}p1
else
SIDE_PRIMARY=${MIRROR_PRIMARY}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${MIRROR_SECONDARY}s${SIDE_SECONDARY_PART}
fi
fi
export MIRROR_PRIMARY MIRROR_SECONDARY SINGLE_DISK SIDE_PRIMARY SIDE_SECONDARY
export FILE_COUNT=10
export FILE_SIZE=$(( 1024 * 1024 ))
export MIRROR_MEGS=100
export MIRROR_SIZE=${MIRROR_MEGS}m # default mirror size
export DD_BLOCK=$(( 64 * 1024 ))
export DD_COUNT=$(( MIRROR_MEGS * 1024 * 1024 / DD_BLOCK ))
+52
View File
@@ -0,0 +1,52 @@
#! /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/tests/functional/clean_mirror/default.cfg
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
if ! $(is_physical_device $DISKS) ; then
log_unsupported "This directory cannot be run on raw files."
fi
if [[ -n $SINGLE_DISK ]]; then
log_note "Partitioning a single disk ($SINGLE_DISK)"
else
log_note "Partitioning disks ($MIRROR_PRIMARY $MIRROR_SECONDARY)"
fi
log_must set_partition $SIDE_PRIMARY_PART "" $MIRROR_SIZE $MIRROR_PRIMARY
log_must set_partition $SIDE_SECONDARY_PART "" $MIRROR_SIZE $MIRROR_SECONDARY
default_mirror_setup $SIDE_PRIMARY $SIDE_SECONDARY
log_pass
@@ -0,0 +1,47 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root
dist_pkgdata_SCRIPTS = \
cli_common.kshlib
SUBDIRS = \
zdb \
zfs \
zfs_clone \
zfs_copies \
zfs_create \
zfs_destroy \
zfs_get \
zfs_inherit \
zfs_mount \
zfs_promote \
zfs_property \
zfs_receive \
zfs_rename \
zfs_reservation \
zfs_rollback \
zfs_send \
zfs_set \
zfs_share \
zfs_snapshot \
zfs_unmount \
zfs_unshare \
zfs_upgrade \
zpool \
zpool_add \
zpool_attach \
zpool_clear \
zpool_create \
zpool_destroy \
zpool_detach \
zpool_expand \
zpool_export \
zpool_get \
zpool_history \
zpool_import \
zpool_offline \
zpool_online \
zpool_remove \
zpool_replace \
zpool_scrub \
zpool_set \
zpool_status \
zpool_upgrade
@@ -0,0 +1,86 @@
#
# 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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
#
# Get the checksum and size of the file.
#
function get_cksum # <file path>
{
return $($CKSUM $1 | $AWK '{print $1 $2}')
}
#
# Compare the check sum of target files with the original file
#
function compare_cksum #<orig_data> <target_data1>...<target_datan>
{
typeset orig_data=$1
typeset orig_sum=$(get_cksum $orig_data)
typeset target_sum=""
typeset bad_data_list=""
typeset -i bad_count=0
shift
for data in $@; do
if [[ ! -e $data ]]; then
bad_data_list="$bad_data_list $data"
(( bad_count +=1 ))
continue
fi
target_sum=$(get_cksum $data)
if [[ $target_sum != $orig_sum ]]; then
bad_data_list="$bad_data_list $data"
(( bad_count +=1 ))
fi
done
[[ $bad_data_list != "" ]] && \
log_fail "Data corruptions appear during send->receive." \
"There are total $bad_count corruptions. They are:\n"\
"$bad_data_list"
}
#
# Check the received dataset exists or not
#
function receive_check #<dataset1>...<datasetn>
{
typeset bad_rst_tgts=""
for dataset in $@; do
! datasetexists $dataset && \
bad_rst_tgts="$bad_rst_tgts $dataset"
done
if [[ $bad_rst_tgts != "" ]]; then
log_fail "Restoring fails. The specified datasets"\
"$bad_rst_tgts are not being received."
fi
}
@@ -0,0 +1,3 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zdb
dist_pkgdata_SCRIPTS = \
zdb_001_neg.ksh
@@ -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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# A badly formed parameter passed to zdb(1) should
# return an error.
#
# STRATEGY:
# 1. Create an array containg bad zdb parameters.
# 2. For each element, execute the sub-command.
# 3. Verify it returns an error.
#
verify_runnable "global"
set -A args "create" "add" "destroy" "import fakepool" \
"export fakepool" "create fakepool" "add fakepool" \
"create mirror" "create raidz" \
"create mirror fakepool" "create raidz fakepool" \
"create raidz1 fakepool" "create raidz2 fakepool" \
"create fakepool mirror" "create fakepool raidz" \
"create fakepool raidz1" "create fakepool raidz2" \
"add fakepool mirror" "add fakepool raidz" \
"add fakepool raidz1" "add fakepool raidz2" \
"add mirror fakepool" "add raidz fakepool" \
"add raidz1 fakepool" "add raidz2 fakepool" \
"setvprop" "blah blah" "-%" "--?" "-*" "-=" \
"-a" "-f" "-g" "-h" "-j" "-k" "-m" "-n" "-o" "-p" "-p /tmp" \
"-q" "-r" "-t" "-w" "-x" "-y" "-z" \
"-D" "-E" "-G" "-H" "-I" "-J" "-K" "-M" \
"-N" "-Q" "-R" "-S" "-W" "-Y" "-Z"
log_assert "Execute zdb using invalid parameters."
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZDB ${args[i]}
((i = i + 1))
done
log_pass "Badly formed zdb parameters fail as expected."
@@ -0,0 +1,7 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
zfs_001_neg.ksh \
zfs_002_pos.ksh \
zfs_003_neg.ksh
+30
View File
@@ -0,0 +1,30 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
default_cleanup
+32
View File
@@ -0,0 +1,32 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
DISK=${DISKS%% *}
default_setup $DISK
@@ -0,0 +1,72 @@
#!/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.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# Try each zfs(1) sub-command without parameters to make sure
# it returns an error.
#
# STRATEGY:
# 1. Create an array of parameters
# 2. For each parameter in the array, execute the sub-command
# 3. Verify an error is returned.
#
verify_runnable "both"
set -A args "" "create" "create -s" "create -V" "create -s -V" \
"destroy" "destroy -f" "destroy -r" "destroy -R" "destroy -rRf" \
"snapshot" "snapshot -r" \
"rollback" "rollback -r" "rollback -R" "rollback -f" "rollback -rRf" \
"clone" "clone -p" "promote" "rename" "rename -p" "rename -r" "list blah" \
"set" "get" "get -rHp" "get -o" "get -s" \
"inherit" "inherit -r" "quota=" \
"set reservation=" "set atime=" "set checksum=" "set compression=" \
"set type=" "set creation=" "set used=" "set available=" "set referenced=" \
"set compressratio=" "set mounted=" "set origin=" "set quota=" \
"set reservation=" "set volsize=" " set volblocksize=" "set recordsize=" \
"set mountpoint=" "set devices=" "set exec=" "set setuid=" "set readonly=" \
"set zoned=" "set snapdir=" "set aclmode=" "set aclinherit=" \
"set quota=blah" "set reservation=blah" "set atime=blah" "set checksum=blah" \
"set compression=blah" \
"upgrade blah" "mount blah" "mount -o" \
"umount blah" "unmount" "unmount blah" "unmount -f" \
"share" "unshare" "send" "send -i" "receive" "receive -d" "receive -vnF" \
"recv" "recv -d" "recv -vnF" "allow" "unallow" \
"blah blah" "-%" "--" "--?" "-*" "-="
log_assert "Badly-formed zfs sub-command should return an error."
typeset -i i=0
while (( $i < ${#args[*]} )); do
log_mustnot $ZFS ${args[i]}
((i = i + 1))
done
log_pass "Badly formed zfs sub-commands fail as expected."
@@ -0,0 +1,113 @@
#!/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) 2012 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# With ZFS_ABORT set, all zfs commands should be able to abort and generate a
# core file.
#
# STRATEGY:
# 1. Create an array of zfs command
# 2. Execute each command in the array
# 3. Verify the command aborts and generate a core file
#
verify_runnable "both"
function cleanup
{
unset ZFS_ABORT
if [[ -d $corepath ]]; then
$RM -rf $corepath
fi
for ds in $fs1 $fs $ctr; do
if datasetexists $ds; then
log_must $ZFS destroy -rRf $ds
fi
done
}
log_assert "With ZFS_ABORT set, all zfs commands can abort and generate a " \
"core file."
log_onexit cleanup
#preparation work for testing
corepath=$TESTDIR/core
if [[ -d $corepath ]]; then
$RM -rf $corepath
fi
log_must $MKDIR $corepath
ctr=$TESTPOOL/$TESTCTR
log_must $ZFS create $ctr
fs=$ctr/$TESTFS
fs1=$ctr/$TESTFS1
snap=$fs@$TESTSNAP
clone=$ctr/$TESTCLONE
streamf=$corepath/s.$$
typeset cmds=("create $fs" "list $fs" "snapshot $snap" "set snapdir=hidden $fs" \
"get snapdir $fs" "rollback $snap" "inherit snapdir $fs" \
"rename $fs $fs-new" "rename $fs-new $fs" "unmount $fs" \
"mount $fs" "share $fs" "unshare $fs" "send $snap \>$streamf" \
"receive $fs1 \<$streamf" "clone $snap $clone" "promote $clone" \
"promote $fs" "destroy -rRf $fs")
typeset badparams=("" "create" "destroy" "snapshot" "rollback" "clone" \
"promote" "rename" "list -*" "set" "get -*" "inherit" "mount -A" \
"unmount" "share" "unshare" "send" "receive")
if is_linux; then
ulimit -c unlimited
echo "$corepath/core.zfs" >/proc/sys/kernel/core_pattern
echo 0 >/proc/sys/kernel/core_uses_pid
else
log_must $COREADM -p ${corepath}/core.%f
fi
log_must export ZFS_ABORT=yes
for subcmd in "${cmds[@]}" "${badparams[@]}"; do
$ZFS $subcmd >/dev/null 2>&1 && log_fail "$subcmd passed incorrectly."
corefile=${corepath}/core.zfs
if [[ ! -e $corefile ]]; then
log_fail "$ZFS $subcmd cannot generate core file with " \
"ZFS_ABORT set."
fi
log_must $RM -f $corefile
done
log_pass "With ZFS_ABORT set, zfs command can abort and generate core file " \
"as expected."
@@ -0,0 +1,58 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# zfs command will failed with unexpected scenarios:
# (1) ZFS_DEV cannot be opened
# (2) MNTTAB cannot be opened
#
# STRATEGY:
# 1. Create an array of zfs command
# 2. Execute each command in the array
# 3. Verify the command aborts and generate a core file
#
verify_runnable "global"
log_assert "zfs fails with unexpected scenarios."
#verify zfs failed if ZFS_DEV cannot be opened
ZFS_DEV=/dev/zfs
for file in $ZFS_DEV $MNTTAB; do
if [[ -e $file ]]; then
$MV $file ${file}.bak
fi
for cmd in "" "list" "get all" "mount"; do
log_mustnot eval "$ZFS $cmd >/dev/null 2>&1"
done
$MV ${file}.bak $file
done
log_pass "zfs fails with unexpected scenarios as expected."
@@ -0,0 +1,14 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_clone
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
zfs_clone_001_neg.ksh \
zfs_clone_002_pos.ksh \
zfs_clone_003_pos.ksh \
zfs_clone_004_pos.ksh \
zfs_clone_005_pos.ksh \
zfs_clone_006_pos.ksh \
zfs_clone_007_pos.ksh \
zfs_clone_008_neg.ksh \
zfs_clone_009_neg.ksh \
zfs_clone_010_pos.ksh
@@ -0,0 +1,30 @@
#!/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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
default_container_cleanup
@@ -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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
DISK=${DISKS%% *}
default_container_volume_setup ${DISK}
@@ -0,0 +1,126 @@
#!/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) 2012, 2015 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# 'zfs clone' should fail with inapplicable scenarios, including:
# * Null arguments
# * non-existant snapshots.
# * invalid characters in ZFS namesapec
# * Leading slash in the target clone name
# * The argument contains an empty component.
# * The pool specified in the target doesn't exist.
# * The parent dataset of the target doesn't exist.
# * The argument refer to a pool, not dataset.
# * The target clone already exists.
# * Null target clone argument.
# * Too many arguments.
# * Invalid record sizes.
#
# STRATEGY:
# 1. Create an array of parameters
# 2. For each parameter in the array, execute the sub-command
# 3. Verify an error is returned.
#
verify_runnable "both"
typeset target1=$TESTPOOL/$TESTFS1
typeset target2=$TESTPOOL/$TESTCTR1/$TESTFS1
typeset targets="$target1 $target2 $NONEXISTPOOLNAME/$TESTFS"
set -A args "" \
"$TESTPOOL/$TESTFS@blah $target1" "$TESTPOOL/$TESTVOL@blah $target1" \
"$TESTPOOL/$TESTFS@blah* $target1" "$TESTPOOL/$TESTVOL@blah* $target1" \
"$SNAPFS $target1*" "$SNAPFS1 $target1*" \
"$SNAPFS /$target1" "$SNAPFS1 /$target1" \
"$SNAPFS $TESTPOOL//$TESTFS1" "$SNAPFS1 $TESTPOOL//$TESTFS1" \
"$SNAPFS $NONEXISTPOOLNAME/$TESTFS" "$SNAPFS1 $NONEXISTPOOLNAME/$TESTFS" \
"$SNAPFS" "$SNAPFS1" \
"$SNAPFS $target1 $target2" "$SNAPFS1 $target1 $target2" \
"-o recordsize=2M $SNAPFS1 $target1" \
"-o recordsize=128B $SNAPFS1 $target1"
typeset -i argsnum=${#args[*]}
typeset -i j=0
while (( j < argsnum )); do
args[((argsnum+j))]="-p ${args[j]}"
((j = j + 1))
done
set -A moreargs "$SNAPFS $target2" "$SNAPFS1 $target2" \
"$SNAPFS $TESTPOOL" "$SNAPFS1 $TESTPOOL" \
"$SNAPFS $TESTPOOL/$TESTCTR" "$SNAPFS $TESTPOOL/$TESTFS" \
"$SNAPFS1 $TESTPOOL/$TESTCTR" "$SNAPFS1 $TESTPOOL/$TESTFS"
set -A args ${args[*]} ${moreargs[*]}
function setup_all
{
log_note "Create snapshots and mount them..."
for snap in $SNAPFS $SNAPFS1 ; do
if ! snapexists $snap ; then
log_must $ZFS snapshot $snap
fi
done
return 0
}
function cleanup_all
{
for fs in $targets; do
datasetexists $fs && log_must $ZFS destroy -f $fs
done
for snap in $SNAPFS $SNAPFS1 ; do
snapexists $snap && log_must $ZFS destroy -Rf $snap
done
return 0
}
log_assert "Badly-formed 'zfs clone' with inapplicable scenarios" \
"should return an error."
log_onexit cleanup_all
setup_all
typeset -i i=0
while (( i < ${#args[*]} )); do
log_mustnot $ZFS clone ${args[i]}
((i = i + 1))
done
log_pass "Badly formed 'zfs clone' with inapplicable scenarios" \
"fail as expected."
@@ -0,0 +1,89 @@
#!/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) 2012 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# 'zfs clone -p' should work as expected
#
# STRATEGY:
# 1. prepare snapshots
# 2. make sure without -p option, 'zfs clone' will fail
# 3. with -p option, the clone can be created
# 4. run 'zfs clone -p' again, the exit code should be zero
#
verify_runnable "both"
function setup_all
{
log_note "Create snapshots and mount them..."
for snap in $SNAPFS $SNAPFS1 ; do
if ! snapexists $snap ; then
log_must $ZFS snapshot $snap
fi
done
return 0
}
function cleanup_all
{
if datasetexists $TESTPOOL/notexist ; then
log_must $ZFS destroy -rRf $TESTPOOL/notexist
fi
for snap in $SNAPFS $SNAPFS1 ; do
if snapexists $snap ; then
log_must $ZFS destroy -Rf $snap
fi
done
return 0
}
log_assert "clone -p should work as expected."
log_onexit cleanup_all
setup_all
log_must verify_opt_p_ops "clone" "fs" $SNAPFS \
$TESTPOOL/notexist/new/clonefs$$
if is_global_zone ; then
log_must verify_opt_p_ops "clone" "vol" $SNAPFS1 \
$TESTPOOL/notexist/new/clonevol$$
fi
log_pass "clone -p should work as expected."
@@ -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 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/properties.kshlib
#
# DESCRIPTION:
# 'zfs clone -o property=value filesystem' can successfully create a ZFS
# clone filesystem with correct property set.
#
# STRATEGY:
# 1. Create a ZFS clone filesystem in the storage pool with -o option
# 2. Verify the filesystem created successfully
# 3. Verify the property is correctly set
#
verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must $ZFS destroy -Rf $SNAPFS
fi
}
log_onexit cleanup
log_assert "'zfs clone -o property=value filesystem' can successfully create" \
"a ZFS clone filesystem with correct property set."
log_must $ZFS snapshot $SNAPFS
typeset -i i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
log_must $ZFS clone -o ${RW_FS_PROP[$i]} $SNAPFS $TESTPOOL/$TESTCLONE
datasetexists $TESTPOOL/$TESTCLONE || \
log_fail "zfs clone $TESTPOOL/$TESTCLONE fail."
propertycheck $TESTPOOL/$TESTCLONE ${RW_FS_PROP[i]} || \
log_fail "${RW_FS_PROP[i]} is failed to set."
log_must $ZFS destroy -f $TESTPOOL/$TESTCLONE
(( i = i + 1 ))
done
log_pass "'zfs clone -o property=value filesystem' can successfully create" \
"a ZFS clone filesystem with correct property set."
@@ -0,0 +1,87 @@
#!/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) 2012 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/properties.kshlib
#
# DESCRIPTION:
# 'zfs clone -o property=value filesystem' can successfully create a ZFS
# clone filesystem with multiple properties set.
#
# STRATEGY:
# 1. Create a ZFS clone filesystem in the storage pool with multiple -o options
# 2. Verify the filesystem created successfully
# 3. Verify the properties are correctly set
#
verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must $ZFS destroy -Rf $SNAPFS
fi
}
log_onexit cleanup
log_assert "'zfs clone -o property=value filesystem' can successfully create" \
"a ZFS clone filesystem with multiple properties set."
typeset -i i=0
typeset opts=""
log_must $ZFS snapshot $SNAPFS
while (( $i < ${#RW_FS_PROP[*]} )); do
if [[ ${RW_FS_PROP[$i]} != *"checksum"* ]]; then
opts="$opts -o ${RW_FS_PROP[$i]}"
fi
(( i = i + 1 ))
done
log_must $ZFS clone $opts $SNAPFS $TESTPOOL/$TESTCLONE
datasetexists $TESTPOOL/$TESTCLONE || \
log_fail "zfs create $TESTPOOL/$TESTCLONE fail."
i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
if [[ ${RW_FS_PROP[$i]} != *"checksum"* ]]; then
propertycheck $TESTPOOL/$TESTCLONE ${RW_FS_PROP[i]} || \
log_fail "${RW_FS_PROP[i]} is failed to set."
fi
(( i = i + 1 ))
done
log_pass "'zfs clone -o property=value filesystem' can successfully create" \
"a ZFS clone filesystem with multiple properties set."
@@ -0,0 +1,75 @@
#!/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) 2012 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/properties.kshlib
#
# DESCRIPTION:
# 'zfs clone -o property=value -V size volume' can successfully create a ZFS
# clone volume with correct property set.
#
# STRATEGY:
# 1. Create a ZFS clone volume in the storage pool with -o option
# 2. Verify the volume created successfully
# 3. Verify the property is correctly set
#
verify_runnable "global"
function cleanup
{
if snapexists $SNAPFS1 ; then
log_must $ZFS destroy -Rf $SNAPFS1
fi
}
log_onexit cleanup
log_assert "'zfs clone -o property=value -V size volume' can successfully" \
"create a ZFS clone volume with correct property set."
log_must $ZFS snapshot $SNAPFS1
typeset -i i=0
while (( $i < ${#RW_VOL_CLONE_PROP[*]} )); do
log_must $ZFS clone -o ${RW_VOL_CLONE_PROP[$i]} $SNAPFS1 $TESTPOOL/$TESTCLONE
datasetexists $TESTPOOL/$TESTCLONE || \
log_fail "zfs clone $TESTPOOL/$TESTCLONE fail."
propertycheck $TESTPOOL/$TESTCLONE ${RW_VOL_CLONE_PROP[i]} || \
log_fail "${RW_VOL_CLONE_PROP[i]} is failed to set."
log_must $ZFS destroy -f $TESTPOOL/$TESTCLONE
(( i = i + 1 ))
done
log_pass "'zfs clone -o property=value volume' can successfully" \
"create a ZFS clone volume with correct property set."

Some files were not shown because too many files have changed in this diff Show More