1*96c8483aSYuri Pankov#!/bin/ksh -p 2*96c8483aSYuri Pankov# 3*96c8483aSYuri Pankov# CDDL HEADER START 4*96c8483aSYuri Pankov# 5*96c8483aSYuri Pankov# The contents of this file are subject to the terms of the 6*96c8483aSYuri Pankov# Common Development and Distribution License (the "License"). 7*96c8483aSYuri Pankov# You may not use this file except in compliance with the License. 8*96c8483aSYuri Pankov# 9*96c8483aSYuri Pankov# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*96c8483aSYuri Pankov# or http://www.opensolaris.org/os/licensing. 11*96c8483aSYuri Pankov# See the License for the specific language governing permissions 12*96c8483aSYuri Pankov# and limitations under the License. 13*96c8483aSYuri Pankov# 14*96c8483aSYuri Pankov# When distributing Covered Code, include this CDDL HEADER in each 15*96c8483aSYuri Pankov# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*96c8483aSYuri Pankov# If applicable, add the following below this CDDL HEADER, with the 17*96c8483aSYuri Pankov# fields enclosed by brackets "[]" replaced with your own identifying 18*96c8483aSYuri Pankov# information: Portions Copyright [yyyy] [name of copyright owner] 19*96c8483aSYuri Pankov# 20*96c8483aSYuri Pankov# CDDL HEADER END 21*96c8483aSYuri Pankov# 22*96c8483aSYuri Pankov 23*96c8483aSYuri Pankov# 24*96c8483aSYuri Pankov# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 25*96c8483aSYuri Pankov# 26*96c8483aSYuri Pankov 27*96c8483aSYuri Pankov# 28*96c8483aSYuri Pankov# ID: xattr_003 29*96c8483aSYuri Pankov# 30*96c8483aSYuri Pankov# DESCRIPTION: 31*96c8483aSYuri Pankov# Verify from local tmpfs with xattrs moved to mount point preserve/omit xattrs 32*96c8483aSYuri Pankov# and from mount point with xattrs moved to local tmpfs preserve/omit xattrs 33*96c8483aSYuri Pankov# 34*96c8483aSYuri Pankov# STRATEGY: 35*96c8483aSYuri Pankov# 1. Create a file, and set an with an xattr 36*96c8483aSYuri Pankov# 2. Move the file to mount point 37*96c8483aSYuri Pankov# 3. Check that mv doesn't have any flags to preserve/omit xattrs - 38*96c8483aSYuri Pankov# they're always moved. 39*96c8483aSYuri Pankov# 4. Do the same in reverse. 40*96c8483aSYuri Pankov# 41*96c8483aSYuri Pankov 42*96c8483aSYuri Pankov. $STF_SUITE/include/libtest.ksh 43*96c8483aSYuri Pankov 44*96c8483aSYuri Pankovtc_id=xattr_003 45*96c8483aSYuri Pankovtc_desc="Verify from local tmpfs with xattrs moved to mount point preserve/omit xattrs\ 46*96c8483aSYuri Pankov and from mount point with xattrs moved to local tmpfs preserve/omit xattrs" 47*96c8483aSYuri Pankov 48*96c8483aSYuri Pankovprint_test_case $tc_id - $tc_desc 49*96c8483aSYuri Pankov 50*96c8483aSYuri Pankovif [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 51*96c8483aSYuri Pankov [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 52*96c8483aSYuri Pankov set -x 53*96c8483aSYuri Pankovfi 54*96c8483aSYuri Pankov 55*96c8483aSYuri Pankovserver=$(server_name) || return 56*96c8483aSYuri Pankov 57*96c8483aSYuri Pankovtestdir_init $TDIR 58*96c8483aSYuri Pankovsmbmount_clean $TMNT 59*96c8483aSYuri Pankovsmbmount_init $TMNT 60*96c8483aSYuri Pankov 61*96c8483aSYuri Pankovcmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" 62*96c8483aSYuri Pankovcti_execute -i '' FAIL $cmd 63*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 64*96c8483aSYuri Pankov cti_fail "FAIL: smbmount can't mount the public share unexpectedly" 65*96c8483aSYuri Pankov return 66*96c8483aSYuri Pankovelse 67*96c8483aSYuri Pankov cti_report "PASS: smbmount can mount the public share as expected" 68*96c8483aSYuri Pankovfi 69*96c8483aSYuri Pankov 70*96c8483aSYuri Pankovsmbmount_getmntopts $TMNT |grep /xattr/ >/dev/null 71*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 72*96c8483aSYuri Pankov smbmount_clean $TMNT 73*96c8483aSYuri Pankov cti_unsupported "UNSUPPORTED (no xattr in this mount)" 74*96c8483aSYuri Pankov return 75*96c8483aSYuri Pankovfi 76*96c8483aSYuri Pankov 77*96c8483aSYuri Pankov#create a file in local file system with a xattr and then mv it to mount point 78*96c8483aSYuri Pankov 79*96c8483aSYuri Pankovcti_execute_cmd "touch $TDIR/test_file" 80*96c8483aSYuri Pankovcreate_xattr $TDIR/test_file passwd /etc/passwd 81*96c8483aSYuri Pankovcti_execute_cmd "mv $TDIR/test_file $TMNT/test_file" 82*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 83*96c8483aSYuri Pankov cti_fail "FAIL: can't move the file with xattr from local to mount point unexpectedly 84*96c8483aSYuri Pankov" 85*96c8483aSYuri Pankov return 86*96c8483aSYuri Pankovelse 87*96c8483aSYuri Pankov cti_report "PASS: can move the file with xattr from local to mount point as expected" 88*96c8483aSYuri Pankovfi 89*96c8483aSYuri Pankovcti_execute FAIL "runat $TMNT/test_file diff passwd /etc/passwd" 90*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 91*96c8483aSYuri Pankov cti_fail "FAIL: after move the xattr has changed unexpectedly" 92*96c8483aSYuri Pankov return 93*96c8483aSYuri Pankovelse 94*96c8483aSYuri Pankov cti_report "PASS: after move the xattr has not changed as expected" 95*96c8483aSYuri Pankovfi 96*96c8483aSYuri Pankovcti_execute_cmd "rm -rf $TDIR/*" 97*96c8483aSYuri Pankovcti_execute_cmd "rm -rf $TMNT/*" 98*96c8483aSYuri Pankov 99*96c8483aSYuri Pankov#create a file in mount point with a xattr and then mv it to local file system 100*96c8483aSYuri Pankov 101*96c8483aSYuri Pankovcti_execute_cmd "touch $TMNT/test_file" 102*96c8483aSYuri Pankovcreate_xattr $TMNT/test_file passwd /etc/passwd 103*96c8483aSYuri Pankovcti_execute_cmd "mv $TMNT/test_file $TDIR/test_file" 104*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 105*96c8483aSYuri Pankov cti_fail "FAIL: can't move the file with xattr from mount point to local unexpectedly" 106*96c8483aSYuri Pankov return 107*96c8483aSYuri Pankovelse 108*96c8483aSYuri Pankov cti_report "PASS: can move the file with xattr from mount point to local as expected" 109*96c8483aSYuri Pankovfi 110*96c8483aSYuri Pankovcti_execute FAIL "runat $TDIR/test_file diff passwd /etc/passwd" 111*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 112*96c8483aSYuri Pankov cti_fail "FAIL: after move the xattr has changed unexpectedly" 113*96c8483aSYuri Pankov return 114*96c8483aSYuri Pankovelse 115*96c8483aSYuri Pankov cti_report "PASS: after move the xattr has not changed as expected" 116*96c8483aSYuri Pankovfi 117*96c8483aSYuri Pankov 118*96c8483aSYuri Pankovsmbmount_clean $TMNT 119*96c8483aSYuri Pankovcti_pass "$tc_id: PASS" 120