ZTS: Get xattr tests running on FreeBSD

This mostly involves reworking platform checks to make illumos the
exception (thanks to their unusual way of exposing xattrs). Other
platforms are able to take advantage of the recently added xattr
wrappers in libtest.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9872
This commit is contained in:
Ryan Moeller 2020-01-23 20:14:40 -05:00 committed by Brian Behlendorf
parent 35b07497c6
commit dbfec5cc09
14 changed files with 177 additions and 151 deletions

View File

@ -868,6 +868,12 @@ tags = ['functional', 'vdev_zaps']
tests = ['write_dirs_001_pos', 'write_dirs_002_pos']
tags = ['functional', 'write_dirs']
[tests/functional/xattr]
tests = ['xattr_001_pos', 'xattr_002_neg', 'xattr_003_neg', 'xattr_004_pos',
'xattr_005_pos', 'xattr_006_pos', 'xattr_007_neg',
'xattr_011_pos', 'xattr_012_pos', 'xattr_013_pos']
tags = ['functional', 'xattr']
[tests/functional/zvol/zvol_ENOSPC]
tests = ['zvol_ENOSPC_001_pos']
tags = ['functional', 'zvol', 'zvol_ENOSPC']

View File

@ -130,10 +130,3 @@ tags = ['functional', 'upgrade']
tests = ['groupspace_001_pos', 'groupspace_002_pos', 'groupspace_003_pos',
'userquota_013_pos', 'userspace_003_pos']
tags = ['functional', 'userquota']
[tests/functional/xattr:Linux]
tests = ['xattr_001_pos', 'xattr_002_neg', 'xattr_003_neg', 'xattr_004_pos',
'xattr_005_pos', 'xattr_006_pos', 'xattr_007_neg', 'xattr_008_pos',
'xattr_009_neg', 'xattr_010_neg', 'xattr_011_pos', 'xattr_012_pos',
'xattr_013_pos']
tags = ['functional', 'xattr']

View File

@ -33,6 +33,10 @@ tags = ['functional', 'cli_root', 'zpool_add']
tests = ['zpool_create_016_pos']
tags = ['functional', 'cli_root', 'zpool_create']
[tests/functional/xattr:illumos]
tests = ['xattr_008_pos', 'xattr_009_neg', 'xattr_010_neg']
tags = ['functional', 'xattr']
[tests/functional/zvol/zvol_misc:illumos]
tests = ['zvol_misc_001_neg', 'zvol_misc_003_neg', 'zvol_misc_004_pos',
'zvol_misc_005_neg', 'zvol_misc_006_pos']

View File

