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 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 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 158if [ "@ASAN_ENABLED@" = "yes" ]; then 159 export ASAN_OPTIONS=abort_on_error=true:halt_on_error=true:allocator_may_return_null=true:disable_coredump=false:detect_stack_use_after_return=true:detect_odr_violation=1 160 161 # TODO 162 # disable memory leaks detection 163 # there are quite many of them and they are not as 164 # destructive to CLI programs as they are to daemons 165 export ASAN_OPTIONS="$ASAN_OPTIONS:detect_leaks=false" 166fi 167 168if [ "@UBSAN_ENABLED@" = "yes" ]; then 169 export UBSAN_OPTIONS=abort_on_error=true:halt_on_error=true:print_stacktrace=true 170fi 171 172 173case $(uname) in 174Linux) 175 unpack_opts="--sparse -xf" 176 pack_opts="--sparse -cf" 177 verbose=" -v" 178 unpack_preserve=" -xpf" 179 pack_preserve=" -cpf" 180 181 ZVOL_DEVDIR="/dev/zvol" 182 ZVOL_RDEVDIR="/dev/zvol" 183 DEV_DSKDIR="/dev" 184 DEV_RDSKDIR="/dev" 185 DEV_MPATHDIR="/dev/mapper" 186 187 ZEDLET_DIR="/var/tmp/zed" 188 ZED_LOG="$ZEDLET_DIR/zed.log" 189 ZED_DEBUG_LOG="$ZEDLET_DIR/zed.debug.log" 190 VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf" 191 VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf" 192 193 NEWFS_DEFAULT_FS="ext2" 194 SLICE_PREFIX="" 195 ;; 196FreeBSD) 197 unpack_opts="xv" 198 pack_opts="cf" 199 verbose="v" 200 unpack_preserve="xpf" 201 pack_preserve="cpf" 202 203 ZVOL_DEVDIR="/dev/zvol" 204 ZVOL_RDEVDIR="/dev/zvol" 205 DEV_DSKDIR="/dev" 206 DEV_RDSKDIR="/dev" 207 DEV_MPATHDIR="/dev/multipath" 208 209 NEWFS_DEFAULT_FS="ufs" 210 SLICE_PREFIX="p" 211 ;; 212*) 213 export AUTO_SNAP=$(svcs -a | \ 214 awk '/auto-snapshot/ && /online/ { print $3 }') 215 # finally, if we're running in a local zone 216 # we take some additional actions 217 if [ "$(zonename 2>/dev/null)" != "global" ]; then 218 reexport_pool 219 fi 220 221 unpack_opts="xv" 222 pack_opts="cf" 223 verbose="v" 224 unpack_preserve="xpf" 225 pack_preserve="cpf" 226 227 ZVOL_DEVDIR="/dev/zvol/dsk" 228 ZVOL_RDEVDIR="/dev/zvol/rdsk" 229 DEV_DSKDIR="/dev/dsk" 230 DEV_RDSKDIR="/dev/rdsk" 231 232 NEWFS_DEFAULT_FS="ufs" 233 SLICE_PREFIX="s" 234 ;; 235esac 236export unpack_opts pack_opts verbose unpack_preserve pack_preserve \ 237 ZVOL_DEVDIR ZVOL_RDEVDIR DEV_DSKDIR DEV_RDSKDIR DEV_MPATHDIR \ 238 ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC \ 239 NEWFS_DEFAULT_FS SLICE_PREFIX 240