#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
#
-# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# Further, this software is distributed without any warranty that it is
-# free of the rightful claim of any third person regarding infringement
-# or the like. Any license provided herein, whether implied or
-# otherwise, applies only to this software file. Patent licenses, if
-# any, provided herein do not apply to combinations of this program with
-# other software, or any other product whatsoever.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston MA 02111-1307, USA.
-#
-# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
-# Mountain View, CA 94043, or:
-#
-# http://www.sgi.com
-#
-# For further information regarding this notice, see:
-#
-# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
-#
-
# automatic qa system. 31/08/00 dxm@sgi.com
+#
+# Usage: auto_qa start-state [stop-state]
+# Do auto_qa from start-state up to stop-state inclusive
+# or if no stop-state given then do it until reach "done" state.
+#
_log()
{
echo "$*" >&2
echo "$*" >> $LOG
+ sync
}
_fail()
{
if [ "$started" = "1" ]
then
- echo "auto-qa stopped" | wall
- started=0
+ echo "auto-qa stopped" | wall
+ started=0
fi
_log "$*"
# send special email if a cron'd qa run fails
case $state
in
- cron*)
- mail -s "xfs qa status report" $ADMINEMAIL \
- < $LOG 2>&1
+ cron*)
+ mail -s "XFS QA status report" $EMAIL < $LOG 2>&1
;;
esac
exit 1
}
-# configuration (you could tune this)
-
-EXTRA="-xfs-qa"
-VERSION="2.4.0"
-BOOT="/boot"
-SOAK_PASSES="-1"
-SOAK_STRESS="10000"
-SOAK_PROC="3"
+_get_kernel_version()
+{
+ [ -x "$KWORKAREA" ] || return
+ [ -r "$KWORKAREA/Makefile" ] \
+ || _fail "can't read kernel makefile $KWORKAREA/Makefile"
+
+ eval `awk '
+ BEGIN { FS = "[ \t=]+" }
+ /^VERSION =/ { a=$2 }
+ /^PATCHLEVEL =/ { b=$2 }
+ /^SUBLEVEL =/ { c=$2 }
+ /^EXTRAVERSION =/ { d=$2 }
+ END {
+ print "VERSION=" a "." b "." c d " ; SVERSION=" a "." b "." c
+ }
+ ' < $KWORKAREA/Makefile`
+}
# this should be constant
ROOT="$HOME/qa"
HOST=`hostname -s`
-export WORKAREA="$ROOT/linux-xfs"
+if [ ! -z "$CVSROOT" ]; then
+ export WORKAREA="$ROOT/xfs-cmds"
+else
+ [ -z "$WORKAREA" ] && export WORKAREA="$ROOT/xfs-cmds"
+fi
+
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/ptools:/usr/local/bin"
STATE=$ROOT/qa.state
-QADIR="$WORKAREA/cmd/xfstests"
+QADIR="$WORKAREA/xfstests"
SUDO="su -c"
-IMAGE="$BOOT/vmlinuz-$VERSION$EXTRA"
-SYSTEMMAP="$BOOT/System.map-$VERSION$EXTRA"
-CONFIG="$ROOT/$HOST-$VERSION$EXTRA.config"
-MODULES="/lib/modules/$VERSION$EXTRA"
-SELF="$ROOT/auto-qa"
-SELF_UPDATE="cmd/xfstests/tools/auto-qa"
-COMMON_CONFIG="$WORKAREA/cmd/xfstests/common.config"
+CONFIG="$ROOT/$HOST.config"
+COMMON_CONFIG="$QADIR/common/config"
SH="/bin/sh"
LOG="$ROOT/qa.log"
-# need to add auto-qa hosts here
-
-case $HOST
-in
- fuzzy)
- EMAIL="dxm@larry"
- ADMINEMAIL="dxm@larry"
- MODULAR=1
- ;;
- bruce)
- EMAIL="dxm@larry"
- ADMINEMAIL="dxm@larry"
- MODULAR=1
- ;;
- sagan)
- EMAIL="dxm@larry"
- ADMINEMAIL="dxm@larry"
- MODULAR=0
- ;;
- troppo)
- EMAIL="nathans@larry"
- ADMINEMAIL="nathans@larry"
- MODULAR=0
- ;;
- *)
- _fail "auto-qa: no configuration information for host '$HOST'"
- ;;
-esac
-
# do some cleanup on exit
_cleanup()
umount $TEST_DEV &> /dev/null
if [ "$started" = 1 ]
then
- echo "auto-qa stopped" | wall
- started=0
+ echo "auto-qa stopped" | wall
+ started=0
fi
}
status=1
_change_state()
{
new=$1
+
+ # if have state XXXX-state then preserve XXXX-newstate
case $state
in
- *-*)
- case $new
- in
- *-*)
- _set_state $new
- ;;
- *)
- _set_state `echo $state | sed "s/-.*$/-$new/"`
- ;;
- esac
- ;;
- *)
- _set_state $new
- ;;
+ *-*)
+ case $new
+ in
+ *-*)
+ _set_state $new
+ ;;
+ *)
+ _set_state `echo $state | sed "s/-.*$/-$new/"`
+ ;;
+ esac
+ ;;
+ *)
+ _set_state $new
+ ;;
esac
}
_restart()
{
- exec $ROOT/su -c "shutdown -r 2 \"auto-qa rebooting\" &" < /dev/null
+ exec $ROOT/su -c "(shutdown -r now \"auto-qa rebooting\" )&" < /dev/null
}
-_log "*** linux-xfs QA (`date`)"
+_update_workarea()
+{
+ if [ -z "$CVSROOT" ]; then
+ _log " *** p_tupdate"
+ cd "$1"
+ WORKAREA="$1" p_tupdate 2>&1 \
+ || _fail " !!! p_tupdate failed"
+
+ _log " *** non-trunk files"
+ cd "$1"
+ WORKAREA="$1" p_list -c 2>&1 \
+ || _fail " !!! p_list failed"
+ else
+ _log " *** cvs update"
+ cd "$1"
+ cvs -z3 update -d
+ fi
+}
+
+_test_mkfs_xfs()
+{
+ TEST_OPTIONS=""
+ [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
+ TEST_OPTIONS="$TEST_OPTIONS -rrtdev=$TEST_RTDEV"
+ [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
+ TEST_OPTIONS="$TEST_OPTIONS -llogdev=$TEST_LOGDEV"
+ _sudo /sbin/mkfs.xfs -f $TEST_OPTIONS $MKFS_OPTIONS $* $TEST_DEV
+ mkfs_status=$?
+ if [ "$USE_BIG_LOOPFS" = yes ]; then
+ [ -z "$RETAIN_AG_BYTES" ] && RETAIN_AG_BYTES=0
+ _sudo $QADIR/tools/ag-wipe -q -r $RETAIN_AG_BYTES $TEST_DEV
+ fi
+ return $mkfs_status
+}
+
+_test_mount()
+{
+ TEST_OPTIONS=""
+ [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
+ TEST_OPTIONS="$TEST_OPTIONS -ortdev=$TEST_RTDEV"
+ [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
+ TEST_OPTIONS="$TEST_OPTIONS -ologdev=$TEST_LOGDEV"
+ _sudo mount -t xfs $TEST_OPTIONS $MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+}
+
+_i386_install()
+{
+ _sudo cp -f "$KWORKAREA/arch/i386/boot/bzImage" "$IMAGE" 2>&1 \
+ || _fail " !!! install kernel failed"
+ _sudo cp -f "$KWORKAREA/System.map" "$SYSTEMMAP" 2>&1 \
+ || _fail " !!! install kernel failed"
+ if [ -z "$KMODULES" -o "$KMODULES" = yes ]; then
+ _sudo make EXTRAVERSION=-$EXTRA modules_install 2>&1 \
+ || _fail " !!! install modules failed"
+ fi
+
+
+ if [ -z "$KINSTALL" -o "$KINSTALL" = lilo ]; then
+ _log " *** reinit lilo"
+ _sudo /sbin/lilo 2>&1 \
+ || _fail " !!! reinit lilo failed"
+ fi
+}
+
+_i386_restart()
+{
+ if [ -z "$KINSTALL" -o "$KINSTALL" = lilo ]; then
+ _sudo /sbin/lilo -R $EXTRA $KERNEL_OPTIONS 2>&1 \
+ || _fail " !!! lilo failed"
+ fi
+}
+
+_ia64_install()
+{
+ echo not yet implemented
+}
+
+_ia64_restart()
+{
+ echo not yet implemented
+}
+
+_check_kernel()
+{
+ [ -d "$KWORKAREA" ] || _fail " !!! QA kernel workarea \"$KWORKAREA\" not found"
+ [ -r "$CONFIG" ] || _fail " !!! Can't read config file $CONFIG"
+}
+
+
+_log "*** XFS QA (`date`)"
_get_state
case $1
in
cron-init)
- case $state
- in
- *done)
- ;;
- *)
- _fail " !!! cron-init while not in \"*done\" state"
- ;;
- esac
- ;;
+ case $state
+ in
+ *done)
+ ;;
+ *)
+ _fail " !!! cron-init while not in \"*done\" state"
+ ;;
+ esac
+ ;;
cron-restarted)
- # we don't auto restart after reboot, but cron the restart
- # to happen a bit later - it's much easier and safer that way
- if [ $state != "cron-restarted" ]
- then
- _fail " !!! cron-restarted while not in \"cron-restarted\" state"
- fi
- ;;
+ # we don't auto restart after reboot, but cron the restart
+ # to happen a bit later - it's much easier and safer that way
+ if [ "$state" != "cron-restarted" ]
+ then
+ _fail " !!! cron-restarted while not in \"cron-restarted\" state"
+ fi
+ ;;
esac
-if [ "$1" != "" ]
-then
- _set_state $1
-fi
+[ -n "$1" ] && _set_state $1
+[ -n "$2" ] && stop_state=$2
-[ $UID -eq 0 ] && _fail " !!! QA most be run as a normal user"
-[ -d $ROOT ] || _fail " !!! QA root \"$ROOT\" not found"
-[ -d $WORKAREA ] || _fail " !!! QA workarea \"$WORKAREA\" not found"
-[ -r $CONFIG ] || _fail " !!! Can't read config file $CONFIG"
-. $COMMON_CONFIG || _fail " !!! Couldn't source $COMMON_CONFIG"
+[ "$UID" -eq 0 ] && _fail " !!! QA most be run as a normal user"
+[ -d "$ROOT" ] || _fail " !!! QA root \"$ROOT\" not found"
+[ -d "$WORKAREA" ] || _fail " !!! QA workarea \"$WORKAREA\" not found"
+cd $QADIR
+. "$COMMON_CONFIG" || _fail " !!! Couldn't source $COMMON_CONFIG"
+
+_get_kernel_version
+IMAGE="$BOOT/vmlinuz-$EXTRA"
+SYSTEMMAP="$BOOT/System.map-$VERSION-$EXTRA"
+MODULES="/lib/modules/$SVERSION"
cd $ROOT
_get_state
_log " *** state $state start (`date`)"
- _log " (user=$USER, host=$HOST)"
+ _log " (user=$USER, host=$HOST)"
new_state=""
+ start_state=$state
+
case $state
in
- *init)
- echo "" > $ROOT/qa.log
- echo "" > $ROOT/qa.full
- _log "******************************************"
- _log "QA init (`date`)"
- _log "******************************************"
-
- _change_state "inited"
- exec $SH -c "cd $WORKAREA ; p_tupdate $SELF_UPDATE ; chmod +x $SELF_UPDATE ; exec $SELF"
- ;;
-
- *inited)
- _log " *** QA initialized"
- new_state="update"
- ;;
-
- *update)
- _log " *** p_tupdate"
- cd $WORKAREA
- p_tupdate 2>&1 \
- || _fail " !!! p_tupdate failed"
-
- _log " *** p_check/p_purge"
- cd $WORKAREA
- p_check -s | p_purge -yiu 2>&1 \
- || _fail " !!! p_check/p_purge failed"
-
- _log " *** non-trunk files"
- cd $WORKAREA
- p_list -c 2>&1 \
- || _fail " !!! p_list failed"
-
- new_state="clean"
- ;;
-
- *clean)
- # we need to configure or else we might fail to clean
- for pkg in attr acl xfsprogs xfsdump xfstests
- cd $WORKAREA/cmd/$pkg
- _log " *** configure $pkg for clean"
- make configure 2>&1 \
- || _fail " !!! configure $pkg for clean failed"
- _log " *** clean $pkg tools"
- make realclean 2>&1 \
- || _fail " !!! clean $pkg failed"
- done
-
- _log " *** clean quota tools"
- cd $WORKAREA/cmd/quota
- ( rm -f configure ; autoconf ; sh configure ; make clean ) 2>&1 \
- || _fail " !!! clean quota failed"
-
- _log " *** clean linux"
- cd $WORKAREA/linux
- make mrproper 2>&1 \
- || _fail " !!! clean linux failed"
-
- _log " *** install configuration file"
- cp -f $CONFIG $WORKAREA/linux/.config 2>&1 \
- || _fail " !!! failed to install config"
-
- _log " *** remove version file"
- rm -f include/linux/version.h 2>&1 \
- || _fail " !!! failed to clean version"
-
- new_state="reconfig"
- ;;
-
- *reconfig)
-
- _log " *** reconfig kernel"
-
- _change_state "clean" ;# if this fails, we'd better start from scratch
-
- cd $WORKAREA/linux
- # we want to use default options for any new config options.
- echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | \
- make EXTRAVERSION=$EXTRA oldconfig 2>&1 \
- || _fail " !!! reconfig oldconfig failed"
- make EXTRAVERSION=$EXTRA dep 2>&1 \
- || _fail " !!! reconfig dep failed"
-
- new_state="build"
- ;;
-
- *build)
- _log " *** build kernel"
-
- _change_state "clean" ;# if this fails, we'd better start from scratch
-
- cd $WORKAREA/linux
- make -j2 EXTRAVERSION=$EXTRA bzImage 2>&1 \
- || _fail " !!! build bzImage failed"
- make -j2 EXTRAVERSION=$EXTRA modules 2>&1 \
- || _fail " !!! build modules failed"
-
- _log " *** build and install tools"
- for pkg in attr acl xfsprogs xfsdump xfstests
- do
- cd $WORKAREA/cmd/$pkg
-
- # use e-fence - but this will only take effect on configure
- export MALLOCLIB=/usr/lib/libefence.a
- make configure 2>&1 \
- || _fail " !!! configure $pkg failed"
- make default 2>&1 \
- || _fail " !!! build $pkg failed"
-
- _sudo make install install-dev 2>&1 \
- || _fail " !!! install $pkg failed"
- done
-
- _log " *** build and install quota tools"
- cd $WORKAREA/cmd/quota
-
- # use e-fence - but this will only take effect on configure
- export MALLOCLIB=/usr/lib/libefence.a
- ( rm -f configure ; autoconf ; sh configure ; make all ) 2>&1 \
- || _fail " !!! build quota failed"
- _sudo make install 2>&1 \
- || _fail " !!! install quota failed"
-
- new_state="install"
- ;;
-
- *install)
- _log " *** blat old modules"
-
- _sudo rm -rf $MODULES
-
- _log " *** install kernel"
- cd $WORKAREA/linux
- _sudo cp -f $WORKAREA/linux/arch/i386/boot/bzImage $IMAGE 2>&1 \
- || _fail " !!! install kernel failed"
- _sudo cp -f $WORKAREA/linux/System.map $SYSTEMMAP 2>&1 \
- || _fail " !!! install kernel failed"
- _sudo make EXTRAVERSION=$EXTRA modules_install 2>&1 \
- || _fail " !!! install modules failed"
-
- _log " *** reinit lilo"
- _sudo /sbin/lilo 2>&1 \
- || _fail " !!! reinit lilo failed"
- new_state="restart"
- ;;
-
- *restart)
- _log " *** select qa kernel"
- _sudo /sbin/lilo -R linux-xfs-qa 2>&1 \
- || _fail " !!! lilo failed"
-
- _log " *** prepare to restart"
- _change_state "restarted"
-
- _log " *** restarting"
+ *init)
+ echo "" > $ROOT/qa.log
+ echo "" > $ROOT/qa.full
+ _log "******************************************************"
+ _log "QA init $VERSION (`date`)"
+ _log "******************************************************"
+ new_state="updatetools"
+ ;;
+
+ *updatetools)
+ _update_workarea "$WORKAREA"
+ new_state="cleantools"
+ ;;
+
+ *cleantools)
+ # we need to configure or else we might fail to clean
+ for pkg in attr acl xfsprogs xfsdump xfstests
+ do
+ [ -d $WORKAREA/$pkg ] || continue
+ cd $WORKAREA/$pkg
+ _log " *** clean $pkg tools"
+ make realclean 2>&1 \
+ || _fail " !!! clean $pkg failed"
+ done
+ new_state="buildtools"
+ ;;
+
+ *buildtools)
+ _log " *** build and install tools"
+ for pkg in attr acl xfsprogs xfsdump xfstests
+ do
+ [ -d $WORKAREA/$pkg ] || continue
+ cd $WORKAREA/$pkg
+
+ make configure 2>&1 \
+ || _fail " !!! configure $pkg failed"
+ make default 2>&1 \
+ || _fail " !!! build $pkg failed"
+
+ _sudo make install install-dev 2>&1 \
+ || _fail " !!! install $pkg failed"
+
+ # attr and acl now have install-lib targets as well
+ [ "$pkg" = "attr" -o "$pkg" = "acl" ] || continue
+ _sudo make install-lib 2>&1 \
+ || _fail " !!! install $pkg failed"
+ done
+
+ new_state="updatekernel"
+ ;;
+
+ *updatekernel)
+ _check_kernel
+ _update_workarea "$KWORKAREA"
+ new_state="cleankernel"
+ ;;
+
+ *cleankernel)
+ _check_kernel
+ _log " *** clean kernel"
+ cd "$KWORKAREA"
+ make mrproper 2>&1 \
+ || _fail " !!! clean kernel failed"
+
+ _log " *** install configuration file"
+ cp -f $CONFIG "$KWORKAREA/.config" 2>&1 \
+ || _fail " !!! failed to install config"
+
+ _log " *** remove version file"
+ rm -f include/linux/version.h 2>&1 \
+ || _fail " !!! failed to clean version"
+
+ new_state="reconfig"
+ ;;
+
+ *reconfig)
+ _check_kernel
+ _log " *** reconfig kernel"
+
+ # we better start from scratch if this fails
+ _change_state "cleankernel"
+
+ cd "$KWORKAREA"
+ # we want to use default options for any new config options.
+ echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | \
+ make EXTRAVERSION=-$EXTRA oldconfig 2>&1 \
+ || _fail " !!! reconfig oldconfig failed"
+ make EXTRAVERSION=-$EXTRA dep 2>&1 \
+ || _fail " !!! reconfig dep failed"
+
+ new_state="buildkernel"
+ ;;
+
+ *buildkernel)
+ _check_kernel
+ _log " *** build kernel"
+ _log " --- kernel ($IMAGE)"
+ [ -z "$KMODULES" -o "$KMODULES" = yes ] && \
+ _log " --- modules ($MODULES)"
+
+ _change_state "cleankernel" ; # we better start from scratch if this fails
+
+ cd "$KWORKAREA"
+ [ -z "$KTARGET" ] && KTARGET=bzImage
+ [ -z "$KMODULES" -o "$KMODULES" = yes ] && \
+ KTARGET="$KTARGET modules"
+ make -j4 EXTRAVERSION=-$EXTRA $KTARGET 2>&1 \
+ || _fail " !!! build $KTARGET failed"
+ new_state="install"
+ ;;
+
+ *install)
+ _check_kernel
+ _log " *** blat old modules"
+ _sudo rm -rf $MODULES
+
+ _log " *** install kernel"
+ cd "$KWORKAREA"
+ case `uname -m`
+ in
+ i386|i686) _i386_install ;;
+ ia64) _ia64_install ;;
+ esac
+
+ new_state="restart"
+ ;;
+
+ *restart)
+ _log " *** select qa kernel"
+ case `uname -m`
+ in
+ i386|i686) _i386_restart ;;
+ ia64) _ia64_restart ;;
+ esac
+
+ _log " *** prepare to restart"
+ _change_state "restarted"
+
+ _log " *** restarting"
_restart # doesn't return
- ;;
-
- *restarted)
- _log " *** QA reentered after restart"
-
- new_state="check"
- ;;
-
- *check)
- uname=`uname -ar`
- _log " *** uname $uname"
- _log " *** user tools"
- ls -l /sbin/*xfs* /usr/sbin/*xfs* 2>&1
- _log " *** kernel"
- ls -l /boot/*$EXTRA* 2>&1
- _log " *** kernel modules"
- ls -l /lib/modules/$VERSION$EXTRA/kernel/fs/pagebuf/* \
- /lib/modules/$VERSION$EXTRA/kernel/fs/xfs/* \
- /lib/modules/$VERSION$EXTRA/kernel/fs/xfs/support/*
-
- if [ $MODULAR -eq 0 ]
- then
- new_state="reset"
- else
- new_state="probe"
- fi
- ;;
-
- *probe)
- _log " *** modules dependencies"
-
- _sudo depmod -a 2>&1 \
- || _fail " !!! failed to depmod -a"
-
- _log " *** unmounting XFS mounts"
-
- _sudo umount -a -t xfs 2>&1
-
- _log " *** removing modules"
-
- for m in xfsidbg xfs pagebuf kdbm_pg kdbm_vm
- do
- _sudo rmmod $m 2> /dev/null
- done
-
- _log " *** installing modules"
-
+ ;;
+
+ *restarted)
+ _log " *** QA reentered after restart"
+
+ new_state="check"
+ ;;
+
+ *check)
+ uname=`uname -a`
+ _log " *** uname $uname"
+
+ if [ "$MODULAR" -eq 0 ]; then
+ new_state="reset"
+ else
+ new_state="probe"
+ fi
+ ;;
+
+ *probe)
+ _log " *** modules dependencies"
+ _sudo depmod -a 2>&1 \
+ || _fail " !!! failed to depmod -a"
+
+ _log " *** unmounting XFS mounts"
+ _sudo umount -a -t xfs 2>&1
+
+ _log " *** removing modules"
+ for m in xfsidbg xfs kdbm_pg kdbm_vm
+ do
+ _sudo rmmod $m 2> /dev/null
+ done
+
+ _log " *** installing modules"
_sudo modprobe xfs 2>&1 \
- || _fail " !!! failed to modprobe xfs"
-
- new_state="reset"
- ;;
-
- *reset)
-
- _log " *** unmounting TEST_DEV"
-
- _sudo umount $TEST_DEV 2>&1
-
- _log " *** unmounting SCRATCH_DEV"
-
- _sudo umount $SCRATCH_DEV 2>&1
-
- _log " *** clean TEST_DEV"
-
- _sudo mkfs -t xfs -f $TEST_DEV 2>&1 \
- || _fail " !!! failed to mkfs TEST_DEV"
-
- _log " *** mounting TEST_DEV"
-
- _sudo mount -t xfs $TEST_DEV $TEST_DIR 2>&1 \
- || _fail " !!! failed to mount"
-
- new_state="run"
- ;;
-
-
- soak-run)
- cd $QADIR
-
- _log " *** run soak test"
- _sudo ./soak $SOAK_PASSES $SOAK_STRESS $SOAK_PROC\
- || _fail " !!! failed to run soak test"
-
- new_state="done"
- ;;
-
- *run)
- cd $QADIR
-
- _log " *** run tests"
- _sudo ./check -l -g auto 2>&1 | tee $ROOT/qa.out
-
- _log ""
- _log " *** send status mail"
- mail -s "xfs qa status report" $EMAIL < $ROOT/qa.out 2>&1
-
- new_state="done"
- ;;
-
- *done)
- _log "*** QA run complete"
-
- _success
- ;;
-
- *nothing)
- new_state="done"
- _log " *** do nothing"
- ;;
-
- *)
- _fail " !!! unknown state $state"
- ;;
+ || _fail " !!! failed to modprobe xfs"
+
+ new_state="reset"
+ ;;
+
+ *reset)
+
+ _log " *** unmounting TEST_DEV"
+ _sudo umount $TEST_DEV 2>&1
+
+ _log " *** unmounting SCRATCH_DEV"
+ _sudo umount $SCRATCH_DEV 2>&1
+
+ _log " *** clean TEST_DEV"
+ _test_mkfs_xfs 2>&1 \
+ || _fail " !!! failed to mkfs TEST_DEV"
+
+ _log " *** mounting TEST_DEV"
+ _test_mount 2>&1 \
+ || _fail " !!! failed to mount"
+
+ new_state="run"
+ ;;
+
+ soak-run)
+ cd $QADIR
+
+ _log " *** run soak test"
+ _sudo ./soak $SOAK_PASSES $SOAK_STRESS $SOAK_PROC \
+ || _fail " !!! failed to run soak test"
+
+ new_state="done"
+ ;;
+
+ bench-run)
+ cd $QADIR
+
+ # $BENCHMARK is typically unset, which equates to "all"
+ #
+ _log " *** run benchmarks"
+ _sudo ./bench $BENCH_PASSES `id -nu && id -ng` $BENCHMARK \
+ || _fail " !!! failed to run benchmarks"
+
+ _log ""
+ _log " *** send results mail"
+ mail -s "XFS QA benchmark results" $EMAIL < $QADIR/bench.out 2>&1
+
+ new_state="done"
+ ;;
+
+ *run)
+ cd $QADIR
+
+ _log " *** run tests ($CHECK_OPTIONS)"
+ _sudo ./check -l $CHECK_OPTIONS 2>&1 | tee $ROOT/qa.out
+
+ _log ""
+ _log " *** send status mail"
+ mail -s "XFS QA status report" $EMAIL < $ROOT/qa.out 2>&1
+
+ new_state="done"
+ ;;
+
+ *done)
+ _log "*** requested QA state transitions complete"
+
+ _success
+ ;;
+
+ *nothing)
+ new_state="done"
+ _log " *** do nothing"
+ ;;
+
+ *)
+ _fail " !!! unknown state $state"
+ ;;
esac
_log " *** state $state done (`date`)"
[ "$new_state" = "" ] && _fail " !!! no new state set"
+
+ if [ -n "$stop_state" ]
+ then
+ # remove hyphen prefixes
+ s1=`echo $start_state | sed 's/.*-//'`
+ s2=`echo $stop_state | sed 's/.*-//'`
+
+ if [ $s1 = $s2 ]
+ then
+ # we have been requested to stop here and not go on
+ new_state="done"
+ fi
+ fi
+
_change_state $new_state
done