@ -162,9 +162,6 @@ known = {
'rootpool/setup': ['SKIP', na_reason],
'rsend/rsend_008_pos': ['SKIP', '6066'],
'vdev_zaps/vdev_zaps_007_pos': ['FAIL', known_reason],
'xattr/xattr_008_pos': ['SKIP', na_reason],
'xattr/xattr_009_neg': ['SKIP', na_reason],
'xattr/xattr_010_neg': ['SKIP', na_reason],
'zvol/zvol_swap/zvol_swap_003_pos': ['SKIP', na_reason],
'zvol/zvol_swap/zvol_swap_005_pos': ['SKIP', na_reason],
'zvol/zvol_swap/zvol_swap_006_pos': ['SKIP', na_reason],

View File

@ -56,7 +56,10 @@ log_must touch $TESTDIR/myfile.$$
create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
log_must chmod 000 $TESTDIR/myfile.$$
if is_linux; then
if is_illumos; then
log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cat passwd"
log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cp /etc/passwd ."
else
user_run $ZFS_USER eval \
"get_xattr passwd $TESTDIR/myfile.$$ >/tmp/passwd.$$"
log_mustnot diff /etc/passwd /tmp/passwd.$$
@ -68,9 +71,6 @@ if is_linux; then
get_xattr passwd $TESTDIR/myfile.$$ >/tmp/passwd.$$
log_must diff /etc/passwd /tmp/passwd.$$
log_must rm /tmp/passwd.$$
else
log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cat passwd"
log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cp /etc/passwd ."
fi
log_pass "read/write xattr on a file with no permissions fails"

View File

@ -63,37 +63,8 @@ block_device_wait
log_must eval "new_fs $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol > /dev/null 2>&1"
log_must mkdir /tmp/$NEWFS_DEFAULT_FS.$$
if is_linux; then
log_must mount -o user_xattr \
$ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol /tmp/$NEWFS_DEFAULT_FS.$$
# Create files in ext and tmpfs, and set some xattrs on them.
# Use small values for xattrs for ext compatibility.
log_must touch /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$
log_must touch /tmp/tmpfs-file.$$
echo "TEST XATTR" >/tmp/xattr1
echo "1234567890" >/tmp/xattr2
log_must set_xattr_stdin xattr1 \
/tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ </tmp/xattr1
log_must set_xattr_stdin xattr2 /tmp/tmpfs-file.$$ </tmp/xattr2
# copy those files to ZFS
log_must cp -a /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ \
$TESTDIR
log_must cp -a /tmp/tmpfs-file.$$ $TESTDIR
# ensure the xattr information has been copied correctly
log_must eval "get_xattr xattr1 $TESTDIR/$NEWFS_DEFAULT_FS-file.$$ \
>/tmp/xattr1.$$"
log_must diff /tmp/xattr1.$$ /tmp/xattr1
log_must eval "get_xattr xattr2 $TESTDIR/tmpfs-file.$$ >/tmp/xattr2.$$"
log_must diff /tmp/xattr2.$$ /tmp/xattr2
log_must rm /tmp/xattr1 /tmp/xattr1.$$ /tmp/xattr2 /tmp/xattr2.$$
log_must umount /tmp/$NEWFS_DEFAULT_FS.$$
else
log_must mkdir /tmp/tmpfs.$$
if is_illumos; then
log_must mount $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol \
/tmp/$NEWFS_DEFAULT_FS.$$
@ -115,6 +86,57 @@ else
diff passwd /etc/passwd
log_must runat $TESTDIR/tmpfs-file.$$ diff group /etc/group
log_must umount /tmp/$NEWFS_DEFAULT_FS.$$
else
if is_linux; then
options="-o user_xattr"
fi
log_must mount ${options:+""} \
$ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol /tmp/$NEWFS_DEFAULT_FS.$$
# Create files in ext and tmpfs, and set some xattrs on them.
# Use small values for xattrs for ext compatibility.
log_must touch /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$
echo "TEST XATTR" >/tmp/xattr1
echo "1234567890" >/tmp/xattr2
log_must set_xattr_stdin xattr1 \
/tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ </tmp/xattr1
if is_linux; then
log_must touch /tmp/tmpfs-file.$$
log_must set_xattr_stdin xattr2 /tmp/tmpfs-file.$$ </tmp/xattr2
fi
# copy those files to ZFS
if is_freebsd; then
# cp does not preserve extattrs on FreeBSD
export TAPE="-"
log_must eval "tar cC /tmp/$NEWFS_DEFAULT_FS.$$ \
$NEWFS_DEFAULT_FS-file.$$ | tar xC $TESTDIR"
else
log_must cp -a \
/tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ \
$TESTDIR
log_must cp -a /tmp/tmpfs-file.$$ $TESTDIR
fi
# ensure the xattr information has been copied correctly
log_must eval "get_xattr xattr1 $TESTDIR/$NEWFS_DEFAULT_FS-file.$$ \
>/tmp/xattr1.$$"
log_must diff /tmp/xattr1.$$ /tmp/xattr1
log_must rm $TESTDIR/$NEWFS_DEFAULT_FS-file.$$
log_must rm /tmp/xattr1 /tmp/xattr1.$$
if is_linux; then
log_must eval "get_xattr xattr2 $TESTDIR/tmpfs-file.$$ \
>/tmp/xattr2.$$"
log_must diff /tmp/xattr2.$$ /tmp/xattr2
log_must rm /tmp/tmpfs-file.$$
log_must rm /tmp/xattr2 /tmp/xattr2.$$
fi
log_must umount /tmp/$NEWFS_DEFAULT_FS.$$
fi

View File

@ -68,20 +68,20 @@ log_must touch $TESTDIR/myfile2.$$
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 "set_xattr_stdin cp $TESTDIR/.zfs/snapshot/snap/myfile.$$ \
</etc/passwd > $TEST_BASE_DIR/output.$$ 2>&1"
log_must grep -i Read-only $TEST_BASE_DIR/output.$$
log_must eval "ls_xattr $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \
> $TEST_BASE_DIR/output.$$ 2>&1"
log_must eval "ls_xattr $TESTDIR/myfile2.$$ > $TEST_BASE_DIR/expected_output.$$"
else
if is_illumos; then
log_mustnot eval " runat $TESTDIR/.zfs/snapshot/snap/myfile.$$ \
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 > $TEST_BASE_DIR/output.$$ 2>&1"
create_expected_output $TEST_BASE_DIR/expected_output.$$ SUNWattr_ro SUNWattr_rw
else
log_mustnot eval "set_xattr_stdin cp $TESTDIR/.zfs/snapshot/snap/myfile.$$ \
</etc/passwd > $TEST_BASE_DIR/output.$$ 2>&1"
log_must grep -i Read-only $TEST_BASE_DIR/output.$$
log_must eval "ls_xattr $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \
> $TEST_BASE_DIR/output.$$ 2>&1"
log_must eval "ls_xattr $TESTDIR/myfile2.$$ > $TEST_BASE_DIR/expected_output.$$"
fi
log_must diff $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected_output.$$

View File

@ -49,10 +49,6 @@ function cleanup {
done
}
if is_linux; then
log_unsupported "Test case isn't applicable to Linux"
fi
log_assert "special . and .. dirs work as expected for xattrs"
log_onexit cleanup

View File

@ -40,10 +40,6 @@
# 3. Verify we're unable to create a hard link
#
if is_linux; then
log_unsupported "Test case isn't applicable to Linux"
fi
function cleanup {
log_must rm $TESTDIR/myfile.$$

View File

@ -41,10 +41,6 @@
#
#
if is_linux; then
log_unsupported "Test case isn't applicable to Linux"
fi
function cleanup {
log_must rm $TESTDIR/myfile.$$

View File

@ -65,9 +65,7 @@ create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
# and try various cpio options extracting the archives
# with and without xattr support, checking for correct behaviour
if is_linux; then
log_note "Checking cpio - unsupported"
else
if is_illumos; then
log_note "Checking cpio"
log_must touch $TESTDIR/cpio.$$
create_xattr $TESTDIR/cpio.$$ passwd /etc/passwd
@ -90,11 +88,15 @@ else
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.$$ $TEST_BASE_DIR/xattr.$$.cpio $TEST_BASE_DIR/noxattr.$$.cpio
else
log_note "Checking cpio - unsupported"
fi
log_note "Checking cp"
# check that with the right flag, the xattr is preserved
if is_linux; then
if is_freebsd; then
log_note "Checking cp - unsupported"
elif is_linux; then
log_note "Checking cp"
log_must cp -a $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$
compare_xattrs $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ passwd
@ -105,6 +107,7 @@ if is_linux; then
log_mustnot get_xattr passwd $TESTDIR/myfile2.$$
log_must rm $TESTDIR/myfile2.$$
else
log_note "Checking cp"
log_must cp -@ $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$
compare_xattrs $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ passwd
@ -118,9 +121,7 @@ fi
# create a file without xattrs, and check that find -xattr only finds
# our test file that has an xattr.
if is_linux; then
log_note "Checking find - unsupported"
else
if is_illumos; then
log_note "Checking find"
log_must mkdir $TESTDIR/noxattrs
log_must touch $TESTDIR/noxattrs/no-xattr
@ -132,6 +133,8 @@ else
[[ $? -eq 0 ]] && \
log_fail "find -xattr found a file that didn't have an xattr."
log_must rm -rf $TESTDIR/noxattrs
else
log_note "Checking find - unsupported"
fi
log_note "Checking mv"
@ -143,9 +146,7 @@ log_must mv $TESTDIR/mvfile.$$ $TESTDIR/mvfile2.$$
verify_xattr $TESTDIR/mvfile2.$$ passwd /etc/passwd
log_must rm $TESTDIR/mvfile2.$$
if is_linux; then
log_note "Checking pax - unsupported"
else
if is_illumos; then
log_note "Checking pax"
log_must touch $TESTDIR/pax.$$
create_xattr $TESTDIR/pax.$$ passwd /etc/passwd
@ -172,39 +173,12 @@ else
log_must pax -r -f $TESTDIR/xattr.pax $TESTDIR
log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1"
log_must rm $TESTDIR/pax.$$ $TESTDIR/noxattr.pax $TESTDIR/xattr.pax
else
log_note "Checking pax - unsupported"
fi
log_note "Checking tar"
if is_linux; then
log_must touch $TESTDIR/tar.$$
create_xattr $TESTDIR/tar.$$ passwd /etc/passwd
log_must cd $TESTDIR
log_must tar -cf noxattr.tar tar.$$
log_must tar --xattrs -cf xattr.tar tar.$$
log_must rm $TESTDIR/tar.$$
# we should have no xattr here
log_must tar --no-xattrs -xf xattr.tar
log_mustnot get_xattr passwd $TESTDIR/tar.$$
log_must rm $TESTDIR/tar.$$
# we should have an xattr here
log_must tar --xattrs -xf xattr.tar
verify_xattr tar.$$ passwd /etc/passwd
log_must rm $TESTDIR/tar.$$
# we should have no xattr here
log_must tar --no-xattrs -xf $TESTDIR/noxattr.tar
log_mustnot get_xattr passwd $TESTDIR/tar.$$
log_must rm $TESTDIR/tar.$$
# we should have no xattr here
log_must tar --xattrs -xf $TESTDIR/noxattr.tar
log_mustnot get_xattr passwd $TESTDIR/tar.$$
log_must rm $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar
else
if is_illumos; then
log_must touch $TESTDIR/tar.$$
create_xattr $TESTDIR/tar.$$ passwd /etc/passwd
@ -233,6 +207,35 @@ else
log_must tar x@f $TESTDIR/noxattr.tar
log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1"
log_must rm $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar
else
log_must touch $TESTDIR/tar.$$
create_xattr $TESTDIR/tar.$$ passwd /etc/passwd
log_must cd $TESTDIR
log_must tar --no-xattrs -cf noxattr.tar tar.$$
log_must tar --xattrs -cf xattr.tar tar.$$
log_must rm $TESTDIR/tar.$$
# we should have no xattr here
log_must tar --no-xattrs -xf xattr.tar
log_mustnot get_xattr passwd $TESTDIR/tar.$$
log_must rm $TESTDIR/tar.$$
# we should have an xattr here
log_must tar --xattrs -xf xattr.tar
verify_xattr tar.$$ passwd /etc/passwd
log_must rm $TESTDIR/tar.$$
# we should have no xattr here
log_must tar --no-xattrs -xf $TESTDIR/noxattr.tar
log_mustnot get_xattr passwd $TESTDIR/tar.$$
log_must rm $TESTDIR/tar.$$
# we should have no xattr here
log_must tar --xattrs -xf $TESTDIR/noxattr.tar
log_mustnot get_xattr passwd $TESTDIR/tar.$$
log_must rm $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar
fi
log_assert "Basic applications work with xattrs: cpio cp find mv pax tar"

View File

@ -47,6 +47,9 @@
function cleanup {
log_must rm $TESTDIR/myfile.$$
if is_freebsd; then
log_must rm /tmp/xattr.$$
fi
}
function get_pool_size {
@ -79,7 +82,17 @@ fi
FS_SIZE=$(zfs get -p -H -o value used $TESTPOOL/$TESTFS)
if is_linux; then
if is_freebsd; then
# FreeBSD setextattr has awful scaling with respect to input size.
# It reallocs after every 1024 bytes. For now we'll just break up
# the 200MB into 10 20MB attributes, but this test could be revisited
# if someone cared about large extattrs and improves setextattr -i.
log_must mkfile 20m /tmp/xattr.$$
for i in {0..10}; do
log_must eval "set_xattr_stdin xattr$i $TESTDIR/myfile.$$ \
< /tmp/xattr.$$"
done
elif is_linux; then
# Linux setxattr() syscalls limits individual xattrs to 64k. Create
# 100 files, with 128 xattrs each of size 16k. 100*128*16k=200m
log_must xattrtest -k -f 100 -x 128 -s 16384 -p $TESTDIR

View File

@ -65,15 +65,7 @@ log_must umount $TESTDIR
log_must zfs mount -o noxattr $TESTPOOL/$TESTFS
# check that we can't perform xattr operations
if is_linux; then
log_mustnot get_xattr passwd $TESTDIR/myfile.$$
log_mustnot rm_xattr passwd $TESTDIR/myfile.$$
log_mustnot set_xattr_stdin passwd $TESTDIR/myfile.$$ </etc/passwd
log_must touch $TESTDIR/new.$$
log_mustnot set_xattr_stdin passwd $TESTDIR/new.$$ </etc/passwd
log_mustnot rm_xattr passwd $TESTDIR/new.$$
else
if is_illumos; then
log_mustnot eval "runat $TESTDIR/myfile.$$ cat passwd > /dev/null 2>&1"
log_mustnot eval "runat $TESTDIR/myfile.$$ rm passwd > /dev/null 2>&1"
log_mustnot eval "runat $TESTDIR/myfile.$$ cp /etc/passwd . \
@ -83,6 +75,14 @@ else
log_mustnot eval "runat $TESTDIR/new.$$ cp /etc/passwd . \
> /dev/null 2>&1"
log_mustnot eval "runat $TESTDIR/new.$$ rm passwd > /dev/null 2>&1"
else
log_mustnot get_xattr passwd $TESTDIR/myfile.$$
log_mustnot rm_xattr passwd $TESTDIR/myfile.$$
log_mustnot set_xattr_stdin passwd $TESTDIR/myfile.$$ </etc/passwd
log_must touch $TESTDIR/new.$$
log_mustnot set_xattr_stdin passwd $TESTDIR/new.$$ </etc/passwd
log_mustnot rm_xattr passwd $TESTDIR/new.$$
fi
# now mount the filesystem again as normal
@ -94,10 +94,10 @@ verify_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
# there should be no xattr on the file we created while the fs was mounted
# -o noxattr
if is_linux; then
log_mustnot get_xattr passwd $TESTDIR/new.$$
else
if is_illumos; then
log_mustnot eval "runat $TESTDIR/new.$$ cat passwd > /dev/null 2>&1"
else
log_mustnot get_xattr passwd $TESTDIR/new.$$
fi
create_xattr $TESTDIR/new.$$ passwd /etc/passwd

View File

@ -39,14 +39,14 @@ function create_xattr { # filename xattr_name xattr_contents
typeset XATTR_NAME=$2
typeset XATTR_CONTENTS=$3
if is_linux; then
log_mustnot get_xattr $XATTR_NAME $FILE
log_must set_xattr_stdin $XATTR_NAME $FILE < $XATTR_CONTENTS
else
if is_illumos; then
# read any empty xattr on that file
log_must runat $FILE ls
# create the xattr
log_must runat $FILE cp $XATTR_CONTENTS $XATTR_NAME
else
log_mustnot get_xattr $XATTR_NAME $FILE
log_must set_xattr_stdin $XATTR_NAME $FILE < $XATTR_CONTENTS
fi
verify_xattr $FILE $XATTR_NAME $XATTR_CONTENTS
@ -59,12 +59,12 @@ function compare_xattrs { # filename1 filename2 xattr_name
typeset FILE2=$2
typeset XATTR_NAME=$3
if is_linux; then
get_xattr $XATTR_NAME $FILE1 > $TEST_BASE_DIR/file1.$$
get_xattr $XATTR_NAME $FILE2 > $TEST_BASE_DIR/file2.$$
else
if is_illumos; then
runat $FILE1 cat $XATTR_NAME > $TEST_BASE_DIR/file1.$$
runat $FILE2 cat $XATTR_NAME > $TEST_BASE_DIR/file2.$$
else
get_xattr $XATTR_NAME $FILE1 > $TEST_BASE_DIR/file1.$$
get_xattr $XATTR_NAME $FILE2 > $TEST_BASE_DIR/file2.$$
fi
log_must diff $TEST_BASE_DIR/file1.$$ $TEST_BASE_DIR/file2.$$
@ -77,12 +77,12 @@ function verify_xattr { # filename xattr_name xattr_contents
typeset XATTR_CONTENTS=$3
# read the xattr, writing it to a temp file
if is_linux; then
log_must eval \
"get_xattr $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$"
else
if is_illumos; then
log_must eval \
"runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1"
else
log_must eval \
"get_xattr $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$"
fi
log_must diff $XATTR_CONTENTS $TEST_BASE_DIR/$XATTR_NAME.$$
@ -94,12 +94,12 @@ function delete_xattr { # filename xattr_name
typeset XATTR_NAME=$2
# delete the xattr
if is_linux; then
log_must rm_xattr $XATTR_NAME $FILE
log_mustnot get_xattr $XATTR_NAME $FILE
else
if is_illumos; then
log_must runat $FILE rm $XATTR_NAME
log_mustnot eval "runat $FILE ls $XATTR_NAME > /dev/null 2>&1"
else
log_must rm_xattr $XATTR_NAME $FILE
log_mustnot get_xattr $XATTR_NAME $FILE
fi
}
@ -108,14 +108,14 @@ function verify_write_xattr { # filename xattr_name
typeset FILE=$1
typeset XATTR_NAME=$2
if is_linux; then
log_must set_xattr_stdin $XATTR_NAME $FILE < /etc/passwd
log_must eval \
"get_xattr $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$"
else
if is_illumos; then
log_must eval "runat $FILE dd if=/etc/passwd of=$XATTR_NAME"
log_must eval \
"runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1"
else
log_must set_xattr_stdin $XATTR_NAME $FILE < /etc/passwd
log_must eval \
"get_xattr $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$"
fi
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.$$
@ -123,15 +123,15 @@ function verify_write_xattr { # filename xattr_name
}
# this function is to create the expected output
function create_expected_output { # expected_output_file contents_of_the_output
typeset FILE=$1
shift
if [[ -f $FILE ]]; then
log_must rm $FILE
fi
function create_expected_output { # expected_output_file contents_of_the_output
typeset FILE=$1
shift
if [[ -f $FILE ]]; then
log_must rm $FILE
fi
for line in $@
do
log_must eval "echo $line >> $FILE"
done
}
for line in $@
do
log_must eval "echo $line >> $FILE"
done
}