mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-06-01 03:34:10 +03:00
OpenZFS 7290 - ZFS test suite needs to control what utilities it can run
Authored by: John Wren Kennedy <john.kennedy@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Dan McDonald <danmcd@omniti.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> Ported-by: George Melikov <mail@gmelikov.ru> Porting Notes: - Utilities which aren't available under Linux have been removed. - Because of sudo's default secure path behavior PATH must be explicitly reset at the top of libtest.shlib. This avoids the need for all users to customize secure path on their system. - Updated ZoL infrastructure to manage constrained path - Updated all test cases - Check permissions for usergroup tests - When testing in-tree create links under bin/ - Update fault cleanup such that missing files during cleanup aren't fatal. - Configure su environment with constrained path OpenZFS-issue: https://www.illumos.org/issues/7290 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/1d32ba6 Closes #5903
This commit is contained in:
committed by
Brian Behlendorf
parent
7a4500a101
commit
c1d9abf905
@@ -38,5 +38,5 @@ export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
|
||||
export STF_TIMEOUT=3600
|
||||
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
set_device_dir
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013, 2014 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -52,7 +52,7 @@ function cleanup
|
||||
# Ensure we don't leave disks in the offline state
|
||||
#
|
||||
for disk in $DISKLIST; do
|
||||
log_must $ZPOOL online $TESTPOOL $disk
|
||||
log_must zpool online $TESTPOOL $disk
|
||||
check_state $TESTPOOL $disk "online"
|
||||
if [[ $? != 0 ]]; then
|
||||
log_fail "Unable to online $disk"
|
||||
@@ -60,33 +60,33 @@ function cleanup
|
||||
|
||||
done
|
||||
|
||||
$KILL $killpid >/dev/null 2>&1
|
||||
[[ -e $TESTDIR ]] && log_must $RM -rf $TESTDIR/*
|
||||
kill $killpid >/dev/null 2>&1
|
||||
[[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/*
|
||||
}
|
||||
|
||||
log_assert "Turning a disk offline and back online during I/O completes."
|
||||
|
||||
$FILE_TRUNC -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 &
|
||||
file_trunc -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 &
|
||||
typeset killpid="$! "
|
||||
|
||||
for disk in $DISKLIST; do
|
||||
for i in 'do_offline' 'do_offline_while_already_offline'; do
|
||||
log_must $ZPOOL offline $TESTPOOL $disk
|
||||
log_must zpool offline $TESTPOOL $disk
|
||||
check_state $TESTPOOL $disk "offline"
|
||||
if [[ $? != 0 ]]; then
|
||||
log_fail "$disk of $TESTPOOL is not offline."
|
||||
fi
|
||||
done
|
||||
|
||||
log_must $ZPOOL online $TESTPOOL $disk
|
||||
log_must zpool online $TESTPOOL $disk
|
||||
check_state $TESTPOOL $disk "online"
|
||||
if [[ $? != 0 ]]; then
|
||||
log_fail "$disk of $TESTPOOL did not match online state"
|
||||
fi
|
||||
done
|
||||
|
||||
log_must $KILL $killpid
|
||||
$SYNC
|
||||
log_must kill $killpid
|
||||
sync
|
||||
|
||||
typeset dir=$(get_device_dir $DISKS)
|
||||
verify_filesys "$TESTPOOL" "$TESTPOOL/$TESTFS" "$dir"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013, 2014 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -53,7 +53,7 @@ function cleanup
|
||||
# Ensure we don't leave disks in the offline state
|
||||
#
|
||||
for disk in $DISKLIST; do
|
||||
log_must $ZPOOL online $TESTPOOL $disk
|
||||
log_must zpool online $TESTPOOL $disk
|
||||
check_state $TESTPOOL $disk "online"
|
||||
if [[ $? != 0 ]]; then
|
||||
log_fail "Unable to online $disk"
|
||||
@@ -61,15 +61,15 @@ function cleanup
|
||||
|
||||
done
|
||||
|
||||
$KILL $killpid >/dev/null 2>&1
|
||||
[[ -e $TESTDIR ]] && log_must $RM -rf $TESTDIR/*
|
||||
kill $killpid >/dev/null 2>&1
|
||||
[[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/*
|
||||
}
|
||||
|
||||
log_assert "Turning both disks offline should fail."
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
$FILE_TRUNC -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 &
|
||||
file_trunc -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 &
|
||||
typeset killpid="$! "
|
||||
|
||||
disks=($DISKLIST)
|
||||
@@ -79,14 +79,14 @@ disks=($DISKLIST)
|
||||
# all but one vdev offlined, whereas with raidz there can be only one.
|
||||
#
|
||||
pooltype='mirror'
|
||||
$ZPOOL list -v $TESTPOOL | $GREP raidz >/dev/null 2>&1 && pooltype='raidz'
|
||||
zpool list -v $TESTPOOL | grep raidz >/dev/null 2>&1 && pooltype='raidz'
|
||||
|
||||
typeset -i i=0
|
||||
while [[ $i -lt ${#disks[*]} ]]; do
|
||||
typeset -i j=0
|
||||
if [[ $pooltype = 'mirror' ]]; then
|
||||
# Hold one disk online, verify the others can be offlined.
|
||||
log_must $ZPOOL online $TESTPOOL ${disks[$i]}
|
||||
log_must zpool online $TESTPOOL ${disks[$i]}
|
||||
check_state $TESTPOOL ${disks[$i]} "online" || \
|
||||
log_fail "Failed to set ${disks[$i]} online"
|
||||
while [[ $j -lt ${#disks[*]} ]]; do
|
||||
@@ -94,14 +94,14 @@ while [[ $i -lt ${#disks[*]} ]]; do
|
||||
((j++))
|
||||
continue
|
||||
fi
|
||||
log_must $ZPOOL offline $TESTPOOL ${disks[$j]}
|
||||
log_must zpool offline $TESTPOOL ${disks[$j]}
|
||||
check_state $TESTPOOL ${disks[$j]} "offline" || \
|
||||
log_fail "Failed to set ${disks[$j]} offline"
|
||||
((j++))
|
||||
done
|
||||
elif [[ $pooltype = 'raidz' ]]; then
|
||||
# Hold one disk offline, verify the others can't be offlined.
|
||||
log_must $ZPOOL offline $TESTPOOL ${disks[$i]}
|
||||
log_must zpool offline $TESTPOOL ${disks[$i]}
|
||||
check_state $TESTPOOL ${disks[$i]} "offline" || \
|
||||
log_fail "Failed to set ${disks[$i]} offline"
|
||||
while [[ $j -lt ${#disks[*]} ]]; do
|
||||
@@ -109,22 +109,22 @@ while [[ $i -lt ${#disks[*]} ]]; do
|
||||
((j++))
|
||||
continue
|
||||
fi
|
||||
log_mustnot $ZPOOL offline $TESTPOOL ${disks[$j]}
|
||||
log_mustnot zpool offline $TESTPOOL ${disks[$j]}
|
||||
check_state $TESTPOOL ${disks[$j]} "online" || \
|
||||
log_fail "Failed to set ${disks[$j]} online"
|
||||
check_state $TESTPOOL ${disks[$i]} "offline" || \
|
||||
log_fail "Failed to set ${disks[$i]} offline"
|
||||
((j++))
|
||||
done
|
||||
log_must $ZPOOL online $TESTPOOL ${disks[$i]}
|
||||
log_must zpool online $TESTPOOL ${disks[$i]}
|
||||
check_state $TESTPOOL ${disks[$i]} "online" || \
|
||||
log_fail "Failed to set ${disks[$i]} online"
|
||||
fi
|
||||
((i++))
|
||||
done
|
||||
|
||||
log_must $KILL $killpid
|
||||
$SYNC
|
||||
log_must kill $killpid
|
||||
sync
|
||||
|
||||
typeset dir=$(get_device_dir $DISKS)
|
||||
verify_filesys "$TESTPOOL" "$TESTPOOL/$TESTFS" "$dir"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -48,8 +48,8 @@ function cleanup
|
||||
destroy_pool $TESTPOOL1
|
||||
fi
|
||||
|
||||
$KILL $killpid >/dev/null 2>&1
|
||||
[[ -e $TESTDIR ]] && log_must $RM -rf $TESTDIR/*
|
||||
kill $killpid >/dev/null 2>&1
|
||||
[[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/*
|
||||
}
|
||||
|
||||
log_assert "Offlining disks in a non-redundant pool should fail."
|
||||
@@ -58,24 +58,24 @@ log_onexit cleanup
|
||||
|
||||
specials_list=""
|
||||
for i in 0 1 2; do
|
||||
$MKFILE $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i
|
||||
mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i
|
||||
specials_list="$specials_list $TESTDIR/$TESTFILE1.$i"
|
||||
done
|
||||
disk=($specials_list)
|
||||
|
||||
create_pool $TESTPOOL1 $specials_list
|
||||
log_must $ZFS create $TESTPOOL1/$TESTFS1
|
||||
log_must $ZFS set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
|
||||
log_must zfs create $TESTPOOL1/$TESTFS1
|
||||
log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
|
||||
|
||||
$FILE_TRUNC -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 &
|
||||
file_trunc -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 &
|
||||
typeset killpid="$! "
|
||||
|
||||
for i in 0 1 2; do
|
||||
log_mustnot $ZPOOL offline $TESTPOOL1 ${disk[$i]}
|
||||
log_mustnot zpool offline $TESTPOOL1 ${disk[$i]}
|
||||
check_state $TESTPOOL1 ${disk[$i]} "online"
|
||||
done
|
||||
|
||||
log_must $KILL $killpid
|
||||
$SYNC
|
||||
log_must kill $killpid
|
||||
sync
|
||||
|
||||
log_pass
|
||||
|
||||
Reference in New Issue
Block a user