xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/setup.ksh (revision ee3960cba1068e12fb032a68c46d74841d9edab3)
1#!/bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3#
4# CDDL HEADER START
5#
6# The contents of this file are subject to the terms of the
7# Common Development and Distribution License (the "License").
8# You may not use this file except in compliance with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or https://opensource.org/licenses/CDDL-1.0.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27#
28# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
29#
30
31. $STF_SUITE/include/libtest.shlib
32. $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
33
34# if we're running NIS, turn it off until we clean up
35# (it can cause useradd to take a long time, hitting our TIMEOUT)
36if is_illumos; then
37	USES_NIS=false
38	if svcs svc:/network/nis/client:default | grep -q online
39	then
40		svcadm disable -t svc:/network/nis/client:default
41		USES_NIS=true
42	fi
43else
44	USES_NIS=false
45fi
46
47# Make sure we use a brand new user for this
48log_must add_group $ZFS_GROUP
49log_must add_user $ZFS_GROUP $ZFS_USER
50
51echo $ZFS_USER > $TEST_BASE_DIR/zfs-xattr-test-user.txt
52echo $USES_NIS > $TEST_BASE_DIR/zfs-xattr-test-nis.txt
53
54DISK=${DISKS%% *}
55default_setup_noexit $DISK
56log_must zfs set compression=off $TESTPOOL
57log_pass "Setup complete"
58