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:
John Wren Kennedy
2017-04-05 20:18:22 -04:00
committed by Brian Behlendorf
parent 7a4500a101
commit c1d9abf905
797 changed files with 8038 additions and 7458 deletions
@@ -33,7 +33,7 @@ log_assert "arc_summary.py generates output and doesn't return an error code"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_must eval "$ARC_SUMMARY ${args[i]} > /dev/null"
log_must eval "arc_summary.py ${args[i]} > /dev/null"
((i = i + 1))
done
@@ -34,7 +34,7 @@ log_assert "arcstat.py generates output and doesn't return an error code"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_must eval "$ARCSTAT ${args[i]} > /dev/null"
log_must eval "arcstat.py ${args[i]} > /dev/null"
((i = i + 1))
done
log_pass "arcstat.py generates output and doesn't return an error code"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -34,17 +34,17 @@
if poolexists $TESTPOOL.virt
then
log_must $ZPOOL destroy $TESTPOOL.virt
log_must zpool destroy $TESTPOOL.virt
fi
if poolexists v1-pool
then
log_must $ZPOOL destroy v1-pool
log_must zpool destroy v1-pool
fi
if [[ -f /tmp/zfstest_datastream.dat ]]
then
log_must $RM -f /tmp/zfstest_datastream.dat
log_must rm -f /tmp/zfstest_datastream.dat
fi
default_cleanup
@@ -33,7 +33,7 @@ log_assert "dbufstat.py generates output and doesn't return an error code"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_must eval "$DBUFSTAT ${args[i]} > /dev/null"
log_must eval "dbufstat.py ${args[i]} > /dev/null"
((i = i + 1))
done
@@ -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
@@ -52,33 +52,33 @@ default_setup_noexit "$DISK" "" "volume"
#
# create a snapshot and a clone to test clone promote
log_must $ZFS snapshot $TESTPOOL/$TESTFS@snap
log_must $ZFS clone $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS/clone
log_must zfs snapshot $TESTPOOL/$TESTFS@snap
log_must zfs clone $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS/clone
# create a file in the filesystem that isn't in the above snapshot
$TOUCH /$TESTDIR/file.txt
touch /$TESTDIR/file.txt
# create a non-default property and a child we can use to test inherit
log_must $ZFS create $TESTPOOL/$TESTFS/$TESTFS2
log_must $ZFS set snapdir=hidden $TESTPOOL/$TESTFS
log_must zfs create $TESTPOOL/$TESTFS/$TESTFS2
log_must zfs set snapdir=hidden $TESTPOOL/$TESTFS
# create an unmounted filesystem to test unmount
log_must $ZFS create $TESTPOOL/$TESTFS/$TESTFS2.unmounted
log_must $ZFS unmount $TESTPOOL/$TESTFS/$TESTFS2.unmounted
log_must zfs create $TESTPOOL/$TESTFS/$TESTFS2.unmounted
log_must zfs unmount $TESTPOOL/$TESTFS/$TESTFS2.unmounted
# send our snapshot to a known file in /tmp
$ZFS send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.dat
zfs send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.dat
if [ ! -s /tmp/zfstest_datastream.dat ]
then
log_fail "ZFS send datafile was not created!"
fi
log_must $CHMOD 644 /tmp/zfstest_datastream.dat
log_must chmod 644 /tmp/zfstest_datastream.dat
# create a filesystem that has particular properties to test set/get
log_must $ZFS create -o version=1 $TESTPOOL/$TESTFS/prop
log_must zfs create -o version=1 $TESTPOOL/$TESTFS/prop
set -A props $PROP_NAMES
set -A prop_vals $PROP_VALS
typeset -i i=0
@@ -87,58 +87,58 @@ while [[ $i -lt ${#props[*]} ]]
do
prop_name=${props[$i]}
prop_val=${prop_vals[$i]}
log_must $ZFS set $prop_name=$prop_val $TESTPOOL/$TESTFS/prop
log_must zfs set $prop_name=$prop_val $TESTPOOL/$TESTFS/prop
i=$(( $i + 1 ))
done
# create a filesystem we don't mind renaming
log_must $ZFS create $TESTPOOL/$TESTFS/renameme
log_must zfs create $TESTPOOL/$TESTFS/renameme
if is_global_zone && !is_linux
then
# create a filesystem we can share
log_must $ZFS create $TESTPOOL/$TESTFS/unshared
log_must $ZFS set sharenfs=off $TESTPOOL/$TESTFS/unshared
log_must zfs create $TESTPOOL/$TESTFS/unshared
log_must zfs set sharenfs=off $TESTPOOL/$TESTFS/unshared
# create a filesystem that we can unshare
log_must $ZFS create $TESTPOOL/$TESTFS/shared
log_must $ZFS set sharenfs=on $TESTPOOL/$TESTFS/shared
log_must zfs create $TESTPOOL/$TESTFS/shared
log_must zfs set sharenfs=on $TESTPOOL/$TESTFS/shared
fi
log_must $ZFS create -o version=1 $TESTPOOL/$TESTFS/version1
log_must $ZFS create -o version=1 $TESTPOOL/$TESTFS/allowed
log_must $ZFS allow everyone create $TESTPOOL/$TESTFS/allowed
log_must zfs create -o version=1 $TESTPOOL/$TESTFS/version1
log_must zfs create -o version=1 $TESTPOOL/$TESTFS/allowed
log_must zfs allow everyone create $TESTPOOL/$TESTFS/allowed
if is_global_zone
then
# Now create several virtual disks to test zpool with
$MKFILE $MINVDEVSIZE /$TESTDIR/disk1.dat
$MKFILE $MINVDEVSIZE /$TESTDIR/disk2.dat
$MKFILE $MINVDEVSIZE /$TESTDIR/disk3.dat
$MKFILE $MINVDEVSIZE /$TESTDIR/disk-additional.dat
$MKFILE $MINVDEVSIZE /$TESTDIR/disk-export.dat
$MKFILE $MINVDEVSIZE /$TESTDIR/disk-offline.dat
$MKFILE $MINVDEVSIZE /$TESTDIR/disk-spare1.dat
$MKFILE $MINVDEVSIZE /$TESTDIR/disk-spare2.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk1.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk2.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk3.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk-additional.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk-export.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk-offline.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk-spare1.dat
mkfile $MINVDEVSIZE /$TESTDIR/disk-spare2.dat
# and create a pool we can perform attach remove replace,
# etc. operations with
log_must $ZPOOL create $TESTPOOL.virt mirror /$TESTDIR/disk1.dat \
log_must zpool create $TESTPOOL.virt mirror /$TESTDIR/disk1.dat \
/$TESTDIR/disk2.dat /$TESTDIR/disk3.dat /$TESTDIR/disk-offline.dat \
spare /$TESTDIR/disk-spare1.dat
# Offline one of the disks to test online
log_must $ZPOOL offline $TESTPOOL.virt /$TESTDIR/disk-offline.dat
log_must zpool offline $TESTPOOL.virt /$TESTDIR/disk-offline.dat
# create an exported pool to test import
log_must $ZPOOL create $TESTPOOL.exported /$TESTDIR/disk-export.dat
log_must $ZPOOL export $TESTPOOL.exported
log_must zpool create $TESTPOOL.exported /$TESTDIR/disk-export.dat
log_must zpool export $TESTPOOL.exported
set -A props $POOL_PROPS
set -A prop_vals $POOL_VALS
@@ -148,14 +148,14 @@ then
do
prop_name=${props[$i]}
prop_val=${prop_vals[$i]}
log_must $ZPOOL set $prop_name=$prop_val $TESTPOOL
log_must zpool set $prop_name=$prop_val $TESTPOOL
i=$(( $i + 1 ))
done
# copy a v1 pool from cli_root
$CP $STF_SUITE/tests/functional/cli_root/zpool_upgrade/zfs-pool-v1.dat.bz2 \
cp $STF_SUITE/tests/functional/cli_root/zpool_upgrade/zfs-pool-v1.dat.bz2 \
/$TESTDIR
log_must $BUNZIP2 /$TESTDIR/zfs-pool-v1.dat.bz2
log_must $ZPOOL import -d /$TESTDIR v1-pool
log_must bunzip2 /$TESTDIR/zfs-pool-v1.dat.bz2
log_must zpool import -d /$TESTDIR v1-pool
fi
log_pass
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,12 +45,12 @@
function check_zdb
{
$@ > /tmp/zdb.$$
$GREP "Dataset mos" /tmp/zdb.$$
grep "Dataset mos" /tmp/zdb.$$
if [ $? -eq 0 ]
then
log_fail "$@ exited 0 when run as a non root user!"
fi
$RM /tmp/zdb.$$
rm /tmp/zdb.$$
}
@@ -58,7 +58,7 @@ function cleanup
{
if [ -e /tmp/zdb_001_neg.$$.txt ]
then
$RM /tmp/zdb_001_neg.$$.txt
rm /tmp/zdb_001_neg.$$.txt
fi
}
@@ -68,15 +68,15 @@ verify_runnable "global"
log_assert "zdb can't run as a user on datasets, but can run without arguments"
log_onexit cleanup
log_must eval "$ZDB > /tmp/zdb_001_neg.$$.txt"
log_must eval "zdb > /tmp/zdb_001_neg.$$.txt"
# verify the output looks okay
log_must $GREP pool_guid /tmp/zdb_001_neg.$$.txt
log_must $RM /tmp/zdb_001_neg.$$.txt
log_must grep pool_guid /tmp/zdb_001_neg.$$.txt
log_must rm /tmp/zdb_001_neg.$$.txt
# we shouldn't able to run it on any dataset
check_zdb $ZDB $TESTPOOL
check_zdb $ZDB $TESTPOOL/$TESTFS
check_zdb $ZDB $TESTPOOL/$TESTFS@snap
check_zdb $ZDB $TESTPOOL/$TESTFS.clone
check_zdb zdb $TESTPOOL
check_zdb zdb $TESTPOOL/$TESTFS
check_zdb zdb $TESTPOOL/$TESTFS@snap
check_zdb zdb $TESTPOOL/$TESTFS.clone
log_pass "zdb can't run as a user on datasets, but can run without arguments"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -46,14 +46,14 @@ function cleanup
{
if [ -e /tmp/zfs_001_neg.$$.txt ]
then
$RM /tmp/zfs_001_neg.$$.txt
rm /tmp/zfs_001_neg.$$.txt
fi
}
log_onexit cleanup
log_assert "zfs shows a usage message when run as a user"
eval "$ZFS > /tmp/zfs_001_neg.$$.txt 2>&1"
log_must $GREP "usage: zfs command args" /tmp/zfs_001_neg.$$.txt
eval "zfs > /tmp/zfs_001_neg.$$.txt 2>&1"
log_must grep "usage: zfs command args" /tmp/zfs_001_neg.$$.txt
log_pass "zfs shows a usage message when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,20 +45,20 @@
#
# check to see if we have zfs allow
$ZFS 2>&1 | $GREP "allow" > /dev/null
zfs 2>&1 | grep "allow" > /dev/null
if (($? != 0)) then
log_unsupported "ZFS allow not supported on this machine."
fi
log_assert "zfs allow returns an error when run as a user"
log_must $ZFS allow $TESTPOOL/$TESTFS
log_mustnot $ZFS allow $($LOGNAME) create $TESTPOOL/$TESTFS
log_must zfs allow $TESTPOOL/$TESTFS
log_mustnot zfs allow $(logname) create $TESTPOOL/$TESTFS
# now verify that the above command actually did nothing by
# checking for any allow output. ( if no allows are granted,
# nothing should be output )
OUTPUT=$($ZFS allow $TESTPOOL/$TESTFS | $GREP "Local+Descendent" )
OUTPUT=$(zfs allow $TESTPOOL/$TESTFS | grep "Local+Descendent" )
if [ -n "$OUTPUT" ]
then
log_fail "zfs allow permissions were granted on $TESTPOOL/$TESTFS"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -44,7 +44,7 @@
#
log_assert "zfs clone returns an error when run as a user"
log_mustnot $ZFS clone $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS.myclone
log_mustnot zfs clone $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS.myclone
# check to see that the above command really did nothing
if datasetexists $TESTPOOL/$TESTFS.myclone
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -54,7 +54,7 @@ log_assert "Verify zfs create without parameters fails."
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZFS ${args[i]}
log_mustnot zfs ${args[i]}
((i = i + 1))
done
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -60,7 +60,7 @@ log_assert "zfs destroy [-f|-r] [fs|snap]"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZFS ${args[i]}
log_mustnot zfs ${args[i]}
((i = i + 1))
done
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -54,7 +54,7 @@ while [[ $i -lt ${#args[*]} ]]
do
PROP=${props[$i]}
EXPECTED=${prop_vals[$i]}
ACTUAL=$( $ZFS get $PROP -o value -H snapdir $TESTPOOl/$TESTFS/prop )
ACTUAL=$( zfs get $PROP -o value -H snapdir $TESTPOOl/$TESTFS/prop )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP value was $ACTUAL, expected $EXPECTED"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -44,10 +44,10 @@
#
log_assert "zfs inherit returns an error when run as a user"
log_mustnot $ZFS inherit snapdir $TESTPOOL/$TESTFS/$TESTFS2
log_mustnot zfs inherit snapdir $TESTPOOL/$TESTFS/$TESTFS2
# check to see that the above command really did nothing
PROP=$($ZFS get snapdir $TESTPOOL/$TESTFS)
PROP=$(zfs get snapdir $TESTPOOL/$TESTFS)
if [ "$PROP" = "visible" ]
then
log_fail "snapdir property inherited from the $TESTPOOL/$TESTFS!"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,10 +45,10 @@
log_assert "zfs mount returns an error when run as a user"
log_mustnot $ZFS mount $TESTPOOL/$TESTFS/$TESTFS2.unmounted
log_mustnot zfs mount $TESTPOOL/$TESTFS/$TESTFS2.unmounted
# now verify that the above command didn't do anything
MOUNTED=$($MOUNT | $GREP $TESTPOOL/$TESTFS/$TESTFS2.unmounted)
MOUNTED=$(mount | grep $TESTPOOL/$TESTFS/$TESTFS2.unmounted)
if [ -n "$MOUNTED" ]
then
log_fail "Filesystem $TESTPOOL/$TESTFS/$TESTFS2.unmounted was mounted!"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,7 +45,7 @@
log_assert "zfs promote returns an error when run as a user"
log_mustnot $ZFS promote $TESTPOOL/$TESTFS/clone
log_mustnot zfs promote $TESTPOOL/$TESTFS/clone
# Now verify that the above command didn't do anything
if datasetexists $TESTPOOL/$TESTFS/clone@snap
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,7 +45,7 @@
log_assert "zfs receive returns an error when run as a user"
log_mustnot eval "$ZFS receive -d $TESTPOOL/$TESTFS/$TESTFS2 \
log_mustnot eval "zfs receive -d $TESTPOOL/$TESTFS/$TESTFS2 \
< /tmp/zfstest_datastream.dat"
# verify that command actually did nothing
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,7 +45,7 @@
log_assert "zfs rename returns an error when run as a user"
log_mustnot $ZFS rename $TESTPOOL/$TESTFS/renameme $TESTPOOL/$TESTFS/renameme1
log_mustnot zfs rename $TESTPOOL/$TESTFS/renameme $TESTPOOL/$TESTFS/renameme1
# now verify the above command didn't actually do anything
if datasetexists $TESTPOOL/$TESTFS/renameme1
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -46,7 +46,7 @@
log_assert "zfs rollback returns an error when run as a user"
log_mustnot $ZFS rollback $TESTPOOL/$TESTFS@snap
log_mustnot zfs rollback $TESTPOOL/$TESTFS@snap
# now verify the above command didn't actually do anything
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -47,14 +47,14 @@ function cleanup
{
if [ -e /tmp/zfstest_datastream.$$ ]
then
log_must $RM /tmp/zfstest_datastream.$$
log_must rm /tmp/zfstest_datastream.$$
fi
}
log_assert "zfs send returns an error when run as a user"
log_onexit cleanup
log_mustnot eval "$ZFS send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.$$"
log_mustnot eval "zfs send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.$$"
# Now check that the above command actually did nothing
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -56,10 +56,10 @@ do
PROP=${props[$i]}
EXPECTED=${prop_vals[$i]}
NEW=${prop_new[$i]}
log_mustnot $ZFS set $PROP=$NEW $TESTPOOL/$TESTFS/prop
log_mustnot zfs set $PROP=$NEW $TESTPOOL/$TESTFS/prop
# Now verify that the above command did nothing
ACTUAL=$($ZFS get $PROP -o value -H snapdir $TESTPOOl/$TESTFS/prop )
ACTUAL=$(zfs get $PROP -o value -H snapdir $TESTPOOl/$TESTFS/prop )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP was set to $ACTUAL, expected $EXPECTED"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -52,7 +52,7 @@ then
log_fail "$TESTPOOL/$TESTFS/unshared was incorrectly shared initially!"
fi
log_mustnot $ZFS share $TESTPOOL/$TESTFS/unshared
log_mustnot zfs share $TESTPOOL/$TESTFS/unshared
# Now verify that the above command didn't actually do anything
if is_shared $TESTDIR/unshared
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,7 +45,7 @@
log_assert "zfs snapshot returns an error when run as a user"
log_mustnot $ZFS snapshot $TESTPOOL/$TESTFS@usersnap1
log_mustnot zfs snapshot $TESTPOOL/$TESTFS@usersnap1
# Now verify that the above command didn't actually do anything
if datasetexists $TESTPOOL/$TESTFS@usersnap1
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -44,17 +44,17 @@
#
# check to see if we have zfs unallow
$ZFS 2>&1 | $GREP "unallow" > /dev/null
zfs 2>&1 | grep "unallow" > /dev/null
if (($? != 0)) then
log_unsupported "ZFS unallow not supported on this machine."
fi
log_assert "zfs unallow returns an error when run as a user"
log_mustnot $ZFS unallow everyone $TESTPOOL/$TESTFS/allowed
log_mustnot zfs unallow everyone $TESTPOOL/$TESTFS/allowed
# now check with zfs allow to see if the permissions are still there
OUTPUT=$($ZFS allow $TESTPOOL/$TESTFS/allowed | $GREP "Local+Descendent" )
OUTPUT=$(zfs allow $TESTPOOL/$TESTFS/allowed | grep "Local+Descendent" )
if [ -z "$OUTPUT" ]
then
log_fail "Error - create permissions were unallowed on \
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -58,7 +58,7 @@ log_assert "zfs u[n]mount [-f] [mountpoint|fs|snap]"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZFS ${args[i]}
log_mustnot zfs ${args[i]}
((i = i + 1))
done
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -53,7 +53,7 @@ then
log_fail "$TESTPOOL/$TESTFS/shared was not shared initially at all!"
fi
log_mustnot $ZFS unshare $TESTPOOL/$TESTFS/shared
log_mustnot zfs unshare $TESTPOOL/$TESTFS/shared
# now verify that the above command didn't do anything
if not_shared $TESTDIR/shared
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -44,7 +44,7 @@
#
# check to see if we have upgrade capability
$ZFS upgrade > /dev/null 2>&1
zfs upgrade > /dev/null 2>&1
HAS_UPGRADE=$?
if [ $HAS_UPGRADE -ne 0 ]
then
@@ -54,11 +54,11 @@ fi
log_assert "zfs upgrade returns an error when run as a user"
log_mustnot $ZFS upgrade $TESTPOOL/$TESTFS/version1
log_mustnot zfs upgrade $TESTPOOL/$TESTFS/version1
# now check to see the above command didn't do anything
VERSION=$($ZFS upgrade $TESTPOOL/$TESTFS/version1 2>&1 \
| $GREP "already at this version")
VERSION=$(zfs upgrade $TESTPOOL/$TESTFS/version1 2>&1 \
| grep "already at this version")
if [ -n "$VERSION" ]
then
log_fail "A filesystem was upgraded!"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -47,14 +47,14 @@ function cleanup
{
if [ -e /tmp/zpool_001_neg.$$.txt ]
then
$RM /tmp/zpool_001_neg.$$.txt
rm /tmp/zpool_001_neg.$$.txt
fi
}
log_onexit cleanup
log_assert "zpool shows a usage message when run as a user"
eval "$ZPOOL > /tmp/zpool_001_neg.$$.txt 2>&1"
log_must $GREP "usage: zpool command args" /tmp/zpool_001_neg.$$.txt
eval "zpool > /tmp/zpool_001_neg.$$.txt 2>&1"
log_must grep "usage: zpool command args" /tmp/zpool_001_neg.$$.txt
log_pass "zpool shows a usage message when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -70,7 +70,7 @@ log_assert "zpool add [-fn] pool_name vdev"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZPOOL ${args[i]}
log_mustnot zpool ${args[i]}
((i = i + 1))
done
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,7 +45,7 @@
function check_for_attach
{
RESULT=$($ZPOOL status -v $TESTPOOL.virt | $GREP disk-additional.dat)
RESULT=$(zpool status -v $TESTPOOL.virt | grep disk-additional.dat)
if [ -n "$RESULT" ]
then
log_fail "A disk was attached to the pool!"
@@ -56,11 +56,11 @@ verify_runnable "global"
log_assert "zpool attach returns an error when run as a user"
log_mustnot $ZPOOL attach $TESTPOOL.virt /$TESTDIR/disk1.dat \
log_mustnot zpool attach $TESTPOOL.virt /$TESTDIR/disk1.dat \
/$TESTDIR/disk-additional.dat
check_for_attach
log_mustnot $ZPOOL attach -f $TESTPOOL.virt /$TESTDIR/disk1.dat \
log_mustnot zpool attach -f $TESTPOOL.virt /$TESTDIR/disk1.dat \
/$TESTDIR/disk-additional.dat
check_for_attach
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -47,6 +47,6 @@ verify_runnable "global"
log_assert "zpool clear returns an error when run as a user"
log_mustnot $ZPOOL clear $TESTPOOL
log_mustnot zpool clear $TESTPOOL
log_pass "zpool clear returns an error when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -70,7 +70,7 @@ log_assert "zpool create [-fn] pool_name vdev"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZPOOL ${args[i]}
log_mustnot zpool ${args[i]}
((i = i + 1))
done
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -52,7 +52,7 @@ log_assert "zpool destroy [-f] [pool_name ...]"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZPOOL ${args[i]}
log_mustnot zpool ${args[i]}
((i = i + 1))
done
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -47,9 +47,9 @@ verify_runnable "global"
log_assert "zpool detach returns an error when run as a user"
log_mustnot $ZPOOL detach $TESTPOOL.virt /$TESTDIR/disk1.dat
log_mustnot zpool detach $TESTPOOL.virt /$TESTDIR/disk1.dat
RESULT=$($ZPOOL status -v $TESTPOOL.virt | $GREP disk1.dat)
RESULT=$(zpool status -v $TESTPOOL.virt | grep disk1.dat)
if [ -z "$RESULT" ]
then
log_fail "A disk was detached from the pool!"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -44,7 +44,7 @@
function check_for_export
{
RESULT=$($ZPOOL list | $GREP $TESTPOOL.virt )
RESULT=$(zpool list | grep $TESTPOOL.virt )
if [ -z "$RESULT" ]
then
log_fail "A pool was exported!"
@@ -56,10 +56,10 @@ verify_runnable "global"
log_assert "zpool export returns an error when run as a user"
log_mustnot $ZPOOL export $TESTPOOL.virt
log_mustnot zpool export $TESTPOOL.virt
check_for_export
log_mustnot $ZPOOL export -f $TESTPOOL.virt
log_mustnot zpool export -f $TESTPOOL.virt
check_for_export
log_pass "zpool export returns an error when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -54,7 +54,7 @@ while [[ $i -lt ${#args[*]} ]]
do
PROP=${props[$i]}
EXPECTED=${prop_vals[$i]}
ACTUAL=$( $ZPOOL get $PROP $TESTPOOL | $GREP $PROP | $AWK '{print $1}' )
ACTUAL=$( zpool get $PROP $TESTPOOL | grep $PROP | awk '{print $1}' )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP value was $ACTUAL, expected $EXPECTED"
@@ -62,6 +62,6 @@ do
i=$(( $i + 1 ))
done
log_must $ZPOOL get all $TESTPOOL
log_must zpool get all $TESTPOOL
log_pass "zpool get works when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -46,10 +46,10 @@ verify_runnable "global"
log_assert "zpool history returns an error when run as a user"
log_mustnot $ZPOOL history
log_mustnot $ZPOOL history $TESTPOOL
log_mustnot $ZPOOL history -i $TESTPOOL
log_mustnot $ZPOOL history -l $TESTPOOL
log_mustnot $ZPOOL history -il $TESTPOOL
log_mustnot zpool history
log_mustnot zpool history $TESTPOOL
log_mustnot zpool history -i $TESTPOOL
log_mustnot zpool history -l $TESTPOOL
log_mustnot zpool history -il $TESTPOOL
log_assert "zpool history returns an error when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,7 +45,7 @@
function check_for_import
{
RESULT=$($ZPOOL list -H -o name | $GREP $TESTPOOL.exported)
RESULT=$(zpool list -H -o name | grep $TESTPOOL.exported)
if [ -n "$RESULT" ]
then
log_fail "Pool $TESTPOOL.export was successfully imported!"
@@ -55,12 +55,12 @@ function check_for_import
verify_runnable "global"
log_assert "zpool import returns an error when run as a user"
log_mustnot $ZPOOL import
log_mustnot zpool import
log_mustnot $ZPOOL import -a
log_mustnot zpool import -a
check_for_import
log_mustnot $ZPOOL import -d /$TESTDIR $TESTPOOL.exported
log_mustnot zpool import -d /$TESTDIR $TESTPOOL.exported
check_for_import
log_pass "zpool import returns an error when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -57,7 +57,7 @@ log_assert "Executing 'zpool import' by regular user fails"
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZPOOL import ${args[i]}
log_mustnot zpool import ${args[i]}
((i = i + 1))
done
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,8 +45,8 @@
function check_for_offline
{
RESULT=$($ZPOOL status -v $TESTPOOL.virt | $GREP disk-1.dat \
| $GREP OFFLINE )
RESULT=$(zpool status -v $TESTPOOL.virt | grep disk-1.dat \
| grep OFFLINE )
if [ -n "$RESULT" ]
then
log_fail "A disk was taken offline!"
@@ -57,10 +57,10 @@ verify_runnable "global"
log_assert "zpool offline returns an error when run as a user"
log_mustnot $ZPOOL offline $TESTPOOL.virt /$TESTDIR/disk-1.dat
log_mustnot zpool offline $TESTPOOL.virt /$TESTDIR/disk-1.dat
check_for_offline
log_mustnot $ZPOOL offline -t $TESTPOOL.virt /$TESTDIR/disk-1.dat
log_mustnot zpool offline -t $TESTPOOL.virt /$TESTDIR/disk-1.dat
check_for_offline
log_pass "zpool offline returns an error when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,8 +45,8 @@
function check_for_online
{
RESULT=$($ZPOOL status -v $TESTPOOL.virt | $GREP disk-offline.dat \
| $GREP ONLINE )
RESULT=$(zpool status -v $TESTPOOL.virt | grep disk-offline.dat \
| grep ONLINE )
if [ -n "$RESULT" ]
then
log_fail "A disk was brough online!"
@@ -57,10 +57,10 @@ verify_runnable "global"
log_assert "zpool online returns an error when run as a user"
log_mustnot $ZPOOL online $TESTPOOL.virt /$TESTDIR/disk-offline.dat
log_mustnot zpool online $TESTPOOL.virt /$TESTDIR/disk-offline.dat
check_for_online
log_mustnot $ZPOOL online -t $TESTPOOL.virt /$TESTDIR/disk-offline.dat
log_mustnot zpool online -t $TESTPOOL.virt /$TESTDIR/disk-offline.dat
check_for_online
log_pass "zpool online returns an error when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -47,9 +47,9 @@ verify_runnable "global"
log_assert "zpool remove returns an error when run as a user"
log_mustnot $ZPOOL remove $TESTPOOL.virt /$TESTDIR/disk-spare1.dat
log_mustnot zpool remove $TESTPOOL.virt /$TESTDIR/disk-spare1.dat
RESULT=$($ZPOOL status -v $TESTPOOL.virt | $GREP disk-spare1.dat)
RESULT=$(zpool status -v $TESTPOOL.virt | grep disk-spare1.dat)
if [ -z "$RESULT" ]
then
log_fail "A disk was removed from the pool!"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,8 +45,8 @@
function check_for_replace
{
$SLEEP 10
RESULT=$($ZPOOL status -v $TESTPOOL.virt | $GREP disk-additional.dat)
sleep 10
RESULT=$(zpool status -v $TESTPOOL.virt | grep disk-additional.dat)
if [ -n "$RESULT" ]
then
log_fail "A disk was replaced in the pool!"
@@ -57,11 +57,11 @@ verify_runnable "global"
log_assert "zpool replace returns an error when run as a user"
log_mustnot $ZPOOL replace $TESTPOOL.virt /$TESTDIR/disk-1.dat \
log_mustnot zpool replace $TESTPOOL.virt /$TESTDIR/disk-1.dat \
/$TESTDIR/disk-additional.dat
check_for_replace
log_mustnot $ZPOOL replace -f $TESTPOOL.virt /$TESTDIR/disk-1.dat \
log_mustnot zpool replace -f $TESTPOOL.virt /$TESTDIR/disk-1.dat \
/$TESTDIR/disk-additional.dat
check_for_replace
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -47,7 +47,7 @@ verify_runnable "global"
log_assert "zpool scrub returns an error when run as a user"
log_mustnot $ZPOOL scrub $TESTPOOL
log_mustnot $ZPOOL scrub -s $TESTPOOL
log_mustnot zpool scrub $TESTPOOL
log_mustnot zpool scrub -s $TESTPOOL
log_pass "zpool scrub returns an error when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -59,7 +59,7 @@ do
log_mustnot $POOL set $PROP=$NEW $TESTPOOL
# Now verify that the above command did nothing
ACTUAL=$( $ZPOOL get $PROP $TESTPOOL | $GREP $PROP | $AWK '{print $1}' )
ACTUAL=$( zpool get $PROP $TESTPOOL | grep $PROP | awk '{print $1}' )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP was set to $ACTUAL, expected $EXPECTED"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -45,28 +45,28 @@
function check_pool_status
{
RESULT=$($GREP "pool:" /tmp/pool-status.$$)
RESULT=$(grep "pool:" /tmp/pool-status.$$)
if [ -z "$RESULT" ]
then
log_fail "No pool: string found in zpool status output!"
fi
$RM /tmp/pool-status.$$
rm /tmp/pool-status.$$
}
verify_runnable "global"
log_assert "zpool status works when run as a user"
log_must eval "$ZPOOL status > /tmp/pool-status.$$"
log_must eval "zpool status > /tmp/pool-status.$$"
check_pool_status
log_must eval "$ZPOOL status -v > /tmp/pool-status.$$"
log_must eval "zpool status -v > /tmp/pool-status.$$"
check_pool_status
log_must eval "$ZPOOL status $TESTPOOL> /tmp/pool-status.$$"
log_must eval "zpool status $TESTPOOL> /tmp/pool-status.$$"
check_pool_status
log_must eval "$ZPOOL status -v $TESTPOOL > /tmp/pool-status.$$"
log_must eval "zpool status -v $TESTPOOL > /tmp/pool-status.$$"
check_pool_status
# Make sure -c option works, and that VDEV_PATH and VDEV_UPATH get set.
@@ -74,9 +74,9 @@ check_pool_status
# grep for '^\s+/' to just get the vdevs (not pools). All vdevs will start with
# a '/' when we specify the path (-P) flag. We check for "{}" to see if one
# of the VDEV variables isn't set.
C1=$($ZPOOL status -P | $GREP -E '^\s+/' | $WC -l)
C2=$($ZPOOL status -P -c 'echo vdev_test{$VDEV_PATH}{$VDEV_UPATH}' | \
$GREP -E '^\s+/' | $GREP -v '{}' | $WC -l)
C1=$(zpool status -P | grep -E '^\s+/' | wc -l)
C2=$(zpool status -P -c 'echo vdev_test{$VDEV_PATH}{$VDEV_UPATH}' | \
grep -E '^\s+/' | grep -v '{}' | wc -l)
if [ "$C1" != "$C2" ] ; then
log_fail "zpool status -c option failed. Expected $C1 vdevs, got $C2"
@@ -85,7 +85,7 @@ else
fi
# $TESTPOOL.virt has an offline device, so -x will show it
log_must eval "$ZPOOL status -x $TESTPOOL.virt > /tmp/pool-status.$$"
log_must eval "zpool status -x $TESTPOOL.virt > /tmp/pool-status.$$"
check_pool_status
log_pass "zpool status works when run as a user"
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -49,14 +49,14 @@ log_assert "zpool upgrade returns an error when run as a user"
log_onexit cleanup
# zpool upgrade returns 0 when it can't do anything
log_must $ZPOOL upgrade $TESTPOOL.virt
log_must zpool upgrade $TESTPOOL.virt
# Now try to upgrade our version 1 pool
log_mustnot $ZPOOL upgrade v1-pool
log_mustnot zpool upgrade v1-pool
# if the pool has been upgraded, then v1-pool won't be listed in the output
# of zpool upgrade anymore
RESULT=$($ZPOOL upgrade | $GREP v1-pool)
RESULT=$(zpool upgrade | grep v1-pool)
if [ -z "$RESULT" ]
then
log_fail "A pool was upgraded successfully!"