-[ -n "${TESTDIR}" ] || usage "TESTDIR env variable must be set"
-
-# Set up some environment for normal teuthology test setup.
-# This really should not be necessary but I found it was.
-export CEPH_ARGS="--conf ${TESTDIR}/ceph.conf"
-export CEPH_ARGS="${CEPH_ARGS} --keyring ${TESTDIR}/data/client.0.keyring"
-export CEPH_ARGS="${CEPH_ARGS} --name client.0"
-
-export LD_LIBRARY_PATH="${TESTDIR}/binary/usr/local/lib:${LD_LIBRARY_PATH}"
-export PATH="${TESTDIR}/binary/usr/local/bin:${PATH}"
-export PATH="${TESTDIR}/binary/usr/local/sbin:${PATH}"
-
-################################################################
-
-# Filesystem-specific mkfs options--set if not supplied
-#export XFS_MKFS_OPTIONS="${XFS_MKFS_OPTIONS:--f -l su=65536}"
-export EXT4_MKFS_OPTIONS="${EXT4_MKFS_OPTIONS:--F}"
-export BTRFS_MKFS_OPTION # No defaults
-
-XFSTESTS_DIR="/var/lib/xfstests" # Where the tests live
-XFSPROGS_DIR="/tmp/cephtest/xfsprogs-install"
-XFSDUMP_DIR="/tmp/cephtest/xfsdump-install"
-export PATH="${XFSPROGS_DIR}/sbin:${XFSDUMP_DIR}/sbin:${PATH}"
-
-# download, build, and install xfstests
-function install_xfstests() {
- arg_count 0 $#
-
- local multiple=""
- local ncpu
-
- pushd "${TESTDIR}"
-
- git clone "${XFSTESTS_REPO}"
-
- cd xfstests
- git checkout "${XFSTESTS_VERSION}"
-
- ncpu=$(getconf _NPROCESSORS_ONLN 2>&1)
- [ -n "${ncpu}" -a "${ncpu}" -gt 1 ] && multiple="-j ${ncpu}"
-
- make realclean
- make ${multiple}
- make -k install
-
- popd
-}
-
-# remove previously-installed xfstests files
-function remove_xfstests() {
- arg_count 0 $#
-
- rm -rf "${TESTDIR}/xfstests"
- rm -rf "${XFSTESTS_DIR}"
-}
-
-# create a host options file that uses the specified devices
-function setup_host_options() {
- arg_count 0 $#
- export MNTDIR="/tmp/cephtest"
-
- # Create mount points for the test and scratch filesystems
- mkdir -p ${MNTDIR}
- local test_dir="$(mktemp -d ${MNTDIR}/test_dir.XXXXXXXXXX)"
- local scratch_dir="$(mktemp -d ${MNTDIR}/scratch_mnt.XXXXXXXXXX)"
-
- # Write a host options file that uses these devices.
- # xfstests uses the file defined by HOST_OPTIONS as the
- # place to get configuration variables for its run, and
- # all (or most) of the variables set here are required.
- export HOST_OPTIONS="$(mktemp ${TESTDIR}/host_options.XXXXXXXXXX)"
- cat > "${HOST_OPTIONS}" <<-!
- # Created by ${PROGNAME} on $(date)
- # HOST_OPTIONS="${HOST_OPTIONS}"
- TEST_DEV="${TEST_DEV}"
- SCRATCH_DEV="${SCRATCH_DEV}"
- TEST_DIR="${test_dir}"
- SCRATCH_MNT="${scratch_dir}"
- FSTYP="${FS_TYPE}"
- export TEST_DEV SCRATCH_DEV TEST_DIR SCRATCH_MNT FSTYP
- #
- export XFS_MKFS_OPTIONS="${XFS_MKFS_OPTIONS}"
- !
-
- # Now ensure we are using the same values
- . "${HOST_OPTIONS}"
-}
-
-# remove the host options file, plus the directories it refers to
-function cleanup_host_options() {
- arg_count 0 $#
-
- rm -rf "${TEST_DIR}" "${SCRATCH_MNT}"
- rm -f "${HOST_OPTIONS}"
-}
-