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