Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

#!/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