1#!/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 2010 Sun Microsystems, Inc. All rights reserved. 25# 26 27# 28# ID: xattr_003 29# 30# DESCRIPTION: 31# Verify from local tmpfs with xattrs moved to mount point preserve/omit xattrs 32# and from mount point with xattrs moved to local tmpfs preserve/omit xattrs 33# 34# STRATEGY: 35# 1. Create a file, and set an with an xattr 36# 2. Move the file to mount point 37# 3. Check that mv doesn't have any flags to preserve/omit xattrs - 38# they're always moved. 39# 4. Do the same in reverse. 40# 41 42. $STF_SUITE/include/libtest.ksh 43 44tc_id=xattr_003 45tc_desc="Verify from local tmpfs with xattrs moved to mount point preserve/omit xattrs\ 46 and from mount point with xattrs moved to local tmpfs preserve/omit xattrs" 47 48print_test_case $tc_id - $tc_desc 49 50if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 51 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 52 set -x 53fi 54 55server=$(server_name) || return 56 57testdir_init $TDIR 58smbmount_clean $TMNT 59smbmount_init $TMNT 60 61cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" 62cti_execute -i '' FAIL $cmd 63if [[ $? != 0 ]]; then 64 cti_fail "FAIL: smbmount can't mount the public share unexpectedly" 65 return 66else 67 cti_report "PASS: smbmount can mount the public share as expected" 68fi 69 70smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null 71if [[ $? != 0 ]]; then 72 smbmount_clean $TMNT 73 cti_unsupported "UNSUPPORTED (no xattr in this mount)" 74 return 75fi 76 77#create a file in local file system with a xattr and then mv it to mount point 78 79cti_execute_cmd "touch $TDIR/test_file" 80create_xattr $TDIR/test_file passwd /etc/passwd 81cti_execute_cmd "mv $TDIR/test_file $TMNT/test_file" 82if [[ $? != 0 ]]; then 83 cti_fail "FAIL: can't move the file with xattr from local to mount point unexpectedly 84" 85 return 86else 87 cti_report "PASS: can move the file with xattr from local to mount point as expected" 88fi 89cti_execute FAIL "runat $TMNT/test_file diff passwd /etc/passwd" 90if [[ $? != 0 ]]; then 91 cti_fail "FAIL: after move the xattr has changed unexpectedly" 92 return 93else 94 cti_report "PASS: after move the xattr has not changed as expected" 95fi 96cti_execute_cmd "rm -rf $TDIR/*" 97cti_execute_cmd "rm -rf $TMNT/*" 98 99#create a file in mount point with a xattr and then mv it to local file system 100 101cti_execute_cmd "touch $TMNT/test_file" 102create_xattr $TMNT/test_file passwd /etc/passwd 103cti_execute_cmd "mv $TMNT/test_file $TDIR/test_file" 104if [[ $? != 0 ]]; then 105 cti_fail "FAIL: can't move the file with xattr from mount point to local unexpectedly" 106 return 107else 108 cti_report "PASS: can move the file with xattr from mount point to local as expected" 109fi 110cti_execute FAIL "runat $TDIR/test_file diff passwd /etc/passwd" 111if [[ $? != 0 ]]; then 112 cti_fail "FAIL: after move the xattr has changed unexpectedly" 113 return 114else 115 cti_report "PASS: after move the xattr has not changed as expected" 116fi 117 118smbmount_clean $TMNT 119cti_pass "$tc_id: PASS" 120