mirror of
https://github.com/opnsense/src.git
synced 2026-04-15 14:29:58 -04:00
It was originally written by Sun as part of the STF (Solaris test framework). They open sourced it in OpenSolaris, then HighCloud partially ported it to FreeBSD, and Spectra Logic finished the port. We also added many testcases, fixed many broken ones, and converted them all to the ATF framework. We've had help along the way from avg, araujo, smh, and brd. By default most of the tests are disabled. Set the disks Kyua variable to enable them. Submitted by: asomers, will, justing, ken, brd, avg, araujo, smh Sponsored by: Spectra Logic Corp, HighCloud
113 lines
2.8 KiB
Bash
113 lines
2.8 KiB
Bash
#!/usr/bin/env ksh93
|
|
# vim: filetype=sh
|
|
# $FreeBSD$
|
|
|
|
# Add test-specific binaries to PATH
|
|
export PATH=${STF_SUITE}/bin:${PATH}
|
|
export TMPDIR=${TMPDIR-/tmp}
|
|
|
|
# Set default value of TMPDIR
|
|
export TMPDIR=${TMPDIR-/tmp}
|
|
|
|
# Define run length constants
|
|
export RT_LONG="3"
|
|
export RT_MEDIUM="2"
|
|
export RT_SHORT="1"
|
|
|
|
# Define macro for zone test
|
|
export ZONE_POOL="zonepool"
|
|
export ZONE_CTR="zonectr"
|
|
|
|
# Test Suite Specific Commands
|
|
export DEVNAME2DEVID="devname2devid"
|
|
export FILE_WRITE="file_write"
|
|
export FILE_CHECK="file_check"
|
|
export LARGEST_FILE="largest_file"
|
|
export MMAPWRITE="mmapwrite"
|
|
export MKFILE="mkfile"
|
|
export READMMAP="readmmap"
|
|
export FILE_TRUNC="file_trunc"
|
|
export CHG_USR_EXEC="chg_usr_exec"
|
|
export MKTREE="mktree"
|
|
export RANDFREE_FILE="randfree_file"
|
|
export DIR_RD_UPDATE="dir_rd_update"
|
|
export RM_LNKCNT_ZERO_FILE="rm_lnkcnt_zero_file"
|
|
export RENAME_DIR="rename_dir"
|
|
|
|
# ensure we're running in the C locale, since
|
|
# localised messages may result in test failures
|
|
export LC_ALL="C"
|
|
export LANG="C"
|
|
|
|
#
|
|
# pattern to ignore from 'zpool list'.
|
|
#
|
|
export NO_POOLS="no pools available"
|
|
|
|
# pattern to ignore from 'zfs list'.
|
|
export NO_DATASETS="no datasets available"
|
|
|
|
export TEST_BASE_DIR="/"
|
|
|
|
# Default to compression ON
|
|
export COMPRESSION_PROP=on
|
|
|
|
# Default to using the checksum
|
|
export CHECKSUM_PROP=on
|
|
|
|
# some common variables used by test scripts :
|
|
|
|
export TESTCASE_ID=${TESTCASE_ID:-$$}
|
|
# some test pool names
|
|
export TESTPOOL=testpool.${TESTCASE_ID}
|
|
export TESTPOOL1=testpool1.${TESTCASE_ID}
|
|
export TESTPOOL2=testpool2.${TESTCASE_ID}
|
|
export TESTPOOL3=testpool3.${TESTCASE_ID}
|
|
|
|
# some test file system names
|
|
export TESTCTR=testctr${TESTCASE_ID}
|
|
export TESTFS=testfs.${TESTCASE_ID}
|
|
export TESTFS1=testfs1.${TESTCASE_ID}
|
|
export TESTFS2=testfs2.${TESTCASE_ID}
|
|
export TESTFS3=testfs3.${TESTCASE_ID}
|
|
|
|
# some test directory names
|
|
export TESTDIR=${TEST_BASE_DIR%%/}/testdir${TESTCASE_ID}
|
|
export TESTDIR0=${TEST_BASE_DIR%%/}/testdir0${TESTCASE_ID}
|
|
export TESTDIR1=${TEST_BASE_DIR%%/}/testdir1${TESTCASE_ID}
|
|
export TESTDIR2=${TEST_BASE_DIR%%/}/testdir2${TESTCASE_ID}
|
|
|
|
# Default to limit disks to be checked
|
|
export MAX_FINDDISKSNUM=100
|
|
|
|
# For iscsi target support
|
|
export ISCSITGTFILE=$TMPDIR/iscsitgt_file
|
|
export ISCSITGT_FMRI=svc:/system/iscsitgt:default
|
|
|
|
if [ -n "$SVCS" ]; then
|
|
export AUTO_SNAP=$($SVCS -a | $GREP auto-snapshot | $GREP online | $AWK '{print $3}')
|
|
fi
|
|
|
|
# zfs upgrade should output the first line as:
|
|
# This system is currently running ZFS filesystem version 2.
|
|
# .
|
|
|
|
ZFS_VERSION=
|
|
$ZFS upgrade -v > /dev/null 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
export ZFS_VERSION=$($ZFS upgrade | $HEAD -1 | $AWK '{print $NF}' \
|
|
| $SED -e 's/\.//g')
|
|
fi
|
|
|
|
if [ -n "$ZFS_VERSION" ]; then
|
|
i=1
|
|
ZFS_ALL_VERSIONS=""
|
|
while [ "$i" -le "$ZFS_VERSION" ]; do
|
|
eval 'export ZFS_VERSION_$i="v${i}-fs"'
|
|
ZFS_ALL_VERSIONS="$ZFS_ALL_VERSIONS $i"
|
|
i=$(( i + 1 ))
|
|
done
|
|
export ZFS_ALL_VERSIONS
|
|
fi
|
|
|
|
$TRUE
|