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>
*** 22,32 ****
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
! # Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
--- 22,32 ----
# 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/include/libtest.shlib
. $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
*** 43,80 ****
function cleanup {
typeset file
for file in /tmp/output.$$ /tmp/expected-output.$$ \
$TESTDIR/myfile.$$ ; do
! log_must $RM -f $file
done
}
log_assert "special . and .. dirs work as expected for xattrs"
log_onexit cleanup
# create a file, and an xattr on it
! 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.$$ \
SUNWattr_ro SUNWattr_rw passwd
! log_must $DIFF /tmp/output.$$ /tmp/expected-output.$$
# list the directory . long form
! log_must eval "$RUNAT $TESTDIR/myfile.$$ $LS -a . > /tmp/output.$$"
create_expected_output /tmp/expected-output.$$ . .. \
SUNWattr_ro SUNWattr_rw passwd
! log_must $DIFF /tmp/output.$$ /tmp/expected-output.$$
# list the directory .. expecting one file
! OUTPUT=$($RUNAT $TESTDIR/myfile.$$ $LS ..)
if [ "$OUTPUT" != ".." ]
then
log_fail "Listing the .. directory doesn't show \"..\" as expected."
fi
# verify we can't list ../
! log_mustnot eval "$RUNAT $TESTDIR/myfile.$$ $LS ../ > /dev/null 2>&1"
log_pass "special . and .. dirs work as expected for xattrs"
--- 43,80 ----
function cleanup {
typeset file
for file in /tmp/output.$$ /tmp/expected-output.$$ \
$TESTDIR/myfile.$$ ; do
! log_must rm -f $file
done
}
log_assert "special . and .. dirs work as expected for xattrs"
log_onexit cleanup
# create a file, and an xattr on it
! 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.$$ \
SUNWattr_ro SUNWattr_rw passwd
! log_must diff /tmp/output.$$ /tmp/expected-output.$$
# list the directory . long form
! log_must eval "runat $TESTDIR/myfile.$$ ls -a . > /tmp/output.$$"
create_expected_output /tmp/expected-output.$$ . .. \
SUNWattr_ro SUNWattr_rw passwd
! log_must diff /tmp/output.$$ /tmp/expected-output.$$
# list the directory .. expecting one file
! OUTPUT=$(runat $TESTDIR/myfile.$$ ls ..)
if [ "$OUTPUT" != ".." ]
then
log_fail "Listing the .. directory doesn't show \"..\" as expected."
fi
# verify we can't list ../
! log_mustnot eval "runat $TESTDIR/myfile.$$ ls ../ > /dev/null 2>&1"
log_pass "special . and .. dirs work as expected for xattrs"