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_009 29# 30# DESCRIPTION: 31# Verify can create many xattrs on a file 32# 33# STRATEGY: 34# 1. Create a file on a filesystem and add 100 xattrs to it 35# 2. Verify that the xattrs should be right 36# 4. Delete those xattrs 37# 5. Verify that xattrs should not be have 38# 39 40. $STF_SUITE/include/libtest.ksh 41 42tc_id=xattr_009 43tc_desc="Verify can create many xattrs on a file" 44print_test_case $tc_id - $tc_desc 45 46if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 47 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 48 set -x 49fi 50 51server=$(server_name) || return 52 53testdir_init $TDIR 54smbmount_clean $TMNT 55smbmount_init $TMNT 56 57cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" 58cti_execute -i '' FAIL $cmd 59if [[ $? != 0 ]]; then 60 cti_fail "FAIL: smbmount can't mount the public share unexpectedly" 61 return 62else 63 cti_report "PASS: smbmount can mount the public share as expected" 64fi 65 66smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null 67if [[ $? != 0 ]]; then 68 smbmount_clean $TMNT 69 cti_unsupported "UNSUPPORTED (no xattr in this mount)" 70 return 71fi 72 73# Create a file, and set 100 xattrs on it. 74 75cti_execute_cmd "rm -f $TMNT/test_file" 76cti_execute_cmd "touch $TMNT/test_file" 77typeset -i i=0 78typeset -i j=100 79while [[ $i -lt $j ]]; do 80 create_xattr $TMNT/test_file passwd$i /etc/passwd 81 i=$((i+1)) 82done 83 84#create the expected output then compare them with xattrs in the test_file 85 86i=0 87cp /dev/null temp_file 88echo SUNWattr_ro >> temp_file 89echo SUNWattr_rw >> temp_file 90while [[ $i -lt $j ]]; do 91 echo passwd$i >> temp_file 92 i=$((i+1)) 93done 94cti_execute_cmd "sort temp_file > expected_file" 95 96#listing the directory passwd* 97 98cti_execute_cmd "runat $TMNT/test_file ls > output" 99cti_execute_cmd "sort output | diff expected_file -" 100if [[ $? != 0 ]]; then 101cti_fail "FAIL: do not work as expected for xattrs" 102return 103else 104cti_report "PASS: work as expected for xattrs" 105fi 106 107#delete xattrs in test_file verify these are no passwd* in test_file 108 109cti_execute_cmd "runat $TMNT/test_file rm -f passwd*" 110cti_execute_cmd "runat $TMNT/test_file ls passwd*" 111if [[ $? == 0 ]]; then 112cti_fail "FAIL: have passwd* xattrs in test_file unexpectedly" 113return 114else 115cti_report "PASS: should not have passwd* xattrs in test_file as expected" 116fi 117 118cti_execute_cmd "rm -f temp_file expected_file output" 119 120smbmount_clean $TMNT 121cti_pass "$tc_id: PASS" 122