1#!/bin/sh 2 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 http://www.opensolaris.org/os/licensing. 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 24# 25# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 26# Use is subject to license terms. 27# 28 29# 30# Copyright (c) 2016 by Delphix. All rights reserved. 31# Copyright (c) 2017 Lawrence Livermore National Security, LLC. 32# 33 34. $STF_SUITE/include/commands.cfg 35 36# ZFS Directories 37export ZEDLET_ETC_DIR=${ZEDLET_ETC_DIR:-@sysconfdir@/zfs/zed.d} 38export ZEDLET_LIBEXEC_DIR=${ZEDLET_LIBEXEC_DIR:-@zfsexecdir@/zed.d} 39export ZPOOL_SCRIPT_DIR=${ZPOOL_SCRIPT_DIR:-@sysconfdir@/zfs/zpool.d} 40 41# Define run length constants 42export RT_LONG="3" 43export RT_MEDIUM="2" 44export RT_SHORT="1" 45 46# Define macro for zone test 47export ZONE_POOL="zonepool" 48export ZONE_CTR="zonectr" 49 50# ensure we're running in the C locale, since 51# localised messages may result in test failures 52export LC_ALL="C" 53export LANG="C" 54 55# 56# pattern to ignore from 'zpool list'. 57# 58export NO_POOLS="no pools available" 59 60# pattern to ignore from 'zfs list'. 61export NO_DATASETS="no datasets available" 62 63# Default directory used for test files 64# NOTE: remove trailing "/", some functions rely on this to do pattern matching 65export TEST_BASE_DIR="$(dirname ${FILEDIR:-/var/tmp}/.)" 66 67# Default to compression ON 68export COMPRESSION_PROP=on 69 70# Default to using the checksum 71export CHECKSUM_PROP=on 72 73# some common variables used by test scripts : 74export FIO_SCRIPTS=$STF_SUITE/tests/perf/fio 75export PERF_SCRIPTS=$STF_SUITE/tests/perf/scripts 76 77# some test pool names 78export TESTPOOL=testpool 79export TESTPOOL1=testpool1 80export TESTPOOL2=testpool2 81export TESTPOOL3=testpool3 82export PERFPOOL=perfpool 83 84# some test file system names 85export TESTFS=testfs 86export TESTFS1=testfs1 87export TESTFS2=testfs2 88export TESTFS3=testfs3 89 90# some test directory names 91export TESTDIR=${TEST_BASE_DIR%%/}/testdir 92export TESTDIR0=${TEST_BASE_DIR%%/}/testdir0 93export TESTDIR1=${TEST_BASE_DIR%%/}/testdir1 94export TESTDIR2=${TEST_BASE_DIR%%/}/testdir2 95 96# some test sub file system names 97export TESTSUBFS=subfs 98export TESTSUBFS1=subfs1 99export TESTSUBFS2=subfs2 100 101# some temp files 102export TEMPFILE=${TEST_BASE_DIR%%/}/tempfile$$ 103export TEMPFILE0=${TEST_BASE_DIR%%/}/tempfile0$$ 104export TEMPFILE1=${TEST_BASE_DIR%%/}/tempfile1$$ 105export TEMPFILE2=${TEST_BASE_DIR%%/}/tempfile2$$ 106 107export ZFSROOT= 108 109export TESTSNAP=testsnap 110export TESTSNAP1=testsnap1 111export TESTSNAP2=testsnap2 112export TESTCLONE=testclone 113export TESTCLONE1=testclone1 114export TESTCLONE2=testclone2 115export TESTCLCT=testclct 116export TESTCTR=testctr 117export TESTCTR1=testctr1 118export TESTCTR2=testctr2 119export TESTVOL=testvol 120export TESTVOL1=testvol1 121export TESTVOL2=testvol2 122export TESTFILE0=testfile0 123export TESTFILE1=testfile1 124export TESTFILE2=testfile2 125export TESTBKMARK=testbkmark 126 127export LONGPNAME="poolname50charslong_012345678901234567890123456789" 128export LONGFSNAME="fsysname50charslong_012345678901234567890123456789" 129export SNAPFS="$TESTPOOL/$TESTFS@$TESTSNAP" 130export SNAPFS1="$TESTPOOL/$TESTVOL@$TESTSNAP" 131 132export VOLSIZE=150m 133export BIGVOLSIZE=1eb 134 135# Default to limit disks to be checked 136export MAX_FINDDISKSNUM=6 137 138# Default minimum size for file based vdevs in the test suite 139export MINVDEVSIZE=$((256 * 1024 * 1024)) 140 141# Minimum vdev size possible as defined in the OS 142export SPA_MINDEVSIZE=$((64 * 1024 * 1024)) 143 144# For iscsi target support 145export ISCSITGTFILE=/tmp/iscsitgt_file 146export ISCSITGT_FMRI=svc:/system/iscsitgt:default 147 148export ZFS_VERSION=5 149export ZFS_ALL_VERSIONS="1 2 3 4 5" 150 151for i in $ZFS_ALL_VERSIONS; do 152 eval 'export ZFS_VERSION_$i="v${i}-fs"' 153done 154 155export MAX_PARTITIONS=8 156 157case $(uname -o) in 158GNU/Linux) 159 unpack_opts="--sparse -xf" 160 pack_opts="--sparse -cf" 161 verbose=" -v" 162 unpack_preserve=" -xpf" 163 pack_preserve=" -cpf" 164 165 ZVOL_DEVDIR="/dev/zvol" 166 ZVOL_RDEVDIR="/dev/zvol" 167 DEV_DSKDIR="/dev" 168 DEV_RDSKDIR="/dev" 169 DEV_MPATHDIR="/dev/mapper" 170 171 ZEDLET_DIR="/var/tmp/zed" 172 ZED_LOG="$ZEDLET_DIR/zed.log" 173 ZED_DEBUG_LOG="$ZEDLET_DIR/zed.debug.log" 174 VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf" 175 VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf" 176 177 NEWFS_DEFAULT_FS="ext2" 178 SLICE_PREFIX="" 179 ;; 180FreeBSD) 181 unpack_opts="xv" 182 pack_opts="cf" 183 verbose="v" 184 unpack_preserve="xpf" 185 pack_preserve="cpf" 186 187 ZVOL_DEVDIR="/dev/zvol" 188 ZVOL_RDEVDIR="/dev/zvol" 189 DEV_DSKDIR="/dev" 190 DEV_RDSKDIR="/dev" 191 DEV_MPATHDIR="/dev/multipath" 192 193 NEWFS_DEFAULT_FS="ufs" 194 SLICE_PREFIX="p" 195 ;; 196illumos) 197 export AUTO_SNAP=$(svcs -a | \ 198 awk '/auto-snapshot/ && /online/ { print $3 }') 199 # finally, if we're running in a local zone 200 # we take some additional actions 201 if [ "$(zonename 2>/dev/null)" != "global" ]; then 202 reexport_pool 203 fi 204 205 unpack_opts="xv" 206 pack_opts="cf" 207 verbose="v" 208 unpack_preserve="xpf" 209 pack_preserve="cpf" 210 211 ZVOL_DEVDIR="/dev/zvol/dsk" 212 ZVOL_RDEVDIR="/dev/zvol/rdsk" 213 DEV_DSKDIR="/dev/dsk" 214 DEV_RDSKDIR="/dev/rdsk" 215 216 NEWFS_DEFAULT_FS="ufs" 217 SLICE_PREFIX="s" 218 ;; 219esac 220export unpack_opts pack_opts verbose unpack_preserve pack_preserve \ 221 ZVOL_DEVDIR ZVOL_RDEVDIR DEV_DSKDIR DEV_RDSKDIR DEV_MPATHDIR \ 222 ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC \ 223 NEWFS_DEFAULT_FS SLICE_PREFIX 224