Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

*** 24,34 **** # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013, 2015 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/cli_user/misc/misc.cfg . $STF_SUITE/include/libtest.shlib --- 24,34 ---- # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013, 2016 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/cli_user/misc/misc.cfg . $STF_SUITE/include/libtest.shlib
*** 50,161 **** # The rest of this setup script creates a ZFS filesystem configuration # that is used to test the rest of the zfs subcommands in this directory. # # 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 # create a file in the filesystem that isn't in the above snapshot ! $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 # create an unmounted filesystem to test unmount ! 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 if [ ! -s /tmp/zfstest_datastream.dat ] then log_fail "ZFS send datafile was not created!" fi ! 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 set -A props $PROP_NAMES set -A prop_vals $PROP_VALS typeset -i i=0 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 i=$(( $i + 1 )) done # create a filesystem we don't mind renaming ! log_must $ZFS create $TESTPOOL/$TESTFS/renameme if is_global_zone then # create a filesystem we can share ! 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 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 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 # and create a pool we can perform attach remove replace, # etc. operations with ! 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 # create an exported pool to test import ! 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 typeset -i i=0 while [[ $i -lt ${#props[*]} ]] do prop_name=${props[$i]} prop_val=${prop_vals[$i]} ! 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/blockfiles/zfs-pool-v1.dat.bz2 \ /$TESTDIR ! log_must $BUNZIP2 /$TESTDIR/zfs-pool-v1.dat.bz2 ! log_must $ZPOOL import -d /$TESTDIR v1-pool fi log_pass --- 50,161 ---- # The rest of this setup script creates a ZFS filesystem configuration # that is used to test the rest of the zfs subcommands in this directory. # # 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 # create a file in the filesystem that isn't in the above snapshot ! 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 # create an unmounted filesystem to test unmount ! 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 if [ ! -s /tmp/zfstest_datastream.dat ] then log_fail "ZFS send datafile was not created!" fi ! 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 set -A props $PROP_NAMES set -A prop_vals $PROP_VALS typeset -i i=0 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 i=$(( $i + 1 )) done # create a filesystem we don't mind renaming ! log_must zfs create $TESTPOOL/$TESTFS/renameme if is_global_zone then # create a filesystem we can share ! 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 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 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 # and create a pool we can perform attach remove replace, # etc. operations with ! 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 # create an exported pool to test import ! 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 typeset -i i=0 while [[ $i -lt ${#props[*]} ]] do prop_name=${props[$i]} prop_val=${prop_vals[$i]} ! 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/blockfiles/zfs-pool-v1.dat.bz2 \ /$TESTDIR ! log_must bunzip2 /$TESTDIR/zfs-pool-v1.dat.bz2 ! log_must zpool import -d /$TESTDIR v1-pool fi log_pass