dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / test / zfs-tests / tests / functional / xattr / xattr_008_pos.ksh
blob20319967c2e99ac18dc760f64832dec52a0914d6
1 #!/bin/ksh -p
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
22 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
27 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 . $STF_SUITE/include/libtest.shlib
31 . $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
34 # DESCRIPTION:
35 # We verify that the special . and .. dirs work as expected for xattrs.
37 # STRATEGY:
38 # 1. Create a file and an xattr on that file
39 # 2. List the . directory, verifying the output
40 # 3. Verify we're unable to list the ../ directory
43 function cleanup {
44 typeset file
46 for file in /tmp/output.$$ /tmp/expected-output.$$ \
47 $TESTDIR/myfile.$$ ; do
48 log_must rm -f $file
49 done
52 log_assert "special . and .. dirs work as expected for xattrs"
53 log_onexit cleanup
55 # create a file, and an xattr on it
56 log_must touch $TESTDIR/myfile.$$
57 create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
59 # listing the directory .
60 log_must eval "runat $TESTDIR/myfile.$$ ls . > /tmp/output.$$"
61 create_expected_output /tmp/expected-output.$$ \
62 SUNWattr_ro SUNWattr_rw passwd
63 log_must diff /tmp/output.$$ /tmp/expected-output.$$
64 # list the directory . long form
65 log_must eval "runat $TESTDIR/myfile.$$ ls -a . > /tmp/output.$$"
66 create_expected_output /tmp/expected-output.$$ . .. \
67 SUNWattr_ro SUNWattr_rw passwd
68 log_must diff /tmp/output.$$ /tmp/expected-output.$$
70 # list the directory .. expecting one file
71 OUTPUT=$(runat $TESTDIR/myfile.$$ ls ..)
72 if [ "$OUTPUT" != ".." ]
73 then
74 log_fail "Listing the .. directory doesn't show \"..\" as expected."
77 # verify we can't list ../
78 log_mustnot eval "runat $TESTDIR/myfile.$$ ls ../ > /dev/null 2>&1"
80 log_pass "special . and .. dirs work as expected for xattrs"