Add zfs-test package which includes test infrastructure.

This change extends the existing in-tree test infrastructure such
that it can also be run as part of a the installed package.  This
simplifies testing on multiple systems and is generally all around
useful.  The scripts may still be run in-tree and will use the
in-tree build products as long as .script-config exists.
This commit is contained in:
Brian Behlendorf 2009-08-17 21:35:06 -07:00
parent 6857a2e5a0
commit 4f555da51d
26 changed files with 210 additions and 149 deletions

View File

@ -36,21 +36,58 @@ AC_DEFUN([ZFS_AC_DEBUG], [
])
AC_DEFUN([ZFS_AC_CONFIG_SCRIPT], [
SCRIPT_CONFIG=.script-config
rm -f ${SCRIPT_CONFIG}
echo "KERNELSRC=${LINUX}" >>${SCRIPT_CONFIG}
echo "KERNELBUILD=${LINUX_OBJ}" >>${SCRIPT_CONFIG}
echo "KERNELSRCVER=${LINUX_VERSION}" >>${SCRIPT_CONFIG}
echo >>${SCRIPT_CONFIG}
echo "SPLSRC=${SPL}" >>${SCRIPT_CONFIG}
echo "SPLBUILD=${SPL_OBJ}" >>${SCRIPT_CONFIG}
echo "SPLSRCVER=${SPL_VERSION}" >>${SCRIPT_CONFIG}
echo >>${SCRIPT_CONFIG}
echo "TOPDIR=${TOPDIR}" >>${SCRIPT_CONFIG}
echo "BUILDDIR=${BUILDDIR}" >>${SCRIPT_CONFIG}
echo "LIBDIR=${LIBDIR}" >>${SCRIPT_CONFIG}
echo "CMDDIR=${CMDDIR}" >>${SCRIPT_CONFIG}
echo "MODDIR=${MODDIR}" >>${SCRIPT_CONFIG}
cat >.script-config <<EOF
KERNELSRC=${LINUX}
KERNELBUILD=${LINUX_OBJ}
KERNELSRCVER=${LINUX_VERSION}
KERNELMOD=/lib/modules/\${KERNELSRCVER}/kernel
SPLSRC=${SPL}
SPLBUILD=${SPL_OBJ}
SPLSRCVER=${SPL_VERSION}
TOPDIR=${TOPDIR}
BUILDDIR=${BUILDDIR}
LIBDIR=${LIBDIR}
CMDDIR=${CMDDIR}
MODDIR=${MODDIR}
SCRIPTDIR=${SCRIPTDIR}
ZPOOLDIR=\${TOPDIR}/scripts/zpool-config
ZDB=\${CMDDIR}/zdb/zdb
ZFS=\${CMDDIR}/zfs/zfs
ZINJECT=\${CMDDIR}/zinject/zinject
ZPOOL=\${CMDDIR}/zpool/zpool
ZTEST=\${CMDDIR}/ztest/ztest
COMMON_SH=\${SCRIPTDIR}/common.sh
ZFS_SH=\${SCRIPTDIR}/zfs.sh
ZPOOL_CREATE_SH=\${SCRIPTDIR}/zpool-create.sh
LDMOD=/sbin/insmod
KERNEL_MODULES=( \\
\${KERNELMOD}/lib/zlib_deflate/zlib_deflate.ko \\
)
SPL_MODULES=( \\
\${SPLBUILD}/spl/spl.ko \\
)
ZFS_MODULES=( \\
\${MODDIR}/avl/zavl.ko \\
\${MODDIR}/nvpair/znvpair.ko \\
\${MODDIR}/unicode/zunicode.ko \\
\${MODDIR}/zcommon/zcommon.ko \\
\${MODDIR}/zfs/zfs.ko \\
)
MODULES=( \\
\${KERNEL_MODULES[[*]]} \\
\${SPL_MODULES[[*]]} \\
\${ZFS_MODULES[[*]]} \\
)
EOF
])
AC_DEFUN([ZFS_AC_CONFIG], [
@ -59,12 +96,14 @@ AC_DEFUN([ZFS_AC_CONFIG], [
LIBDIR=$TOPDIR/lib
CMDDIR=$TOPDIR/cmd
MODDIR=$TOPDIR/module
SCRIPTDIR=$TOPDIR/scripts
AC_SUBST(TOPDIR)
AC_SUBST(BUILDDIR)
AC_SUBST(LIBDIR)
AC_SUBST(CMDDIR)
AC_SUBST(MODDIR)
AC_SUBST(SCRIPTDIR)
ZFS_CONFIG=all
AC_ARG_WITH([config],

View File

@ -74,7 +74,6 @@ AC_CONFIG_FILES([
module/zcommon/Makefile
module/zfs/Makefile
scripts/Makefile
scripts/zpool-config/Makefile
zfs.spec
zfs-modules.spec
])

View File

@ -1,5 +1,9 @@
SUBDIRS = zpool-config
EXTRA_DIST = common.sh zfs-update.sh zfs.sh zpool-create.sh
pkglibexecdir = $(libexecdir)/@PACKAGE@
nobase_pkglibexec_SCRIPTS = common.sh
nobase_pkglibexec_SCRIPTS += zfs.sh
nobase_pkglibexec_SCRIPTS += zpool-create.sh
nobase_pkglibexec_SCRIPTS += zpool-config/*
EXTRA_DIST = zfs-update.sh $(nobase_pkglibexec_SCRIPTS)
ZFS=${top_srcdir}/scripts/zfs.sh
ZTEST=${top_builddir}/cmd/ztest/ztest

View File

@ -1,24 +1,41 @@
#!/bin/bash
#
# A simple script to simply the loading/unloading the ZFS module
# stack. It should probably be considered a first step towards
# a full ZFS init script when that is needed.
#
# Common support functions for testing scripts. If a .script-config
# files is available it will be sourced so in-tree kernel modules and
# utilities will be used. If no .script-config can be found then the
# installed kernel modules and utilities will be used.
if [ ! -f ../.script-config ]; then
echo "You must build your source tree"
exit 1
SCRIPT_CONFIG=.script-config
if [ -f ../${SCRIPT_CONFIG} ]; then
. ../${SCRIPT_CONFIG}
else
MODULES=(zlib_deflate spl zavl znvpair zunicode zcommon zfs)
fi
. ../.script-config
PROG="<define PROG>"
VERBOSE=
VERBOSE_FLAG=
DUMP_LOG=
ERROR=
MODULES=()
LOSETUP=/sbin/losetup
ZPOOLDIR=${ZPOOLDIR:-/usr/libexec/zfs/zpool-config}
ZDB=${ZDB:-/usr/sbin/zdb}
ZFS=${ZFS:-/usr/sbin/zfs}
ZINJECT=${ZINJECT:-/usr/sbin/zinject}
ZPOOL=${ZPOOL:-/usr/sbin/zpool}
ZTEST=${ZTEST:-/usr/sbin/ztest}
COMMON_SH=${COMMON_SH:-/usr/libexec/zfs/common.sh}
ZFS_SH=${ZFS_SH:-/usr/libexec/zfs/zfs.sh}
ZPOOL_CREATE_SH=${ZPOOL_CREATE_SH:-/usr/libexec/zfs/zpool-create.sh}
LDMOD=${LDMOD:-/sbin/modprobe}
LSMOD=${LSMOD:-/sbin/lsmod}
RMMOD=${RMMOD:-/sbin/rmmod}
INFOMOD=${INFOMOD:-/sbin/modinfo}
LOSETUP=${LOSETUP:-/sbin/losetup}
SYSCTL=${SYSCTL:-/sbin/sysctl}
die() {
echo -e "${PROG}: $1" >&2
@ -32,7 +49,7 @@ msg() {
}
spl_dump_log() {
sysctl -w kernel.spl.debug.dump=1 &>/dev/null
${SYSCTL} -w kernel.spl.debug.dump=1 &>/dev/null
local NAME=`dmesg | tail -n 1 | cut -f5 -d' '`
${SPLBUILD}/cmd/spl ${NAME} >${NAME}.log
echo
@ -49,11 +66,11 @@ check_modules() {
for MOD in ${MODULES[*]}; do
local NAME=`basename $MOD .ko`
if /sbin/lsmod | egrep -q "^${NAME}"; then
if ${LSMOD} | egrep -q "^${NAME}"; then
LOADED_MODULES=(${NAME} ${LOADED_MODULES[*]})
fi
if [ ! -f ${MOD} ]; then
if [ ${INFOMOD} ${MOD} 2>/dev/null ]; then
MISSING_MODULES=("\t${MOD}\n" ${MISSING_MODULES[*]})
fi
done
@ -78,10 +95,10 @@ load_module() {
local NAME=`basename $1 .ko`
if [ ${VERBOSE} ]; then
echo "Loading $NAME ($@)"
echo "Loading ${NAME} ($@)"
fi
/sbin/insmod $* || ERROR="Failed to load $1" return 1
${LDMOD} $* || ERROR="Failed to load $1" return 1
return 0
}
@ -114,10 +131,10 @@ unload_module() {
local NAME=`basename $1 .ko`
if [ ${VERBOSE} ]; then
echo "Unloading $NAME ($@)"
echo "Unloading ${NAME} ($@)"
fi
/sbin/rmmod $NAME || ERROR="Failed to unload $NAME" return 1
${RMMOD} ${NAME} || ERROR="Failed to unload ${NAME}" return 1
return 0
}
@ -129,7 +146,7 @@ unload_modules() {
for MOD in ${MODULES_REVERSE[*]}; do
local NAME=`basename ${MOD} .ko`
if /sbin/lsmod | egrep -q "^${NAME}"; then
if ${LSMOD} | egrep -q "^${NAME}"; then
if [ "${DUMP_LOG}" -a ${NAME} = "spl" ]; then
spl_dump_log

View File

@ -1,35 +1,18 @@
#!/bin/bash
#
# A simple script to simply the loading/unloading the ZFS module
# stack. It should probably be considered a first step towards
# a full ZFS init script when that is needed.
#
# A simple script to simply the loading/unloading the ZFS module stack.
SCRIPT_COMMON=common.sh
if [ -f ./${SCRIPT_COMMON} ]; then
. ./${SCRIPT_COMMON}
elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then
. /usr/libexec/zfs/${SCRIPT_COMMON}
else
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
fi
. ./common.sh
PROG=zfs.sh
KMOD=/lib/modules/${KERNELSRCVER}/kernel
KERNEL_MODULES=( \
$KMOD/lib/zlib_deflate/zlib_deflate.ko \
)
SPL_MODULES=( \
${SPLBUILD}/spl/spl.ko \
)
ZFS_MODULES=( \
${MODDIR}/avl/zavl.ko \
${MODDIR}/nvpair/znvpair.ko \
${MODDIR}/unicode/zunicode.ko \
${MODDIR}/zcommon/zcommon.ko \
${MODDIR}/zfs/zfs.ko \
)
MODULES=( \
${KERNEL_MODULES[*]} \
${SPL_MODULES[*]} \
${ZFS_MODULES[*]} \
)
UNLOAD=
usage() {
cat << EOF
@ -55,8 +38,6 @@ $0 spl="spl_debug_mask=0"
EOF
}
UNLOAD=
while getopts 'hvud' OPTION; do
case $OPTION in
h)

View File

@ -1 +0,0 @@
EXTRA_DIST = *.sh

View File

@ -16,13 +16,13 @@ zpool_create() {
die "Error $? creating ${FILE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} || exit 1
msg ${ZPOOL} create ${ZPOOL_NAME} ${FILES}
${ZPOOL} create ${ZPOOL_NAME} ${FILES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
msg "Removing ${FILE}"

View File

@ -17,15 +17,15 @@ zpool_create() {
die "Error $? creating ${FILE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \
msg ${ZPOOL} create ${ZPOOL_NAME} \
mirror ${FILES_M1} mirror ${FILES_M2}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \
${ZPOOL} create ${ZPOOL_NAME} \
mirror ${FILES_M1} mirror ${FILES_M2} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
msg "Removing ${FILE}"

View File

@ -16,13 +16,13 @@ zpool_create() {
die "Error $? creating ${FILE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${FILES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${FILES} || exit 1
msg ${ZPOOL} create ${ZPOOL_NAME} raidz ${FILES}
${ZPOOL} create ${ZPOOL_NAME} raidz ${FILES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
msg "Removing ${FILE}"

View File

@ -16,13 +16,13 @@ zpool_create() {
die "Error $? creating ${FILE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${FILES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${FILES} || exit 1
msg ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${FILES}
${ZPOOL} create ${ZPOOL_NAME} raidz2 ${FILES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
msg "Removing ${FILE}"

View File

@ -6,11 +6,11 @@
DEVICES="/dev/hda"
zpool_create() {
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} || exit 1
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
}

View File

@ -21,13 +21,13 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} || exit 1
msg ${ZPOOL} create ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${ZPOOL_NAME} ${DEVICES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -34,15 +34,15 @@ zpool_create() {
DEVICES_M2="${DEVICES_M2} ${DEVICE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \
msg ${ZPOOL} create ${ZPOOL_NAME} \
mirror ${DEVICES_M1} mirror ${DEVICES_M2}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \
${ZPOOL} create ${ZPOOL_NAME} \
mirror ${DEVICES_M1} mirror ${DEVICES_M2}
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -21,13 +21,13 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${DEVICES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${DEVICES} || exit 1
msg ${ZPOOL} create ${ZPOOL_NAME} raidz ${DEVICES}
${ZPOOL} create ${ZPOOL_NAME} raidz ${DEVICES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -21,13 +21,13 @@ zpool_create() {
DEVICES="${DEVICES} ${DEVICE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${DEVICES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1
msg ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${DEVICES}
${ZPOOL} create ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`

View File

@ -6,11 +6,11 @@
DEVICES="/dev/sda"
zpool_create() {
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} || exit 1
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
}

View File

@ -16,11 +16,11 @@ zpool_create() {
let S_IDX=S_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${STRIPES[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${STRIPES[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${STRIPES[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${STRIPES[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -43,11 +43,11 @@ zpool_create() {
let M_IDX=M_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -36,11 +36,11 @@ zpool_create() {
let M_IDX=M_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -29,11 +29,11 @@ zpool_create() {
let M_IDX=M_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -33,11 +33,11 @@ zpool_create() {
let Z_IDX=Z_IDX+1
done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]}
${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME}
}

View File

@ -1,6 +1,14 @@
#!/bin/bash
. ./common.sh
SCRIPT_COMMON=common.sh
if [ -f ./${SCRIPT_COMMON} ]; then
. ./${SCRIPT_COMMON}
elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then
. /usr/libexec/zfs/${SCRIPT_COMMON}
else
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
fi
PROG=zpool-create.sh
usage() {
@ -29,7 +37,7 @@ check_config() {
local NAME=`basename ${ZPOOL_CONFIG} .sh`
ERROR="Unknown config '${NAME}', available configs are:\n"
for CFG in `ls ${TOPDIR}/scripts/zpool-config/`; do
for CFG in `ls ${ZPOOLDIR}/ | grep ".sh"`; do
local NAME=`basename ${CFG} .sh`
ERROR="${ERROR}${NAME}\n"
done
@ -40,7 +48,7 @@ check_config() {
return 0
}
ZPOOL_CONFIG=zpool_config.sh
ZPOOL_CONFIG=unknown
ZPOOL_NAME=tank
ZPOOL_DESTROY=
ZPOOL_OPTIONS=""
@ -56,7 +64,7 @@ while getopts 'hvc:p:dl:s:' OPTION; do
VERBOSE=1
;;
c)
ZPOOL_CONFIG=${TOPDIR}/scripts/zpool-config/${OPTARG}.sh
ZPOOL_CONFIG=${ZPOOLDIR}/${OPTARG}.sh
;;
p)
ZPOOL_NAME=${OPTARG}
@ -92,27 +100,27 @@ else
if [ "${ZPOOL_OPTIONS}" ]; then
if [ ${VERBOSE} ]; then
echo
echo "${CMDDIR}/zpool/zpool ${ZPOOL_OPTIONS} ${ZPOOL_NAME}"
echo "${ZPOOL} ${ZPOOL_OPTIONS} ${ZPOOL_NAME}"
fi
${CMDDIR}/zpool/zpool ${ZPOOL_OPTIONS} ${ZPOOL_NAME} || exit 1
${ZPOOL} ${ZPOOL_OPTIONS} ${ZPOOL_NAME} || exit 1
fi
if [ "${ZFS_OPTIONS}" ]; then
if [ ${VERBOSE} ]; then
echo
echo "${CMDDIR}/zfs/zfs ${ZFS_OPTIONS} ${ZPOOL_NAME}"
echo "${ZFS} ${ZFS_OPTIONS} ${ZPOOL_NAME}"
fi
${CMDDIR}/zfs/zfs ${ZFS_OPTIONS} ${ZPOOL_NAME} || exit 1
${ZFS} ${ZFS_OPTIONS} ${ZPOOL_NAME} || exit 1
fi
if [ ${VERBOSE} ]; then
echo
echo "zpool list"
${CMDDIR}/zpool/zpool list || exit 1
${ZPOOL} list || exit 1
echo
echo "zpool status ${ZPOOL_NAME}"
${CMDDIR}/zpool/zpool status ${ZPOOL_NAME} || exit 1
${ZPOOL} status ${ZPOOL_NAME} || exit 1
fi
fi

View File

@ -29,6 +29,16 @@ BuildRequires: zlib-devel
The %{name}-devel package contains the header files needed for building
additional applications against the %{name} libraries.
%package test
Summary: ZFS File System Test Infrastructure
Group: Utilities/System
%description test
The %{name}-test package contains a test infrastructure for zpios which
can be used to simplfy the benchmarking of various hardware and software
configurations. The test infrastructure additionally integrates with
various system profiling tools to facilitate an in depth analysis.
%prep
%setup
%build
@ -53,5 +63,9 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%{_includedir}/*
%files test
%defattr(-,root,root)
%{_libexecdir}/@PACKAGE@/*
%post
%postun