1#!/usr/local/bin/ksh93 -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# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23# Use is subject to license terms. 24 25. $STF_SUITE/include/libtest.kshlib 26. $STF_SUITE/tests/xattr/xattr_common.kshlib 27 28################################################################################ 29# 30# __stc_assertion_start 31# 32# ID: xattr_004_pos 33# 34# DESCRIPTION: 35# 36# Creating files on ufs and tmpfs, and copying those files to ZFS with 37# appropriate cp flags, the xattrs will still be readable. 38# 39# STRATEGY: 40# 1. Create files in ufs and tmpfs with xattrs 41# 2. Copy those files to zfs 42# 3. Ensure the xattrs can be read and written 43# 4. Do the same in reverse. 44# 45# TESTABILITY: explicit 46# 47# TEST_AUTOMATION_LEVEL: automated 48# 49# CODING_STATUS: COMPLETED (2006-12-05) 50# 51# __stc_assertion_end 52# 53################################################################################ 54 55# we need to be able to create zvols to hold our test 56# ufs filesystem. 57verify_runnable "global" 58 59# Make sure we clean up properly 60function cleanup { 61 62 if [ $( ismounted $TMPDIR/ufs.${TESTCASE_ID} ufs ) ] 63 then 64 log_must $UMOUNT $TMPDIR/ufs.${TESTCASE_ID} 65 log_must $RM -rf $TMPDIR/ufs.${TESTCASE_ID} 66 fi 67} 68 69log_assert "Files from ufs,tmpfs with xattrs copied to zfs retain xattr info." 70log_onexit cleanup 71 72test_requires RUNAT 73 74# Create a UFS file system that we can work in 75log_must $ZFS create -V128m $TESTPOOL/$TESTFS/zvol 76log_must eval "$ECHO y | $NEWFS /dev/zvol/$TESTPOOL/$TESTFS/zvol > /dev/null 2>&1" 77 78log_must $MKDIR $TMPDIR/ufs.${TESTCASE_ID} 79log_must $MOUNT /dev/zvol/$TESTPOOL/$TESTFS/zvol $TMPDIR/ufs.${TESTCASE_ID} 80 81# Create files in ufs and tmpfs, and set some xattrs on them. 82log_must $TOUCH $TMPDIR/ufs.${TESTCASE_ID}/ufs-file.${TESTCASE_ID} 83log_must $TOUCH $TMPDIR/tmpfs-file.${TESTCASE_ID} 84 85log_must $RUNAT $TMPDIR/ufs.${TESTCASE_ID}/ufs-file.${TESTCASE_ID} $CP /etc/passwd . 86log_must $RUNAT $TMPDIR/tmpfs-file.${TESTCASE_ID} $CP /etc/group . 87 88# copy those files to ZFS 89log_must $CP -@ $TMPDIR/ufs.${TESTCASE_ID}/ufs-file.${TESTCASE_ID} $TESTDIR 90log_must $CP -@ $TMPDIR/tmpfs-file.${TESTCASE_ID} $TESTDIR 91 92# ensure the xattr information has been copied correctly 93log_must $RUNAT $TESTDIR/ufs-file.${TESTCASE_ID} $DIFF passwd /etc/passwd 94log_must $RUNAT $TESTDIR/tmpfs-file.${TESTCASE_ID} $DIFF group /etc/group 95 96log_must $UMOUNT $TMPDIR/ufs.${TESTCASE_ID} 97log_pass "Files from ufs,tmpfs with xattrs copied to zfs retain xattr info." 98