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_004 29# 30# DESCRIPTION: 31# Verify from local tmpfs with xattrs copied to mount point retain xattr info 32# and from mount point with xattrs copied to local tmpfs retain xattr info 33# 34# STRATEGY: 35# 1. Create files in local tmpfs with xattrs 36# 2. Copy those files to mount point 37# 3. Ensure the xattrs can be retain 38# 4. Do the same in reverse. 39# 40 41. $STF_SUITE/include/libtest.ksh 42 43tc_id=xattr_004 44tc_desc="Verify from local tmpfs with xattrs copied to mount point retain xattr info\ 45 and from mount point with xattrs copied to local tmpfs retain xattr info" 46print_test_case $tc_id - $tc_desc 47 48if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 49 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 50 set -x 51fi 52 53server=$(server_name) || return 54 55testdir_init $TDIR 56smbmount_clean $TMNT 57smbmount_init $TMNT 58 59cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" 60cti_execute -i '' FAIL $cmd 61if [[ $? != 0 ]]; then 62 cti_fail "FAIL: smbmount can't mount the public share unexpectedly" 63 return 64else 65 cti_report "PASS: smbmount can mount the public share as expected" 66fi 67 68smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null 69if [[ $? != 0 ]]; then 70 smbmount_clean $TMNT 71 cti_unsupported "UNSUPPORTED (no xattr in this mount)" 72 return 73fi 74 75# Create files in local tmpfs, and set some xattrs on them. 76 77cti_execute_cmd "touch $TDIR/test_file1" 78cti_execute_cmd "runat $TDIR/test_file1 cp /etc/passwd ." 79 80# copy local tmpfs to mount point 81 82cti_execute_cmd "cp -@ $TDIR/test_file1 $TMNT" 83 84# ensure the xattr information has been copied correctly 85 86cti_execute_cmd "runat $TMNT/test_file1 diff passwd /etc/passwd" 87if [[ $? != 0 ]]; then 88 cti_fail "FAIL: file xattr not retain when it copy from local tmpfs to mount point" 89 return 90else 91 cti_report "PASS: file xattr retain when it copy from local tmpfs to mount point" 92fi 93# copy mount point to local tmpfs 94 95cti_execute_cmd "cp -@ $TMNT/test_file1 $TDIR/test_file2" 96# ensure the xattr information has been copied correctly 97 98cti_execute_cmd "runat $TDIR/test_file2 diff passwd /etc/passwd" 99if [[ $? != 0 ]]; then 100 cti_fail "FAIL: file xattr not retain when it copy from mount point to local tmpfs" 101 return 102else 103 cti_report "PASS: file xattr retain when it copy from mount point to local tmpfs" 104fi 105 106cti_execute_cmd "rm -rf $TDIR/*" 107 108smbmount_clean $TMNT 109cti_pass "$tc_id: PASS" 110