xref: /illumos-gate/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_001.ksh (revision 96c8483a3fb53529bbf410957b0ad69cfb5d9229)
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_001
29#
30# DESCRIPTION:
31# Verify creating,reading and writing xattrs on smbfs works as expected
32#
33# STRATEGY:
34#	1. Create an xattr on a file using runat
35#	2. Read an empty xattr directory
36#       3. Write the xattr using runat and cat
37#	3. Read the xattr using runat
38#	4. Delete the xattr
39#	5. List the xattr namespace successfully, checking for deletion
40#
41
42. $STF_SUITE/include/libtest.ksh
43
44tc_id=xattr_001
45tc_desc="Verify creating,reading and writing xattrs on smbfs works as expected"
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"
63	return
64else
65	cti_report "PASS: smbmount can mount the public share"
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
75cti_execute_cmd "touch $TMNT/test_file"
76create_xattr $TMNT/test_file passwd /etc/passwd
77verify_write_xattr $TMNT/test_file passwd
78delete_xattr $TMNT/test_file passwd
79
80smbmount_clean $TMNT
81cti_pass "$tc_id: PASS"
82