mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
ZTS: path cleanup
Removing hardcoded paths in many scripts. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: bernie1995 <bernie.pikes@gmail.com> Issue #7507 Closes #7843
This commit is contained in:
parent
6c6949acae
commit
0fe7c953b3
@ -114,9 +114,11 @@ def draw_graph(kstats_dict):
|
||||
dnode_limit = f_bytes(arc_stats['arc_dnode_limit'])
|
||||
dnode_size = f_bytes(arc_stats['dnode_size'])
|
||||
|
||||
info_form = 'ARC: {0} ({1}) MFU: {2} MRU: {3} META: {4} ({5}) DNODE {6} ({7})'
|
||||
info_form = ('ARC: {0} ({1}) MFU: {2} MRU: {3} META: {4} ({5}) '
|
||||
'DNODE {6} ({7})')
|
||||
info_line = info_form.format(arc_size, arc_perc, mfu_size, mru_size,
|
||||
meta_size, meta_limit, dnode_size, dnode_limit)
|
||||
meta_size, meta_limit, dnode_size,
|
||||
dnode_limit)
|
||||
info_spc = ' '*int((GRAPH_WIDTH-len(info_line))/2)
|
||||
info_line = GRAPH_INDENT+info_spc+info_line
|
||||
|
||||
|
@ -32,7 +32,7 @@ log_assert "Verify zdb accurately counts feature refcounts."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset errstr="feature refcount mismatch"
|
||||
typeset tmpfile="/var/tmp/zdb-feature-mismatch"
|
||||
typeset tmpfile="$TEST_BASE_DIR/zdb-feature-mismatch"
|
||||
function cleanup
|
||||
{
|
||||
datasetexists $TESTPOOL && destroy_pool $TESTPOOL
|
||||
|
@ -156,7 +156,7 @@ done
|
||||
typeset -i fspropnum=27
|
||||
typeset -i snappropnum=8
|
||||
typeset -i volpropnum=15
|
||||
propfile=/var/tmp/allpropfile.$$
|
||||
propfile=$TEST_BASE_DIR/allpropfile.$$
|
||||
|
||||
typeset -i i=0
|
||||
typeset -i propnum=0
|
||||
|
@ -41,8 +41,8 @@ function cleanup
|
||||
log_must rm -f $streamfile_incr
|
||||
log_must rm -f $streamfile_repl
|
||||
log_must rm -f $streamfile_trun
|
||||
log_must zfs destroy -r -f $orig
|
||||
log_must zfs destroy -r -f $dest
|
||||
destroy_dataset "$orig" "-rf"
|
||||
destroy_dataset "$dest" "-rf"
|
||||
}
|
||||
|
||||
log_assert "ZFS receive property override and exclude options work as expected."
|
||||
|
@ -76,7 +76,7 @@ log_assert "Verifying 'zfs receive [<filesystem|snapshot>] -d <filesystem>' work
|
||||
log_onexit cleanup
|
||||
|
||||
typeset datasets="$TESTPOOL/$TESTFS $TESTPOOL"
|
||||
set -A bkup "/var/tmp/fullbkup" "/var/tmp/incbkup"
|
||||
set -A bkup "$TEST_BASE_DIR/fullbkup" "$TEST_BASE_DIR/incbkup"
|
||||
orig_sum=""
|
||||
rst_sum=""
|
||||
rst_root=$TESTPOOL/rst_ctr
|
||||
|
@ -70,7 +70,7 @@ log_assert "Verifying 'zfs receive <volume>' works."
|
||||
log_onexit cleanup
|
||||
|
||||
set -A orig_snap "$TESTPOOL/$TESTVOL@init_snap" "$TESTPOOL/$TESTVOL@inc_snap"
|
||||
set -A bkup "/var/tmp/fullbkup" "/var/tmp/incbkup"
|
||||
set -A bkup "$TEST_BASE_DIR/fullbkup" "$TEST_BASE_DIR/incbkup"
|
||||
rst_root=$TESTPOOL/rst_ctr
|
||||
rst_vol=$rst_root/$TESTVOL
|
||||
set -A rst_snap "${rst_vol}@init_snap" "${rst_vol}@inc_snap"
|
||||
|
@ -59,7 +59,7 @@ function cleanup
|
||||
log_assert "'zfs recv -F' to force rollback."
|
||||
log_onexit cleanup
|
||||
|
||||
ibackup=/var/tmp/ibackup.$$
|
||||
ibackup=$TEST_BASE_DIR/ibackup.$$
|
||||
fs=$TESTPOOL/$TESTFS; snap1=$fs@snap1; snap2=$fs@snap2
|
||||
|
||||
mntpnt=$(get_prop mountpoint $fs) || log_fail "get_prop mountpoint $fs"
|
||||
|
@ -64,13 +64,13 @@ log_onexit cleanup
|
||||
|
||||
init_snap=$TESTPOOL/$TESTFS@initsnap
|
||||
inc_snap=$TESTPOOL/$TESTFS@incsnap
|
||||
full_bkup=/var/tmp/full_bkup.$$
|
||||
inc_bkup=/var/tmp/inc_bkup.$$
|
||||
full_bkup=$TEST_BASE_DIR/full_bkup.$$
|
||||
inc_bkup=$TEST_BASE_DIR/inc_bkup.$$
|
||||
|
||||
init_topsnap=$TESTPOOL@initsnap
|
||||
inc_topsnap=$TESTPOOL@incsnap
|
||||
full_topbkup=/var/tmp/full_topbkup.$$
|
||||
inc_topbkup=/var/tmp/inc_topbkup.$$
|
||||
full_topbkup=$TEST_BASE_DIR/full_topbkup.$$
|
||||
inc_topbkup=$TEST_BASE_DIR/inc_topbkup.$$
|
||||
|
||||
log_must zfs snapshot $init_topsnap
|
||||
log_must eval "zfs send $init_topsnap > $full_topbkup"
|
||||
|
@ -74,8 +74,8 @@ inc_snap=$TESTPOOL/$TESTFS@incsnap
|
||||
rst_root=$TESTPOOL/rst_ctr
|
||||
rst_init_snap=$rst_root/$TESTFS@init_snap
|
||||
rst_inc_snap=$rst_root/$TESTFS@inc_snap
|
||||
full_bkup=/var/tmp/full_bkup.$$
|
||||
inc_bkup=/var/tmp/inc_bkup.$$
|
||||
full_bkup=$TEST_BASE_DIR/full_bkup.$$
|
||||
inc_bkup=$TEST_BASE_DIR/inc_bkup.$$
|
||||
|
||||
log_must zfs create $rst_root
|
||||
log_must zfs snapshot $init_snap
|
||||
|
@ -75,8 +75,8 @@ ancestor_fs=$TESTPOOL/$TESTFS
|
||||
fs=$TESTPOOL/$TESTFS/$TESTFS1
|
||||
snap1=$fs@snap1
|
||||
snap2=$fs@snap2
|
||||
fbackup1=/var/tmp/fbackup1.$$
|
||||
fbackup2=/var/tmp/fbackup2.$$
|
||||
fbackup1=$TEST_BASE_DIR/fbackup1.$$
|
||||
fbackup2=$TEST_BASE_DIR/fbackup2.$$
|
||||
|
||||
datasetexists $ancestor_fs || \
|
||||
log_must zfs create $ancestor_fs
|
||||
|
@ -60,7 +60,7 @@ log_onexit cleanup
|
||||
fs=$TESTPOOL/$TESTFS
|
||||
snap1=$fs@snap1
|
||||
snap2=$fs@snap2
|
||||
ibackup=/var/tmp/ibackup.$$
|
||||
ibackup=$TEST_BASE_DIR/ibackup.$$
|
||||
|
||||
datasetexists $fs || log_must zfs create $fs
|
||||
|
||||
|
@ -73,8 +73,8 @@ log_onexit cleanup
|
||||
|
||||
typeset datasets="$TESTPOOL/$TESTFS $TESTPOOL"
|
||||
typeset rst_fs=$TESTPOOL/$TESTFS/$TESTFS
|
||||
typeset fbackup=/var/tmp/fbackup.$$
|
||||
typeset tmp_out=/var/tmp/tmpout.$$
|
||||
typeset fbackup=$TEST_BASE_DIR/fbackup.$$
|
||||
typeset tmp_out=$TEST_BASE_DIR/tmpout.$$
|
||||
|
||||
for orig_fs in $datasets ; do
|
||||
typeset rst_snap=$rst_fs@snap
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
typeset streamfile=/var/tmp/streamfile.$$
|
||||
typeset streamfile=$TEST_BASE_DIR/streamfile.$$
|
||||
|
||||
function cleanup
|
||||
{
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
typeset streamfile=/var/tmp/streamfile.$$
|
||||
typeset streamfile=$TEST_BASE_DIR/streamfile.$$
|
||||
|
||||
function cleanup
|
||||
{
|
||||
|
@ -33,8 +33,8 @@
|
||||
src_fs=$TESTPOOL/drecvsrc
|
||||
temppool=recvtank
|
||||
dst_fs=$temppool/drecvdest
|
||||
streamfile=/var/tmp/drecvstream.$$
|
||||
tpoolfile=/temptank.$$
|
||||
streamfile=$TEST_BASE_DIR/drecvstream.$$
|
||||
tpoolfile=$TEST_BASE_DIR/temptank.$$
|
||||
|
||||
function cleanup
|
||||
{
|
||||
|
@ -36,8 +36,8 @@
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
typeset streamfile_full=/var/tmp/streamfile_full.$$
|
||||
typeset streamfile_incr=/var/tmp/streamfile_incr.$$
|
||||
typeset streamfile_full=$TEST_BASE_DIR/streamfile_full.$$
|
||||
typeset streamfile_incr=$TEST_BASE_DIR/streamfile_incr.$$
|
||||
orig=$TESTPOOL/$TESTFS1
|
||||
dest=$TESTPOOL/$TESTFS2
|
||||
typeset user_prop=$(valid_user_property 8)
|
||||
|
@ -74,7 +74,7 @@ log_onexit cleanup
|
||||
|
||||
init_snap=$TESTPOOL/$TESTFS@init_snap
|
||||
inc_snap=$TESTPOOL/$TESTFS@inc_snap
|
||||
full_bkup=/var/tmp/fullbkup.$$
|
||||
full_bkup=$TEST_BASE_DIR/fullbkup.$$
|
||||
inc_bkup=/var/tmp/incbkup.$$
|
||||
init_data=$TESTDIR/$TESTFILE1
|
||||
inc_data=$TESTDIR/$TESTFILE2
|
||||
|
@ -116,7 +116,7 @@ origfile=$TESTDIR/$TESTFILE1
|
||||
rstfile=/$rstfs/$TESTFILE1
|
||||
origsnapfile=$TESTDIR/$snapdir/$TESTFILE1
|
||||
rstsnapfile=/$rstfs/$snapdir/$TESTFILE1
|
||||
stream=/var/tmp/streamfile.$$
|
||||
stream=$TEST_BASE_DIR/streamfile.$$
|
||||
|
||||
set -A props "compression" "checksum" "recordsize"
|
||||
set -A propval "on lzjb" "on fletcher2 fletcher4 sha256" \
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# 'zfs set mountpoint/sharenfs' should fail when the mountpoint is invlid
|
||||
# 'zfs set mountpoint/sharenfs' should fail when the mountpoint is invalid
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create invalid scenarios
|
||||
@ -56,7 +56,7 @@ function cleanup
|
||||
log_assert "'zfs set mountpoint/sharenfs' fails with invalid scenarios"
|
||||
log_onexit cleanup
|
||||
|
||||
badpath=/tmp/foo1.$$
|
||||
badpath=$TEST_BASE_DIR/foo1.$$
|
||||
touch $badpath
|
||||
longpath=$(gen_dataset_name 1030 "abcdefg")
|
||||
|
||||
|
@ -66,8 +66,8 @@ log_assert "Executing 'zfs upgrade' command succeeds."
|
||||
log_onexit cleanup
|
||||
|
||||
rootfs=$TESTPOOL/$TESTFS
|
||||
typeset output=/tmp/zfs-versions.$$
|
||||
typeset oldoutput=/tmp/zfs-versions-old.$$
|
||||
typeset output=$TEST_BASE_DIR/zfs-versions.$$
|
||||
typeset oldoutput=$TEST_BASE_DIR/zfs-versions-old.$$
|
||||
typeset expect_str1="This system is currently running ZFS filesystem version"
|
||||
typeset expect_str2="All filesystems are formatted with the current version"
|
||||
typeset expect_str3="The following filesystems are out of date, and can be upgraded"
|
||||
|
@ -54,7 +54,7 @@ function cleanup
|
||||
log_assert "Executing 'zfs upgrade -v' command succeeds."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset output=/tmp/zfs-versions.$$
|
||||
typeset output=$TEST_BASE_DIR/zfs-versions.$$
|
||||
typeset expect_str1="Initial ZFS filesystem version"
|
||||
typeset expect_str2="Enhanced directory entries"
|
||||
|
||||
|
@ -99,7 +99,6 @@ export ZFS_ABORT=yes
|
||||
for subcmd in "${cmds[@]}" "${badparams[@]}"; do
|
||||
corefile=${corepath}/core.zpool
|
||||
zpool $subcmd >/dev/null 2>&1
|
||||
ls -l $corepath >>/tmp/CORE
|
||||
if [[ ! -e $corefile ]]; then
|
||||
log_fail "zpool $subcmd cannot generate core file with ZFS_ABORT set."
|
||||
fi
|
||||
|
@ -42,10 +42,10 @@ function find_vfstab_dev
|
||||
|
||||
if is_linux; then
|
||||
vfstab="/etc/fstab"
|
||||
tmpfile="/tmp/fstab.tmp"
|
||||
tmpfile="$TEST_BASE_DIR/fstab.tmp"
|
||||
else
|
||||
vfstab="/etc/vfstab"
|
||||
tmpfile="/tmp/vfstab.tmp"
|
||||
tmpfile="$TEST_BASE_DIR/vfstab.tmp"
|
||||
fi
|
||||
|
||||
cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile
|
||||
@ -71,10 +71,10 @@ function find_mnttab_dev
|
||||
|
||||
if is_linux; then
|
||||
typeset mnttab="/etc/mtab"
|
||||
typeset tmpfile="/tmp/mtab.tmp"
|
||||
typeset tmpfile="$TEST_BASE_DIR/mtab.tmp"
|
||||
else
|
||||
typeset mnttab="/etc/mnttab"
|
||||
typeset tmpfile="/tmp/mnttab.tmp"
|
||||
typeset tmpfile="$TEST_BASE_DIR/mnttab.tmp"
|
||||
fi
|
||||
|
||||
cat $mnttab | grep "^${DEV_DSKDIR}" >$tmpfile
|
||||
|
@ -97,7 +97,6 @@ eval set -A mirrorarray $mirrordevs
|
||||
eval set -A raidzarray $raidzdevs
|
||||
|
||||
while (( $i < ${#keywords[*]} )); do
|
||||
echo "I=$i keyword=${keywords[i]}" >>/tmp/LOG
|
||||
|
||||
case ${keywords[i]} in
|
||||
""|spare)
|
||||
|
@ -61,7 +61,7 @@ log_assert "'zpool add -n <pool> <vdev> ...' can display the configuration" \
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
tmpfile="/var/tmp/zpool_add_003.tmp$$"
|
||||
tmpfile="$TEST_BASE_DIR/zpool_add_003.tmp$$"
|
||||
|
||||
create_pool "$TESTPOOL" "${disk}${SLICE_PREFIX}${SLICE0}"
|
||||
log_must poolexists "$TESTPOOL"
|
||||
|
@ -85,7 +85,7 @@ function check_err # <pool> [<vdev>]
|
||||
typeset c_read=0
|
||||
typeset c_write=0
|
||||
typeset c_cksum=0
|
||||
typeset tmpfile=/var/tmp/file.$$
|
||||
typeset tmpfile=$TEST_BASE_DIR/file.$$
|
||||
typeset healthstr="pool '$pool' is healthy"
|
||||
typeset output="`zpool status -x $pool`"
|
||||
|
||||
|
@ -111,4 +111,4 @@ export TESTPOOL4=testpool4.create
|
||||
export TESTPOOL5=testpool5.create
|
||||
export TESTPOOL6=testpool6.create
|
||||
|
||||
export CPATH="/var/tmp/cachefile.create"
|
||||
export CPATH="$TEST_BASE_DIR/cachefile.create"
|
||||
|
@ -127,10 +127,10 @@ function find_vfstab_dev
|
||||
|
||||
if is_linux; then
|
||||
vfstab="/etc/fstab"
|
||||
tmpfile="/tmp/fstab.tmp"
|
||||
tmpfile="$TEST_BASE_DIR/fstab.tmp"
|
||||
else
|
||||
vfstab="/etc/vfstab"
|
||||
tmpfile="/tmp/vfstab.tmp"
|
||||
tmpfile="$TEST_BASE_DIR/vfstab.tmp"
|
||||
fi
|
||||
|
||||
cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile
|
||||
|
@ -49,7 +49,7 @@ function cleanup
|
||||
[[ -e $tmpfile ]] && log_must rm -f $tmpfile
|
||||
}
|
||||
|
||||
tmpfile="/var/tmp/zpool_create_003.tmp$$"
|
||||
tmpfile="$TEST_BASE_DIR/zpool_create_003.tmp$$"
|
||||
|
||||
log_assert "'zpool create -n <pool> <vspec> ...' can display the configuration" \
|
||||
"without actually creating the pool."
|
||||
|
@ -89,7 +89,7 @@ function cleanup
|
||||
#
|
||||
function create_overlap_slice
|
||||
{
|
||||
typeset format_file=/var/tmp/format_overlap.$$
|
||||
typeset format_file=$TEST_BASE_DIR/format_overlap.$$
|
||||
typeset disk=$1
|
||||
|
||||
echo "partition" >$format_file
|
||||
|
@ -57,7 +57,7 @@ function cleanup
|
||||
fi
|
||||
|
||||
#recover swap devices
|
||||
FSTAB=/tmp/fstab_$$
|
||||
FSTAB=$TEST_BASE_DIR/fstab_$$
|
||||
rm -f $FSTAB
|
||||
for sdisk in $swap_disks; do
|
||||
echo "$sdisk - - swap - no -" >> $FSTAB
|
||||
|
@ -53,12 +53,15 @@ function cleanup
|
||||
then
|
||||
log_must rmdir /${TESTPOOL}.root
|
||||
fi
|
||||
[[ -e $values ]] && log_must rm -f $values
|
||||
}
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
log_assert "zpool create -R works as expected"
|
||||
|
||||
typeset values=$TEST_BASE_DIR/values.$$
|
||||
|
||||
if [[ -n $DISK ]]; then
|
||||
disk=$DISK
|
||||
else
|
||||
@ -80,23 +83,23 @@ then
|
||||
fi
|
||||
|
||||
log_must zpool get all $TESTPOOL
|
||||
zpool get all $TESTPOOL > /tmp/values.$$
|
||||
zpool get all $TESTPOOL > $values
|
||||
|
||||
# check for the cachefile property, verifying that it's set to 'none'
|
||||
grep "$TESTPOOL[ ]*cachefile[ ]*none" /tmp/values.$$ > /dev/null 2>&1
|
||||
grep "$TESTPOOL[ ]*cachefile[ ]*none" $values > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
log_fail "zpool property \'cachefile\' was not set to \'none\'."
|
||||
fi
|
||||
|
||||
# check that the root = /mountpoint property is set correctly
|
||||
grep "$TESTPOOL[ ]*altroot[ ]*/${TESTPOOL}.root" /tmp/values.$$ > /dev/null 2>&1
|
||||
grep "$TESTPOOL[ ]*altroot[ ]*/${TESTPOOL}.root" $values > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
log_fail "zpool property root was not found in pool output."
|
||||
fi
|
||||
|
||||
rm /tmp/values.$$
|
||||
rm $values
|
||||
|
||||
# finally, check that the pool has no reference in /etc/zfs/zpool.cache
|
||||
if [[ -f /etc/zfs/zpool.cache ]] ; then
|
||||
@ -108,5 +111,4 @@ if [[ -f /etc/zfs/zpool.cache ]] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
log_pass "zpool create -R works as expected"
|
||||
|
@ -48,19 +48,25 @@
|
||||
# default values are sane, or whether they can be changed with zpool set.
|
||||
#
|
||||
|
||||
function cleanup
|
||||
{
|
||||
rm -f $values
|
||||
}
|
||||
log_onexit cleanup
|
||||
log_assert "Zpool get all works as expected"
|
||||
|
||||
typeset -i i=0;
|
||||
typeset values=$TEST_BASE_DIR/values.$$
|
||||
|
||||
if ! is_global_zone ; then
|
||||
TESTPOOL=${TESTPOOL%%/*}
|
||||
fi
|
||||
|
||||
log_must zpool get all $TESTPOOL
|
||||
zpool get all $TESTPOOL > /tmp/values.$$
|
||||
zpool get all $TESTPOOL > $values
|
||||
|
||||
log_note "Checking zpool get all output for a header."
|
||||
grep ^"NAME " /tmp/values.$$ > /dev/null 2>&1
|
||||
grep ^"NAME " $values > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
log_fail "The header was not printed from zpool get all"
|
||||
@ -70,7 +76,7 @@ fi
|
||||
while [ $i -lt "${#properties[@]}" ]
|
||||
do
|
||||
log_note "Checking for ${properties[$i]} property"
|
||||
grep "$TESTPOOL *${properties[$i]}" /tmp/values.$$ > /dev/null 2>&1
|
||||
grep "$TESTPOOL *${properties[$i]}" $values > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
log_fail "zpool property ${properties[$i]} was not found\
|
||||
@ -82,13 +88,10 @@ done
|
||||
# increment the counter to include the header line
|
||||
i=$(( $i + 1 ))
|
||||
|
||||
COUNT=$(wc /tmp/values.$$ | awk '{print $1}')
|
||||
COUNT=$(wc $values | awk '{print $1}')
|
||||
if [ $i -ne $COUNT ]
|
||||
then
|
||||
log_fail "Found zpool features not in the zpool_get test config $i/$COUNT."
|
||||
fi
|
||||
|
||||
|
||||
|
||||
rm /tmp/values.$$
|
||||
log_pass "Zpool get all works as expected"
|
||||
|
@ -41,24 +41,31 @@
|
||||
# 1. For all properties, verify zpool get retrieves a value
|
||||
#
|
||||
|
||||
function cleanup
|
||||
{
|
||||
rm -f $values
|
||||
}
|
||||
|
||||
log_assert "Zpool get returns values for all known properties"
|
||||
log_onexit cleanup
|
||||
|
||||
if ! is_global_zone ; then
|
||||
TESTPOOL=${TESTPOOL%%/*}
|
||||
fi
|
||||
|
||||
typeset -i i=0;
|
||||
typeset values=$TEST_BASE_DIR/values.$$
|
||||
|
||||
while [ $i -lt "${#properties[@]}" ]
|
||||
do
|
||||
log_note "Checking for ${properties[$i]} property"
|
||||
log_must eval "zpool get ${properties[$i]} $TESTPOOL > /tmp/value.$$"
|
||||
grep "${properties[$i]}" /tmp/value.$$ > /dev/null 2>&1
|
||||
log_must eval "zpool get ${properties[$i]} $TESTPOOL > $values"
|
||||
grep "${properties[$i]}" $values > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
log_fail "${properties[$i]} not seen in output"
|
||||
fi
|
||||
grep "^NAME " /tmp/value.$$ > /dev/null 2>&1
|
||||
grep "^NAME " $values > /dev/null 2>&1
|
||||
# only need to check this once.
|
||||
if [ $i -eq 0 ] && [ $? -ne 0 ]
|
||||
then
|
||||
@ -67,5 +74,4 @@ do
|
||||
i=$(( $i + 1 ))
|
||||
done
|
||||
|
||||
rm /tmp/value.$$
|
||||
log_pass "Zpool get returns values for all known properties"
|
||||
|
@ -45,7 +45,15 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
rm -f $versions
|
||||
}
|
||||
|
||||
log_assert "Executing 'zpool upgrade -v' command succeeds"
|
||||
log_onexit cleanup
|
||||
|
||||
typeset versions=$TEST_BASE_DIR/zpool-versions.$$
|
||||
|
||||
log_must zpool upgrade -v
|
||||
|
||||
@ -54,7 +62,7 @@ log_must zpool upgrade -v
|
||||
|
||||
log_must eval "zpool upgrade -v | head -1 | grep 'feature flags'"
|
||||
|
||||
zpool upgrade -v > /tmp/zpool-versions.$$
|
||||
zpool upgrade -v > $versions
|
||||
|
||||
#
|
||||
# Current output for 'zpool upgrade -v' has different indent space
|
||||
@ -64,8 +72,7 @@ zpool upgrade -v > /tmp/zpool-versions.$$
|
||||
#
|
||||
for version in {1..28}; do
|
||||
log_note "Checking for a description of pool version $version"
|
||||
log_must eval "awk '/^ $version / { print $1 }' /tmp/zpool-versions.$$ | grep $version"
|
||||
log_must eval "awk '/^ $version / { print $1 }' $versions | grep $version"
|
||||
done
|
||||
rm /tmp/zpool-versions.$$
|
||||
|
||||
log_pass "Executing 'zpool upgrade -v' command succeeds"
|
||||
|
@ -42,9 +42,9 @@ then
|
||||
log_must zpool destroy v1-pool
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/zfstest_datastream.dat ]]
|
||||
if [[ -f $TEST_BASE_DIR/zfstest_datastream.dat ]]
|
||||
then
|
||||
log_must rm -f /tmp/zfstest_datastream.dat
|
||||
log_must rm -f $TEST_BASE_DIR/zfstest_datastream.dat
|
||||
fi
|
||||
|
||||
default_cleanup
|
||||
|
@ -69,12 +69,12 @@ 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 ]
|
||||
zfs send $TESTPOOL/$TESTFS@snap > $TEST_BASE_DIR/zfstest_datastream.dat
|
||||
if [ ! -s $TEST_BASE_DIR/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 $TEST_BASE_DIR/zfstest_datastream.dat
|
||||
|
||||
|
||||
# create a filesystem that has particular properties to test set/get
|
||||
|
@ -44,21 +44,21 @@
|
||||
|
||||
function check_zdb
|
||||
{
|
||||
$@ > /tmp/zdb.$$
|
||||
grep "Dataset mos" /tmp/zdb.$$
|
||||
$@ > $TEST_BASE_DIR/zdb.$$
|
||||
grep "Dataset mos" $TEST_BASE_DIR/zdb.$$
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
log_fail "$@ exited 0 when run as a non root user!"
|
||||
fi
|
||||
rm /tmp/zdb.$$
|
||||
rm $TEST_BASE_DIR/zdb.$$
|
||||
}
|
||||
|
||||
|
||||
function cleanup
|
||||
{
|
||||
if [ -e /tmp/zdb_001_neg.$$.txt ]
|
||||
if [ -e $TEST_BASE_DIR/zdb_001_neg.$$.txt ]
|
||||
then
|
||||
rm /tmp/zdb_001_neg.$$.txt
|
||||
rm $TEST_BASE_DIR/zdb_001_neg.$$.txt
|
||||
fi
|
||||
|
||||
}
|
||||
@ -68,10 +68,10 @@ 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 > $TEST_BASE_DIR/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 $TEST_BASE_DIR/zdb_001_neg.$$.txt
|
||||
log_must rm $TEST_BASE_DIR/zdb_001_neg.$$.txt
|
||||
|
||||
# we shouldn't able to run it on any dataset
|
||||
check_zdb zdb $TESTPOOL
|
||||
|
@ -44,16 +44,16 @@
|
||||
|
||||
function cleanup
|
||||
{
|
||||
if [ -e /tmp/zfs_001_neg.$$.txt ]
|
||||
if [ -e $TEST_BASE_DIR/zfs_001_neg.$$.txt ]
|
||||
then
|
||||
rm /tmp/zfs_001_neg.$$.txt
|
||||
rm $TEST_BASE_DIR/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 > $TEST_BASE_DIR/zfs_001_neg.$$.txt 2>&1"
|
||||
log_must grep "usage: zfs command args" $TEST_BASE_DIR/zfs_001_neg.$$.txt
|
||||
|
||||
log_pass "zfs shows a usage message when run as a user"
|
||||
|
@ -46,7 +46,7 @@
|
||||
log_assert "zfs receive returns an error when run as a user"
|
||||
|
||||
log_mustnot eval "zfs receive -d $TESTPOOL/$TESTFS/$TESTFS2 \
|
||||
< /tmp/zfstest_datastream.dat"
|
||||
< $TEST_BASE_DIR/zfstest_datastream.dat"
|
||||
|
||||
# verify that command actually did nothing
|
||||
|
||||
|
@ -45,23 +45,23 @@
|
||||
|
||||
function cleanup
|
||||
{
|
||||
if [ -e /tmp/zfstest_datastream.$$ ]
|
||||
if [ -e $TEST_BASE_DIR/zfstest_datastream.$$ ]
|
||||
then
|
||||
log_must rm /tmp/zfstest_datastream.$$
|
||||
log_must rm $TEST_BASE_DIR/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 > $TEST_BASE_DIR/zfstest_datastream.$$"
|
||||
|
||||
# Now check that the above command actually did nothing
|
||||
|
||||
# We should have a non-zero-length file in /tmp
|
||||
if [ -s /tmp/zfstest_datastream.$$ ]
|
||||
if [ -s $TEST_BASE_DIR/zfstest_datastream.$$ ]
|
||||
then
|
||||
log_fail "A zfs send file was created in /tmp/zfstest_datastream.$$ !"
|
||||
log_fail "A zfs send file was created in $TEST_BASE_DIR/zfstest_datastream.$$ !"
|
||||
fi
|
||||
|
||||
log_pass "zfs send returns an error when run as a user"
|
||||
|
@ -45,16 +45,16 @@
|
||||
|
||||
function cleanup
|
||||
{
|
||||
if [ -e /tmp/zpool_001_neg.$$.txt ]
|
||||
if [ -e $TEST_BASE_DIR/zpool_001_neg.$$.txt ]
|
||||
then
|
||||
rm /tmp/zpool_001_neg.$$.txt
|
||||
rm $TEST_BASE_DIR/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 > $TEST_BASE_DIR/zpool_001_neg.$$.txt 2>&1"
|
||||
log_must grep "usage: zpool command args" $TEST_BASE_DIR/zpool_001_neg.$$.txt
|
||||
|
||||
log_pass "zpool shows a usage message when run as a user"
|
||||
|
@ -45,28 +45,28 @@
|
||||
|
||||
function check_pool_status
|
||||
{
|
||||
RESULT=$(grep "pool:" /tmp/pool-status.$$)
|
||||
RESULT=$(grep "pool:" $TEST_BASE_DIR/pool-status.$$)
|
||||
if [ -z "$RESULT" ]
|
||||
then
|
||||
log_fail "No pool: string found in zpool status output!"
|
||||
fi
|
||||
rm /tmp/pool-status.$$
|
||||
rm $TEST_BASE_DIR/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 > $TEST_BASE_DIR/pool-status.$$"
|
||||
check_pool_status
|
||||
|
||||
log_must eval "zpool status -v > /tmp/pool-status.$$"
|
||||
log_must eval "zpool status -v > $TEST_BASE_DIR/pool-status.$$"
|
||||
check_pool_status
|
||||
|
||||
log_must eval "zpool status $TESTPOOL> /tmp/pool-status.$$"
|
||||
log_must eval "zpool status $TESTPOOL> $TEST_BASE_DIR/pool-status.$$"
|
||||
check_pool_status
|
||||
|
||||
log_must eval "zpool status -v $TESTPOOL > /tmp/pool-status.$$"
|
||||
log_must eval "zpool status -v $TESTPOOL > $TEST_BASE_DIR/pool-status.$$"
|
||||
check_pool_status
|
||||
|
||||
log_pass "zpool status works when run as a user"
|
||||
|
@ -54,7 +54,7 @@ log_onexit cleanup
|
||||
|
||||
log_assert "Verify 'zfs list -r' could display any children recursively."
|
||||
|
||||
tmpfile=/var/tmp/zfslist.out.$$
|
||||
tmpfile=$TEST_BASE_DIR/zfslist.out.$$
|
||||
children="$TESTPOOL/$TESTFS"
|
||||
|
||||
for fs in $DATASETS ; do
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
typeset tmpfile=/var/tmp/zfsiostat.out.$$
|
||||
typeset tmpfile=$TEST_BASE_DIR/zfsiostat.out.$$
|
||||
typeset -i stat_count=0
|
||||
|
||||
function cleanup
|
||||
|
@ -111,7 +111,7 @@ done
|
||||
|
||||
run_and_verify -p "$MPOOL" "zpool split $MPOOL ${MPOOL}_split"
|
||||
|
||||
import_dir=/var/tmp/import_dir.$$
|
||||
import_dir=$TEST_BASE_DIR/import_dir.$$
|
||||
log_must mkdir $import_dir
|
||||
log_must cp $STF_SUITE/tests/functional/history/zfs-pool-v4.dat.Z $import_dir
|
||||
log_must uncompress $import_dir/zfs-pool-v4.dat.Z
|
||||
|
@ -61,7 +61,7 @@ fs=$TESTPOOL/$TESTFS1; newfs=$TESTPOOL/newfs; fsclone=$TESTPOOL/clone
|
||||
vol=$TESTPOOL/$TESTVOL ; newvol=$TESTPOOL/newvol; volclone=$TESTPOOL/volclone
|
||||
fssnap=$fs@fssnap; fssnap2=$fs@fssnap2
|
||||
volsnap=$vol@volsnap; volsnap2=$vol@volsnap2
|
||||
tmpfile=/tmp/tmpfile.$$ ; tmpfile2=/tmp/tmpfile2.$$
|
||||
tmpfile=$TEST_BASE_DIR/tmpfile.$$ ; tmpfile2=$TEST_BASE_DIR/tmpfile2.$$
|
||||
|
||||
if is_linux; then
|
||||
# property value property value
|
||||
|
@ -79,7 +79,7 @@ while ((i < 300)); do
|
||||
((i += 1))
|
||||
done
|
||||
|
||||
TMPFILE=/tmp/spool.$$
|
||||
TMPFILE=$TEST_BASE_DIR/spool.$$
|
||||
zpool history $spool >$TMPFILE
|
||||
typeset -i entry_count=$(wc -l $TMPFILE | awk '{print $1}')
|
||||
typeset final_md5=$(head -2 $TMPFILE | md5sum | awk '{print $1}')
|
||||
|
@ -125,7 +125,7 @@ ln $DEV_RDSKDIR/$SDISK $REALDISK
|
||||
log_must zpool create $TESTPOOL2 $REALDISK
|
||||
|
||||
# Backup the contents of the disk image
|
||||
BACKUP=/tmp/kstat-state-realdisk.gz
|
||||
BACKUP=$TEST_BASE_DIR/kstat-state-realdisk.gz
|
||||
log_must [ ! -e $BACKUP ]
|
||||
gzip -c $REALDISK > $BACKUP
|
||||
|
||||
|
@ -34,10 +34,10 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
[[ -f /var/tmp/exitsZero.ksh ]] && \
|
||||
log_must rm -f /var/tmp/exitsZero.ksh
|
||||
[[ -f /var/tmp/testbackgprocs.ksh ]] && \
|
||||
log_must rm -f /var/tmp/testbackgprocs.ksh
|
||||
[[ -f $TEST_BASE_DIR/exitsZero.ksh ]] && \
|
||||
log_must rm -f $TEST_BASE_DIR/exitsZero.ksh
|
||||
[[ -f $TEST_BASE_DIR/testbackgprocs.ksh ]] && \
|
||||
log_must rm -f $TEST_BASE_DIR/testbackgprocs.ksh
|
||||
|
||||
ismounted $TESTPOOL/$TESTFS_TGT
|
||||
(( $? == 0 )) && log_must zfs umount $TESTPOOL/$TESTFS_TGT
|
||||
|
@ -37,11 +37,11 @@
|
||||
#
|
||||
function check_bg_procs_limit_num
|
||||
{
|
||||
echo "#!/bin/ksh" > /var/tmp/exitsZero.ksh
|
||||
echo "exit 0" >> /var/tmp/exitsZero.ksh
|
||||
chmod 777 /var/tmp/exitsZero.ksh
|
||||
echo "#!/bin/ksh" > $TEST_BASE_DIR/exitsZero.ksh
|
||||
echo "exit 0" >> $TEST_BASE_DIR/exitsZero.ksh
|
||||
chmod 777 $TEST_BASE_DIR/exitsZero.ksh
|
||||
|
||||
cat <<EOF > /var/tmp/testbackgprocs.ksh
|
||||
cat <<EOF > $TEST_BASE_DIR/testbackgprocs.ksh
|
||||
#!/bin/ksh
|
||||
#
|
||||
# exitsZero.ksh is a one line script
|
||||
@ -52,7 +52,7 @@ PIDS=""
|
||||
typeset -i i=1
|
||||
while [ \$i -le 50 ]
|
||||
do
|
||||
/var/tmp/exitsZero.ksh &
|
||||
$TEST_BASE_DIR/exitsZero.ksh &
|
||||
PIDS="\$PIDS \$!"
|
||||
(( i = i + 1 ))
|
||||
done
|
||||
@ -67,7 +67,7 @@ done
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
ksh /var/tmp/testbackgprocs.ksh
|
||||
ksh $TEST_BASE_DIR/testbackgprocs.ksh
|
||||
if [[ $? -eq 1 ]]; then
|
||||
#
|
||||
# Current ksh being executed has a limit
|
||||
|
@ -50,7 +50,7 @@ log_must zfs clone $origin@a $origin/clone
|
||||
for rs in 512 1024 2048 4096 8192 16384 32768 65536 131072 ; do
|
||||
log_must zfs set recsize=$rs $origin/clone
|
||||
dd if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
|
||||
conv=notrunc >/tmp/null 2>&1 || log_fail "dd failed."
|
||||
conv=notrunc > $TEST_BASE_DIR/null 2>&1 || log_fail "dd failed."
|
||||
log_must verify_nopwrite $origin $origin@a $origin/clone
|
||||
done
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
export BASEDIR=/var/tmp/basedir.$$
|
||||
export BASEDIR=$TEST_BASE_DIR/basedir.$$
|
||||
export TESTFILE=testfile.$$
|
||||
|
||||
export PRE_RECORD_FILE=$BASEDIR/pre-record-file.$$
|
||||
|
@ -48,7 +48,7 @@ verify_runnable "global"
|
||||
log_assert "zpool/zfs destroy <rootpool> should fail"
|
||||
|
||||
typeset rootpool=$(get_rootpool)
|
||||
typeset tmpfile="/tmp/mounted-datasets.$$"
|
||||
typeset tmpfile="$TEST_BASE_DIR/mounted-datasets.$$"
|
||||
|
||||
# Collect the currently mounted ZFS filesystems, so that we can repair any
|
||||
# damage done by the attempted pool destroy. The destroy itself should fail,
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
export TMPDEV=/tmp/zpool_upgrade_test.dat
|
||||
export TMPDEV=$TEST_BASE_DIR/zpool_upgrade_test.dat
|
||||
|
||||
function cleanup_upgrade
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ log_onexit cleanup
|
||||
log_assert \
|
||||
"the userquota and groupquota can be set during zpool,zfs creation"
|
||||
|
||||
typeset pool_vdev=/var/tmp/pool_dev.$$
|
||||
typeset pool_vdev=$TEST_BASE_DIR/pool_dev.$$
|
||||
|
||||
log_must mkfile 500m $pool_vdev
|
||||
|
||||
|
@ -33,8 +33,8 @@
|
||||
del_user $ZFS_USER
|
||||
del_group $ZFS_GROUP
|
||||
|
||||
USES_NIS=$(cat /tmp/zfs-xattr-test-nis.txt)
|
||||
rm /tmp/zfs-xattr-test-nis.txt
|
||||
USES_NIS=$(cat $TEST_BASE_DIR/zfs-xattr-test-nis.txt)
|
||||
rm $TEST_BASE_DIR/zfs-xattr-test-nis.txt
|
||||
|
||||
if [ "${USES_NIS}" == "true" ]
|
||||
then
|
||||
|
@ -48,8 +48,8 @@ fi
|
||||
log_must add_group $ZFS_GROUP
|
||||
log_must add_user $ZFS_GROUP $ZFS_USER
|
||||
|
||||
echo $ZFS_USER > /tmp/zfs-xattr-test-user.txt
|
||||
echo $USES_NIS > /tmp/zfs-xattr-test-nis.txt
|
||||
echo $ZFS_USER > $TEST_BASE_DIR/zfs-xattr-test-user.txt
|
||||
echo $USES_NIS > $TEST_BASE_DIR/zfs-xattr-test-nis.txt
|
||||
|
||||
DISK=${DISKS%% *}
|
||||
default_setup $DISK
|
||||
|
@ -24,7 +24,7 @@
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
export NISSTAFILE=/var/tmp/nis_state
|
||||
export NISSTAFILE=$TEST_BASE_DIR/nis_state
|
||||
|
||||
export ZFS_USER=zxtr
|
||||
export ZFS_GROUP=zfsgrp
|
||||
|
@ -49,9 +49,9 @@ function cleanup {
|
||||
log_must zfs destroy $TESTPOOL/$TESTFS@snap
|
||||
log_must rm $TESTDIR/myfile2.$$
|
||||
log_must rm $TESTDIR/myfile.$$
|
||||
log_must rm /tmp/output.$$
|
||||
[[ -e /tmp/expected_output.$$ ]] && log_must rm \
|
||||
/tmp/expected_output.$$
|
||||
log_must rm $TEST_BASE_DIR/output.$$
|
||||
[[ -e $TEST_BASE_DIR/expected_output.$$ ]] && log_must rm \
|
||||
$TEST_BASE_DIR/expected_output.$$
|
||||
|
||||
}
|
||||
|
||||
@ -71,20 +71,20 @@ log_must zfs snapshot $TESTPOOL/$TESTFS@snap
|
||||
# we shouldn't be able to alter the first file's xattr
|
||||
if is_linux; then
|
||||
log_mustnot eval "attr -s cp $TESTDIR/.zfs/snapshot/snap/myfile.$$ \
|
||||
</etc/passwd >/tmp/output.$$ 2>&1"
|
||||
log_must grep -i Read-only /tmp/output.$$
|
||||
</etc/passwd > $TEST_BASE_DIR/output.$$ 2>&1"
|
||||
log_must grep -i Read-only $TEST_BASE_DIR/output.$$
|
||||
log_must eval "attr -q -l $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \
|
||||
>/tmp/output.$$ 2>&1"
|
||||
log_must eval "attr -q -l $TESTDIR/myfile2.$$ >/tmp/expected_output.$$"
|
||||
> $TEST_BASE_DIR/output.$$ 2>&1"
|
||||
log_must eval "attr -q -l $TESTDIR/myfile2.$$ > $TEST_BASE_DIR/expected_output.$$"
|
||||
else
|
||||
log_mustnot eval " runat $TESTDIR/.zfs/snapshot/snap/myfile.$$ \
|
||||
cp /etc/passwd . >/tmp/output.$$ 2>&1"
|
||||
log_must grep -i Read-only /tmp/output.$$
|
||||
cp /etc/passwd . > $TEST_BASE_DIR/output.$$ 2>&1"
|
||||
log_must grep -i Read-only $TEST_BASE_DIR/output.$$
|
||||
log_must eval "runat $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \
|
||||
ls >/tmp/output.$$ 2>&1"
|
||||
create_expected_output /tmp/expected_output.$$ SUNWattr_ro SUNWattr_rw
|
||||
ls > $TEST_BASE_DIR/output.$$ 2>&1"
|
||||
create_expected_output $TEST_BASE_DIR/expected_output.$$ SUNWattr_ro SUNWattr_rw
|
||||
fi
|
||||
|
||||
log_must diff /tmp/output.$$ /tmp/expected_output.$$
|
||||
log_must diff $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected_output.$$
|
||||
|
||||
log_pass "create/write xattr on a snapshot fails"
|
||||
|
@ -43,7 +43,7 @@
|
||||
function cleanup {
|
||||
typeset file
|
||||
|
||||
for file in /tmp/output.$$ /tmp/expected-output.$$ \
|
||||
for file in $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected-output.$$ \
|
||||
$TESTDIR/myfile.$$ ; do
|
||||
log_must rm -f $file
|
||||
done
|
||||
@ -61,15 +61,15 @@ log_must touch $TESTDIR/myfile.$$
|
||||
create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
|
||||
|
||||
# listing the directory .
|
||||
log_must eval "runat $TESTDIR/myfile.$$ ls . > /tmp/output.$$"
|
||||
create_expected_output /tmp/expected-output.$$ \
|
||||
log_must eval "runat $TESTDIR/myfile.$$ ls . > $TEST_BASE_DIR/output.$$"
|
||||
create_expected_output $TEST_BASE_DIR/expected-output.$$ \
|
||||
SUNWattr_ro SUNWattr_rw passwd
|
||||
log_must diff /tmp/output.$$ /tmp/expected-output.$$
|
||||
log_must diff $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected-output.$$
|
||||
# list the directory . long form
|
||||
log_must eval "runat $TESTDIR/myfile.$$ ls -a . > /tmp/output.$$"
|
||||
create_expected_output /tmp/expected-output.$$ . .. \
|
||||
log_must eval "runat $TESTDIR/myfile.$$ ls -a . > $TEST_BASE_DIR/output.$$"
|
||||
create_expected_output $TEST_BASE_DIR/expected-output.$$ . .. \
|
||||
SUNWattr_ro SUNWattr_rw passwd
|
||||
log_must diff /tmp/output.$$ /tmp/expected-output.$$
|
||||
log_must diff $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected-output.$$
|
||||
|
||||
# list the directory .. expecting one file
|
||||
OUTPUT=$(runat $TESTDIR/myfile.$$ ls ..)
|
||||
|
@ -71,25 +71,25 @@ else
|
||||
log_note "Checking cpio"
|
||||
log_must touch $TESTDIR/cpio.$$
|
||||
create_xattr $TESTDIR/cpio.$$ passwd /etc/passwd
|
||||
echo $TESTDIR/cpio.$$ | cpio -o@ > /tmp/xattr.$$.cpio
|
||||
echo $TESTDIR/cpio.$$ | cpio -o > /tmp/noxattr.$$.cpio
|
||||
echo $TESTDIR/cpio.$$ | cpio -o@ > $TEST_BASE_DIR/xattr.$$.cpio
|
||||
echo $TESTDIR/cpio.$$ | cpio -o > $TEST_BASE_DIR/noxattr.$$.cpio
|
||||
|
||||
# we should have no xattr here
|
||||
log_must cpio -iu < /tmp/xattr.$$.cpio
|
||||
log_must cpio -iu < $TEST_BASE_DIR/xattr.$$.cpio
|
||||
log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
|
||||
|
||||
# we should have an xattr here
|
||||
log_must cpio -iu@ < /tmp/xattr.$$.cpio
|
||||
log_must cpio -iu@ < $TEST_BASE_DIR/xattr.$$.cpio
|
||||
log_must eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
|
||||
|
||||
# we should have no xattr here
|
||||
log_must cpio -iu < /tmp/noxattr.$$.cpio
|
||||
log_must cpio -iu < $TEST_BASE_DIR/noxattr.$$.cpio
|
||||
log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
|
||||
|
||||
# we should have no xattr here
|
||||
log_must cpio -iu@ < /tmp/noxattr.$$.cpio
|
||||
log_must cpio -iu@ < $TEST_BASE_DIR/noxattr.$$.cpio
|
||||
log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
|
||||
log_must rm $TESTDIR/cpio.$$ /tmp/xattr.$$.cpio /tmp/noxattr.$$.cpio
|
||||
log_must rm $TESTDIR/cpio.$$ $TEST_BASE_DIR/xattr.$$.cpio $TEST_BASE_DIR/noxattr.$$.cpio
|
||||
fi
|
||||
|
||||
log_note "Checking cp"
|
||||
|
@ -60,15 +60,15 @@ function compare_xattrs { # filename1 filename2 xattr_name
|
||||
typeset XATTR_NAME=$3
|
||||
|
||||
if is_linux; then
|
||||
attr -q -g $XATTR_NAME $FILE1 >/tmp/file1.$$
|
||||
attr -q -g $XATTR_NAME $FILE2 >/tmp/file2.$$
|
||||
attr -q -g $XATTR_NAME $FILE1 > $TEST_BASE_DIR/file1.$$
|
||||
attr -q -g $XATTR_NAME $FILE2 > $TEST_BASE_DIR/file2.$$
|
||||
else
|
||||
runat $FILE1 cat $XATTR_NAME > /tmp/file1.$$
|
||||
runat $FILE2 cat $XATTR_NAME > /tmp/file2.$$
|
||||
runat $FILE1 cat $XATTR_NAME > $TEST_BASE_DIR/file1.$$
|
||||
runat $FILE2 cat $XATTR_NAME > $TEST_BASE_DIR/file2.$$
|
||||
fi
|
||||
|
||||
log_must diff /tmp/file1.$$ /tmp/file2.$$
|
||||
log_must rm /tmp/file1.$$ /tmp/file2.$$
|
||||
log_must diff $TEST_BASE_DIR/file1.$$ $TEST_BASE_DIR/file2.$$
|
||||
log_must rm $TEST_BASE_DIR/file1.$$ $TEST_BASE_DIR/file2.$$
|
||||
}
|
||||
|
||||
function verify_xattr { # filename xattr_name xattr_contents
|
||||
@ -79,14 +79,14 @@ function verify_xattr { # filename xattr_name xattr_contents
|
||||
# read the xattr, writing it to a temp file
|
||||
if is_linux; then
|
||||
log_must eval \
|
||||
"attr -q -g $XATTR_NAME $FILE >/tmp/$XATTR_NAME.$$"
|
||||
"attr -q -g $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$"
|
||||
else
|
||||
log_must eval \
|
||||
"runat $FILE cat $XATTR_NAME >/tmp/$XATTR_NAME.$$ 2>&1"
|
||||
"runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1"
|
||||
fi
|
||||
|
||||
log_must diff $XATTR_CONTENTS /tmp/$XATTR_NAME.$$
|
||||
rm /tmp/$XATTR_NAME.$$
|
||||
log_must diff $XATTR_CONTENTS $TEST_BASE_DIR/$XATTR_NAME.$$
|
||||
rm $TEST_BASE_DIR/$XATTR_NAME.$$
|
||||
}
|
||||
|
||||
function delete_xattr { # filename xattr_name
|
||||
@ -111,15 +111,15 @@ function verify_write_xattr { # filename xattr_name
|
||||
if is_linux; then
|
||||
log_must attr -q -s $XATTR_NAME $FILE < /etc/passwd
|
||||
log_must eval \
|
||||
"attr -q -g $XATTR_NAME $FILE >/tmp/$XATTR_NAME.$$"
|
||||
"attr -q -g $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$"
|
||||
else
|
||||
log_must eval "runat $FILE dd if=/etc/passwd of=$XATTR_NAME"
|
||||
log_must eval \
|
||||
"runat $FILE cat $XATTR_NAME > /tmp/$XATTR_NAME.$$ 2>&1"
|
||||
"runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1"
|
||||
fi
|
||||
log_must dd if=/etc/passwd of=/tmp/passwd_dd.$$
|
||||
log_must diff /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$
|
||||
log_must rm /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$
|
||||
log_must dd if=/etc/passwd of=$TEST_BASE_DIR/passwd_dd.$$
|
||||
log_must diff $TEST_BASE_DIR/passwd_dd.$$ $TEST_BASE_DIR/$XATTR_NAME.$$
|
||||
log_must rm $TEST_BASE_DIR/passwd_dd.$$ $TEST_BASE_DIR/$XATTR_NAME.$$
|
||||
}
|
||||
|
||||
# this function is to create the expected output
|
||||
|
Loading…
Reference in New Issue
Block a user