xattr_006_pos.ksh revision 1d32ba663e202c24a5a1f2e5aef83fffb447cb7f
880N/A#!/bin/ksh -p
880N/A#
880N/A# CDDL HEADER START
880N/A#
880N/A# The contents of this file are subject to the terms of the
880N/A# Common Development and Distribution License (the "License").
880N/A# You may not use this file except in compliance with the License.
880N/A#
880N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
880N/A# or http://www.opensolaris.org/os/licensing.
880N/A# See the License for the specific language governing permissions
880N/A# and limitations under the License.
880N/A#
880N/A# When distributing Covered Code, include this CDDL HEADER in each
880N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
880N/A# If applicable, add the following below this CDDL HEADER, with the
880N/A# fields enclosed by brackets "[]" replaced with your own identifying
880N/A# information: Portions Copyright [yyyy] [name of copyright owner]
880N/A#
880N/A# CDDL HEADER END
880N/A#
880N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
880N/A# Use is subject to license terms.
880N/A#
880N/A
4458N/A#
880N/A# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
880N/A#
880N/A
880N/A. $STF_SUITE/include/libtest.shlib
880N/A. $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
3827N/A
880N/A#
880N/A# DESCRIPTION:
880N/A# Xattrs present on a file in a snapshot should be visible.
880N/A#
880N/A# STRATEGY:
880N/A# 1. Create a file and give it an xattr
880N/A# 2. Take a snapshot of the filesystem
880N/A# 3. Verify that we can take a snapshot of it.
880N/A#
880N/A
880N/Afunction cleanup {
880N/A
880N/A log_must zfs destroy $TESTPOOL/$TESTFS@snap
880N/A log_must rm $TESTDIR/myfile.$$
880N/A
5354N/A}
3827N/A
5354N/Alog_assert "read xattr on a snapshot"
5666N/Alog_onexit cleanup
5354N/A
5354N/A# create a file, and an xattr on it
5354N/Alog_must touch $TESTDIR/myfile.$$
5354N/Acreate_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
880N/A
880N/A# snapshot the filesystem
log_must zfs snapshot $TESTPOOL/$TESTFS@snap
# check for the xattr on the snapshot
verify_xattr $TESTDIR/.zfs/snapshot/snap/myfile.$$ passwd /etc/passwd
log_pass "read xattr on a snapshot"