diff options
Diffstat (limited to 'tests/zfs-tests')
10 files changed, 156 insertions, 130 deletions
diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh index a4cb996c4..a3b25ff66 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh @@ -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" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh index 745f06064..0a25d7ac5 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh @@ -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.$$ @@ -116,6 +87,57 @@ else 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 log_pass "Files from $NEWFS_DEFAULT_FS,tmpfs with xattrs copied to zfs retain xattr info." diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh index 3073409c2..5189b6272 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh @@ -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.$$ diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh index 45d24ac27..099a61010 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh index f64f7e42b..c9d636ecb 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh @@ -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.$$ diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh index db218c434..43502bfff 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh @@ -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.$$ diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh index 6a06d1b93..fdfefbf67 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh @@ -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,37 +173,39 @@ 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 +if is_illumos; 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 tar cf noxattr.tar tar.$$ + log_must tar c@f 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 tar xf xattr.tar + log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" log_must rm $TESTDIR/tar.$$ # we should have an xattr here - log_must tar --xattrs -xf xattr.tar + log_must tar x@f 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 tar xf $TESTDIR/noxattr.tar + log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" 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 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.$$ @@ -210,28 +213,28 @@ else log_must cd $TESTDIR - log_must tar cf noxattr.tar tar.$$ - log_must tar c@f xattr.tar tar.$$ + 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 xf xattr.tar - log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" + 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 x@f xattr.tar + 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 xf $TESTDIR/noxattr.tar - log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" + 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 x@f $TESTDIR/noxattr.tar - log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" + 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 diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh index 7241caf8e..693ca0a63 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh index ec608ce28..efa9faab9 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib b/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib index 5c7e8eb65..bc06f4716 100644 --- a/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib +++ b/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib @@ -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 + if is_illumos; then log_must eval \ - "get_xattr $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$" + "runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1" else log_must eval \ - "runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1" + "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 - - for line in $@ - do - log_must eval "echo $line >> $FILE" - done - } +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 +} |