Skip to content

Commit

Permalink
Disable 90-zfs.rules for test suite
Browse files Browse the repository at this point in the history
When running the zconfig.sh, zpios-sanity.sh, and zfault.sh
from the installed packages the 90-zfs.rules can cause failures.
These will occur because the test suite assumes it has full
control over loading/unloading the module stack.  If the stack
gets asynchronously loaded by the udev rule the test suite
will treat it as a failure.  Resolve the issue by disabling
the offending rule during the tests and enabling it on exit.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
  • Loading branch information
behlendorf committed Oct 11, 2011
1 parent 86f35f3 commit 5cbf6db
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/common.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ libexecdir=@libexecdir@
pkglibexecdir=${libexecdir}/@PACKAGE@
bindir=@bindir@
sbindir=@sbindir@
udevdir=@udevdir@
udevruledir=@udevruledir@
sysconfdir=@sysconfdir@

ETCDIR=${ETCDIR:-/etc}
DEVDIR=${DEVDIR:-/dev/disk/zpool}
Expand Down Expand Up @@ -113,6 +116,19 @@ skip() {
echo -e "${COLOR_BROWN}Skip${COLOR_RESET}"
}

init() {
# Disable the udev rule 90-zfs.rules to prevent the zfs module
# stack from being loaded due to the detection of a zfs device.
# This is important because the test scripts require full control
# over when and how the modules are loaded/unloaded. A trap is
# set to ensure the udev rule is correctly replaced on exit.
local RULE=${udevruledir}/90-zfs.rules
if test -e ${RULE}; then
trap "mv ${RULE}.disabled ${RULE}; exit $?" INT TERM EXIT
mv ${RULE} ${RULE}.disabled
fi
}

spl_dump_log() {
${SYSCTL} -w kernel.spl.debug.dump=1 &>/dev/null
local NAME=`dmesg | tail -n 1 | cut -f5 -d' '`
Expand Down
3 changes: 3 additions & 0 deletions scripts/zconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ if [ $(id -u) != 0 ]; then
die "Must run as root"
fi

# Initialize the test suite
init

# Perform pre-cleanup is requested
if [ ${CLEANUP} ]; then
${ZFS_SH} -u
Expand Down
3 changes: 3 additions & 0 deletions scripts/zfault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ if [ $(id -u) != 0 ]; then
die "Must run as root"
fi

# Initialize the test suite
init

# Perform pre-cleanup is requested
if [ ${CLEANUP} ]; then
${ZFS_SH} -u
Expand Down
3 changes: 3 additions & 0 deletions scripts/zpios-sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ if [ $(id -u) != 0 ]; then
die "Must run as root"
fi

# Initialize the test suite
init

# Perform pre-cleanup is requested
if [ ${CLEANUP} ]; then
${ZFS_SH} -u
Expand Down

0 comments on commit 5cbf6db

Please sign in to comment.