Retire legacy test infrastructure

* Removed zpios kmod, utility, headers and man page.

* Removed unused scripts zpios-profile/*, zpios-test/*,
  zpool-config/*, smb.sh, zpios-sanity.sh, zpios-survey.sh,
  zpios.sh, and zpool-create.sh.

* Removed zfs-script-config.sh.in.  When building 'make' generates
  a common.sh with in-tree path information from the common.sh.in
  template.  This file and sourced by the test scripts and used
  for in-tree testing, it is not included in the packages.  When
  building packages 'make install' uses the same template to
  create a new common.sh which is appropriate for the packaging.

* Removed unused functions/variables from scripts/common.sh.in.
  Only minimal path information and configuration environment
  variables remain.

* Removed unused scripts from scripts/ directory.

* Remaining shell scripts in the scripts directory updated to
  cleanly pass shellcheck and added to checked scripts.

* Renamed tests/test-runner/cmd/ to tests/test-runner/bin/ to
  match install location name.

* Removed last traces of the --enable-debug-dmu-tx configure
  options which was retired some time ago.

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6509
This commit is contained in:
Brian Behlendorf
2017-08-15 17:26:38 -07:00
committed by GitHub
parent 70322be8dc
commit c8f9061fc7
88 changed files with 605 additions and 8188 deletions
+169 -24
View File
@@ -1,19 +1,34 @@
#!/bin/bash
#!/bin/sh
#
# A simple script to load/unload the ZFS module stack.
#
# A simple script to simply the loading/unloading the ZFS module stack.
basedir=$(dirname "$0")
BASE_DIR=$(dirname "$0")
SCRIPT_COMMON=common.sh
if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then
. "${basedir}/${SCRIPT_COMMON}"
if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then
. "${BASE_DIR}/${SCRIPT_COMMON}"
else
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
fi
# shellcheck disable=SC2034
PROG=zfs.sh
UNLOAD=
VERBOSE="no"
UNLOAD="no"
ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid}
LDMOD=${LDMOD:-/sbin/modprobe}
KMOD_ZLIB_DEFLATE=${KMOD_ZLIB_DEFLATE:-zlib_deflate}
KMOD_ZLIB_INFLATE=${KMOD_ZLIB_INFLATE:-zlib_inflate}
KMOD_SPL=${KMOD_SPL:-spl}
KMOD_SPLAT=${KMOD_SPLAT:-splat}
KMOD_ZAVL=${KMOD_ZAVL:-zavl}
KMOD_ZNVPAIR=${KMOD_ZNVPAIR:-znvpair}
KMOD_ZUNICODE=${KMOD_ZUNICODE:-zunicode}
KMOD_ZCOMMON=${KMOD_ZCOMMON:-zcommon}
KMOD_ICP=${KMOD_ICP:-icp}
KMOD_ZFS=${KMOD_ZFS:-zfs}
usage() {
cat << EOF
@@ -27,13 +42,6 @@ OPTIONS:
-h Show this message
-v Verbose
-u Unload modules
MODULE-OPTIONS:
Must be of the from module="options", for example:
$0 zfs="zfs_prefetch_disable=1"
$0 zfs="zfs_prefetch_disable=1 zfs_mdcomp_disable=1"
EOF
}
@@ -44,11 +52,10 @@ while getopts 'hvu' OPTION; do
exit 1
;;
v)
# shellcheck disable=SC2034
VERBOSE=1
VERBOSE="yes"
;;
u)
UNLOAD=1
UNLOAD="yes"
;;
?)
usage
@@ -57,20 +64,158 @@ while getopts 'hvu' OPTION; do
esac
done
kill_zed() {
if [ -f "$ZED_PIDFILE" ]; then
PID=$(cat "$ZED_PIDFILE")
kill "$PID"
fi
}
check_modules() {
local LOADED_MODULES=""
local MISSING_MODULES=""
for KMOD in $KMOD_SPL $KMOD_SPLAT $KMOD_ZAVL $KMOD_ZNVPAIR \
$KMOD_ZUNICODE $KMOD_ZCOMMON $KMOD_ICP $KMOD_ZFS; do
NAME=$(basename "$KMOD" .ko)
if lsmod | egrep -q "^${NAME}"; then
LOADED_MODULES="$LOADED_MODULES\t$NAME\n"
fi
if ! modinfo "$KMOD" >/dev/null 2>&1; then
MISSING_MODULES="$MISSING_MODULES\t${KMOD}\n"
fi
done
if [ -n "$LOADED_MODULES" ]; then
printf "Unload the kernel modules by running '%s -u':\n" "$PROG"
printf "%b" "$LOADED_MODULES"
exit 1
fi
if [ -n "$MISSING_MODULES" ]; then
printf "The following kernel modules can not be found:\n"
printf "%b" "$MISSING_MODULES"
exit 1
fi
return 0
}
load_module() {
local KMOD=$1
FILE=$(modinfo "$KMOD" | awk '/^filename:/ {print $2}')
VERSION=$(modinfo "$KMOD" | awk '/^version:/ {print $2}')
if [ "$VERBOSE" = "yes" ]; then
echo "Loading: $FILE ($VERSION)"
fi
$LDMOD "$KMOD" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Failed to load $KMOD"
return 1
fi
return 0
}
load_modules() {
mkdir -p /etc/zfs
modprobe "$KMOD_ZLIB_DEFLATE" >/dev/null
modprobe "$KMOD_ZLIB_INFLATE" >/dev/null
for KMOD in $KMOD_SPL $KMOD_SPLAT $KMOD_ZAVL $KMOD_ZNVPAIR \
$KMOD_ZUNICODE $KMOD_ZCOMMON $KMOD_ICP $KMOD_ZFS; do
load_module "$KMOD" || return 1
done
if [ "$VERBOSE" = "yes" ]; then
echo "Successfully loaded ZFS module stack"
fi
return 0
}
unload_module() {
local KMOD=$1
NAME=$(basename "$KMOD" .ko)
FILE=$(modinfo "$KMOD" | awk '/^filename:/ {print $2}')
VERSION=$(modinfo "$KMOD" | awk '/^version:/ {print $2}')
if [ "$VERBOSE" = "yes" ]; then
echo "Unloading: $KMOD ($VERSION)"
fi
rmmod "$NAME" || echo "Failed to unload $NAME"
return 0
}
unload_modules() {
for KMOD in $KMOD_ZFS $KMOD_ICP $KMOD_ZCOMMON $KMOD_ZUNICODE \
$KMOD_ZNVPAIR $KMOD_ZAVL $KMOD_SPLAT $KMOD_SPL; do
NAME=$(basename "$KMOD" .ko)
USE_COUNT=$(lsmod | egrep "^${NAME} " | awk '{print $3}')
if [ "$USE_COUNT" = "0" ] ; then
unload_module "$KMOD" || return 1
fi
done
if [ "$VERBOSE" = "yes" ]; then
echo "Successfully unloaded ZFS module stack"
fi
return 0
}
stack_clear() {
local STACK_MAX_SIZE=/sys/kernel/debug/tracing/stack_max_size
local STACK_TRACER_ENABLED=/proc/sys/kernel/stack_tracer_enabled
if [ -e "$STACK_MAX_SIZE" ]; then
echo 1 >"$STACK_TRACER_ENABLED"
echo 0 >"$STACK_MAX_SIZE"
fi
}
stack_check() {
local STACK_MAX_SIZE=/sys/kernel/debug/tracing/stack_max_size
local STACK_TRACE=/sys/kernel/debug/tracing/stack_trace
local STACK_LIMIT=7600
if [ -e "$STACK_MAX_SIZE" ]; then
STACK_SIZE=$(cat "$STACK_MAX_SIZE")
if [ "$STACK_SIZE" -ge "$STACK_LIMIT" ]; then
echo
echo "Warning: max stack size $STACK_SIZE bytes"
cat "$STACK_TRACE"
fi
fi
}
if [ "$(id -u)" != 0 ]; then
die "Must run as root"
echo "Must run as root"
exit 1
fi
if [ ${UNLOAD} ]; then
if [ "$UNLOAD" = "yes" ]; then
kill_zed
umount -t zfs -a
stack_check
unload_modules
else
stack_clear
check_modules || die "${ERROR}"
load_modules "$@" || die "Failed to load modules"
wait_udev /dev/zfs 30 || die "'/dev/zfs' was not created"
check_modules
load_modules "$@"
udevadm trigger
udevadm settle
fi
exit 0