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