1 #! /usr/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
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.
8 #
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.
13 #
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]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 . $STF_SUITE/tests/acl/acl_common.kshlib
29
30 #################################################################################
31 #
32 # __stc_assertion_start
33 #
34 # ID: acl_pax_pos001
35 #
36 # DESCRIPTION:
37 # Verify directories include attribute in pax archive and restore with pax
38 # should succeed.
39 #
40 # STRATEGY:
41 # 1. Use mktree create a set of directories in directory A.
42 # 2. Enter into directory A and record all directory information.
43 # 3. pax all the files to directory B.
44 # 4. Then pax the pax file to directory C.
45 # 5. Record all the directories informat in derectory C.
46 # 6. Verify the two records should be identical.
47 #
48 # TESTABILITY: explicit
49 #
50 # TEST_AUTOMATION_LEVEL: automated
51 #
52 # CODING_STATUS: COMPLETED (2006-06-01)
53 #
54 # __stc_assertion_end
55 #
56 ################################################################################
57
58 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
59 && set -x
60
61 echo "ASSERTION: Verify include attribute in pax archive and restore with pax " \
62 "should succeed."
63
64 for user in root $ACL_STAFF1; do
65 # In TX env, we can't create files with xattr as a regular user
66 if [[ $user != root ]] && [[ ! -z $ZONE_PATH ]]; then
67 continue
68 fi
69
70 RUN_CHECK set_cur_usr $user || cleanup $STF_FAIL
71
72 if [[ ! -d $INI_DIR ]]; then
73 RUN_CHECK usr_exec $MKDIR -m 777 -p $INI_DIR \
74 || cleanup $STF_FAIL
75 fi
76 RUN_CHECK usr_exec $MKTREE -b $INI_DIR -l 6 -d 2 -f 2 \
77 || cleanup $STF_FAIL
78
79 #
80 # Enter into initial directory and record all directory information,
81 # then pax all the files to $TMP_DIR/files.pax.
82 #
83 if [[ ! -d $TMP_DIR ]]; then
84 RUN_CHECK usr_exec $MKDIR $TMP_DIR || cleanup $STF_FAIL
85 fi
86 initout=$TMP_DIR/initout.$$
87 paxout=$TMP_DIR/files.pax
88
89 cd $INI_DIR
90 RUN_CHECK record_cksum $MNTDIR/$INI_DIR $MNTDIR/$initout > /dev/null \
91 || cleanup $STF_FAIL
92 RUN_CHECK usr_exec $PAX -w -@ -f $MNTDIR/$paxout * > /dev/null \
93 || cleanup $STF_FAIL
94
95 #
96 # Enter into test directory and pax $TMP_DIR/files.pax to current
97 # directory. Record all directory information and compare with initial
98 # directory record.
99 #
100 if [[ ! -d $MNTDIR/$TST_DIR ]]; then
101 RUN_CHECK usr_exec $MKDIR -m 777 $MNTDIR/$TST_DIR || cleanup $STF_FAIL
102 fi
103 testout=$TMP_DIR/testout.$$
104 cd $MNTDIR/$TST_DIR
105 RUN_CHECK usr_exec $PAX -r -@ -f $MNTDIR/$paxout > /dev/null \
106 || cleanup $STF_FAIL
107 RUN_CHECK record_cksum $MNTDIR/$TST_DIR $MNTDIR/$testout > /dev/null \
108 || cleanup $STF_FAIL
109
110 RUN_CHECK usr_exec $DIFF $MNTDIR/$initout $MNTDIR/$testout || cleanup $STF_FAIL
111
112 cd $MNTDIR
113 cleanup
114 done
115
116 # Directories pax archive and restre with pax passed.
117 cleanup $STF_PASS