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