-#!/bin/sh
+#!/bin/bash
# script which _must_ complete successfully (at minimum) before checkins to
# the CVS HEAD are allowed.
-set -vxe
+#set -vx
+set -e
-PATH=`dirname $0`/../utils:$PATH
+export MSKIPPED=0
+export OSKIPPED=0
-[ "$CONFIGS" ] || CONFIGS="local lov"
-[ "$MAX_THREADS" ] || MAX_THREADS=10
-if [ -z "$THREADS" ]; then
- KB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
- THREADS=`expr $KB / 16384`
- [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
+# This is the default set of tests to run.
+DEFAULT_SUITES="runtests sanity sanity-benchmark sanityn lfsck liblustre
+ runracer replay-single conf-sanity recovery-small
+ replay-ost-single replay-dual insanity sanity-quota sanity-sec
+ sanity-gss performance-sanity large-scale recovery-mds-scale
+ recovery-double-scale recovery-random-scale parallel-scale
+ lustre_rsync-test metadata-updates ost-pools lnet-selftest"
+
+if [[ -n $@ ]]; then
+ ACC_SM_ONLY="${ACC_SM_ONLY} $@"
fi
-[ "$SIZE" ] || SIZE=40960
+
+[ "$SIZE" ] || SIZE=$((RAMKB * 2))
[ "$RSIZE" ] || RSIZE=512
[ "$UID" ] || UID=1000
[ "$MOUNT" ] || MOUNT=/mnt/lustre
[ "$MOUNT2" ] || MOUNT2=${MOUNT}2
[ "$TMP" ] || TMP=/tmp
[ "$COUNT" ] || COUNT=1000
-#[ "$DEBUG_LVL" ] || DEBUG_LVL=0x370200
[ "$DEBUG_LVL" ] || DEBUG_LVL=0
-[ "$DEBUG_OFF" ] || DEBUG_OFF="eval echo $DEBUG_LVL > /proc/sys/portals/debug"
-[ "$DEBUG_ON" ] || DEBUG_ON="eval echo -1 > /proc/sys/portals/debug"
-
-for NAME in $CONFIGS; do
- export NAME MOUNT
- [ -e $NAME.sh ] && sh $NAME.sh
- [ ! -e $NAME.xml ] && [ -z "$LDAPURL" ] && \
- echo "no config '$NAME.xml'" 1>&2 && exit 1
-
- if [ "$RUNTESTS" != "no" ]; then
- sh runtests
- fi
-
- if [ "$SANITY" != "no" ]; then
- SANITYLOG=/tmp/sanity.log START=: CLEAN=: sh sanity.sh
- fi
-
- if [ "$DBENCH" != "no" ]; then
- mount | grep $MOUNT || sh llmount.sh
- SPACE=`df $MOUNT | tail -1 | awk '{ print $4 }'`
- DB_THREADS=`expr $SPACE / 50000`
- [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
-
- $DEBUG_OFF
- sh rundbench 1
- $DEBUG_ON
- sh llmountcleanup.sh
- sh llrmount.sh
- if [ $DB_THREADS -gt 1 ]; then
- $DEBUG_OFF
- sh rundbench $DB_THREADS
- $DEBUG_ON
- sh llmountcleanup.sh
- sh llrmount.sh
- fi
- rm -f /mnt/lustre/`hostname`/client.txt
- fi
- chown $UID $MOUNT && chmod 700 $MOUNT
- if [ "$BONNIE" != "no" ]; then
- mount | grep $MOUNT || sh llmount.sh
- $DEBUG_OFF
- bonnie++ -f -r 0 -s $(($SIZE / 1024)) -n 10 -u $UID -d $MOUNT
- $DEBUG_ON
- sh llmountcleanup.sh
- sh llrmount.sh
- fi
- IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r $RSIZE -s $SIZE"
- if [ "$O_DIRECT" -a "$O_DIRECT" != "no" ]; then
- IOZONE_OPTS="-I $IOZONE_OPTS"
- fi
- IOZONE_FILE="-f $MOUNT/iozone"
- if [ "$IOZONE" != "no" ]; then
- mount | grep $MOUNT || sh llmount.sh
- $DEBUG_OFF
- iozone $IOZONE_OPTS $IOZONE_FILE
- $DEBUG_ON
- sh llmountcleanup.sh
- sh llrmount.sh
- fi
- if [ "$IOZONE_DIR" != "no" ]; then
- mount | grep $MOUNT || sh llmount.sh
- SPACE=`df $MOUNT | tail -1 | awk '{ print $4 }'`
- IOZ_THREADS=`expr $SPACE / \( $SIZE + $SIZE / 512 \)`
- [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
-
- $DEBUG_OFF
- iozone $IOZONE_OPTS $IOZONE_FILE.odir
- IOZVER=`iozone -v | awk '/Revision:/ { print $3 }' | tr -d '.'`
- $DEBUG_ON
- sh llmountcleanup.sh
- sh llrmount.sh
- if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
- $DEBUG_OFF
- THREAD=1
- IOZONE_FILE="-F "
- while [ $THREAD -le $IOZ_THREADS ]; do
- IOZONE_FILE="$IOZONE_FILE $MOUNT/iozone.$THREAD"
- THREAD=`expr $THREAD + 1`
- done
- iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZONE_FILE
- $DEBUG_ON
- sh llmountcleanup.sh
- sh llrmount.sh
- elif [ $IOZVER -lt 3145 ]; then
- VER=`iozone -v | awk '/Revision:/ { print $3 }'`
- echo "iozone $VER too old for multi-threaded tests"
- fi
- fi
- if [ "$FSX" != "no" ]; then
- mount | grep $MOUNT || sh llmount.sh
- $DEBUG_OFF
- ./fsx -W -c 50 -p 1000 -P $TMP -l $SIZE \
- -N $(($COUNT * 100)) $MOUNT/fsxfile
- $DEBUG_ON
- sh llmountcleanup.sh
- sh llrmount.sh
- fi
- if [ "$SANITYN" != "no" ]; then
- mount | grep $MOUNT || sh llmount.sh
- $DEBUG_OFF
-
- mkdir -p $MOUNT2
- case $NAME in
- local|lov)
- MDSNODE=`hostname`
- MDSNAME=mds1
- CLIENT=client
- ;;
- *) # we could extract this from $NAME.xml somehow
- ;;
- esac
- if [ "$MDSNODE" -a "$MDSNAME" -a "$CLIENT" ]; then
- llmount $MDSNODE:/$MDSNAME/$CLIENT $MOUNT2
- SANITYLOG=$TMP/sanity.log START=: CLEAN=: sh sanityN.sh
- umount $MOUNT2
- else
- echo "don't know \$MDSNODE, \$MDSNAME, \$CLIENT"
- echo "can't mount2 for '$NAME', skipping sanityN.sh"
- fi
-
- $DEBUG_ON
- sh llmountcleanup.sh
- #sh llrmount.sh
- fi
-
- mount | grep $MOUNT && sh llmountcleanup.sh
-done
-
-if [ "$REPLAY_SINGLE" != "no" ]; then
- sh replay-single.sh
-fi
+[ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\""
+[ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484"
-if [ "$CONF_SANITY" != "no" ]; then
- sh conf-sanity.sh
+if [ "$ACC_SM_ONLY" ]; then
+ for O in $DEFAULT_SUITES; do
+ O=$(echo $O | tr "-" "_" | tr "[:lower:]" "[:upper:]")
+ export ${O}="no"
+ done
+ for O in $ACC_SM_ONLY; do
+ O=`echo ${O%.sh} | tr "-" "_"`
+ O=`echo $O | tr "[:lower:]" "[:upper:]"`
+ export ${O}="yes"
+ done
fi
+LFSCK="no" # bug 13698
-if [ "$RECOVERY_SMALL" != "no" ]; then
- sh recovery-small.sh
-fi
+STARTTIME=`date +%s`
+
+LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+. $LUSTRE/tests/test-framework.sh
+init_test_env
-if [ "$REPLAY_OST_SINGLE" != "no" ]; then
- sh replay-ost-single.sh
+if $GSS; then
+ # liblustre doesn't support GSS
+ export LIBLUSTRE=no
+else
+ export SANITY_GSS="no"
fi
+
+SETUP=${SETUP:-setupall}
+FORMAT=${FORMAT:-formatall}
+CLEANUP=${CLEANUP:-stopall}
+
+setup_if_needed() {
+ nfs_client_mode && return
+
+ local MOUNTED=$(mounted_lustre_filesystems)
+ if $(echo $MOUNTED | grep -w -q $MOUNT); then
+ check_config_clients $MOUNT
+ init_facets_vars
+ init_param_vars
+ return
+ fi
+
+ echo "Lustre is not mounted, trying to do setup SETUP=$SETUP ... "
+ [ "$REFORMAT" ] && $FORMAT
+ $SETUP
+
+ MOUNTED=$(mounted_lustre_filesystems)
+ if ! $(echo $MOUNTED | grep -w -q $MOUNT); then
+ echo "Lustre is not mounted after setup! SETUP=$SETUP"
+ exit 1
+ fi
+}
+
+find_in_path() {
+ target=$1
+ for dir in $(tr : " " <<< $PATH); do
+ if [ -e $dir/$target ]; then
+ echo "$dir/$target found in PATH"
+ return 0
+ fi
+ done
+ return 1
+}
+
+title() {
+ # update titlebar if stdin is attaached to an xterm
+ if ${UPDATE_TITLEBAR:-false}; then
+ if tty -s; then
+ case $TERM in
+ xterm*)
+ echo -ne "\033]2; acceptance-small: $* \007" >&0
+ ;;
+ esac
+ fi
+ fi
+ log "-----============= acceptance-small: "$*" ============----- `date`"
+}
+
+is_sanity_benchmark() {
+ local benchmarks="dbench bonnie iozone fsx"
+ local suite=$1
+ for b in $benchmarks; do
+ if [ "$b" == "$suite" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+run_suite() {
+ local suite_name=$(echo ${1%.sh} | tr "[:upper:]_" "[:lower:]-" )
+ local suite=$(echo ${suite_name} | tr "[:lower:]-" "[:upper:]_")
+ local suite_only=ONLY # Change to ${suite}_ONLY after fixing YALA
+
+ if is_sanity_benchmark ${suite_name}; then
+ suite_only=suite_name
+ suite_script=$LUSTRE/tests/sanity-benchmark.sh
+ elif [ -e $LUSTRE/tests/${suite_name}.sh ]; then
+ suite_script=$LUSTRE/tests/${suite_name}.sh
+ elif [ -e $LUSTRE/tests/$suite_name ]; then
+ suite_script=$LUSTRE/tests/$suite_name
+ elif find_in_path $suite_name; then
+ suite_script=${suite_name}
+ elif find_in_path ${suite_name}.sh; then
+ suite_script=${suite_name}.sh
+ else
+ echo "Can't find test script for $suite_name"
+ return 1
+ fi
+
+ echo "$suite_script located."
+ if [[ ${!suite} != no ]]; then
+ title $suite_name
+ log_test $suite_name
+ bash $suite_script ${!suite_only}
+ $CLEANUP
+ $SETUP
+ eval ${suite}="done"
+ else
+ echo "Skipping $suite_name"
+ fi
+}
+
+run_suites() {
+ for suite in $*; do
+ run_suite $suite
+ done
+}
+
+export NAME MOUNT START CLEAN
+. $LUSTRE/tests/cfg/$NAME.sh
+
+assert_env mds_HOST MDS_MKFS_OPTS
+assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT
+assert_env FSNAME MOUNT MOUNT2
+
+setup_if_needed
+init_logging
+
+run_suites ${ACC_SM_ONLY:-$DEFAULT_SUITES}
+
+RC=$?
+title FINISHED
+echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
+print_summary
+[ "$MSKIPPED" = 1 ] && log "FAIL: remote MDS tests skipped" && RC=1
+[ "$OSKIPPED" = 1 ] && log "FAIL: remote OST tests skipped" && RC=1
+echo "$0: completed with rc $RC" && exit $RC