X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Facceptance-small.sh;h=abc9e843bfb69730e59d2a89d587859a5aed2f57;hb=6a75d6587b2c0962a5d3f22bb9e4e5a0e1cc63b2;hp=4c27f95faa0f9b6dcfe0f3e91d48ddb2176becaf;hpb=3192e52a89946f12fd36d28a686c169d01d36e64;p=fs%2Flustre-release.git diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index 4c27f95..abc9e84 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -4,16 +4,22 @@ #set -vx set -e -PATH=`dirname $0`/../utils:$PATH - -[ -z "$CONFIG" -a "$NAME" ] && CONFIGS=$NAME -[ "$CONFIGS" ] || CONFIGS="local" #"local lov" -[ "$MAX_THREADS" ] || MAX_THREADS=20 -RAMKB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo` -if [ -z "$THREADS" ]; then - THREADS=$((RAMKB / 16384)) - [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS +export MSKIPPED=0 +export OSKIPPED=0 + +# This is the default set of tests to run. +DEFAULT_SUITES="runtests sanity sanity-benchmark sanityn lfsck + racer replay-single conf-sanity recovery-small + replay-ost-single replay-dual replay-vbr 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 mmp obdfilter-survey sgpdd-survey" + +if [[ -n $@ ]]; then + ACC_SM_ONLY="${ACC_SM_ONLY} $@" fi + [ "$SIZE" ] || SIZE=$((RAMKB * 2)) [ "$RSIZE" ] || RSIZE=512 [ "$UID" ] || UID=1000 @@ -22,39 +28,34 @@ fi [ "$TMP" ] || TMP=/tmp [ "$COUNT" ] || COUNT=1000 [ "$DEBUG_LVL" ] || DEBUG_LVL=0 -[ "$DEBUG_OFF" ] || DEBUG_OFF="eval sysctl -w lnet.debug=\"$DEBUG_LVL\"" -[ "$DEBUG_ON" ] || DEBUG_ON="eval sysctl -w lnet.debug=0x33f0484" +[ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\"" +[ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484" -export TESTSUITE_LIST="RUNTESTS SANITY DBENCH BONNIE IOZONE FSX SANITYN LFSCK LIBLUSTRE REPLAY_SINGLE CONF_SANITY RECOVERY_SMALL REPLAY_OST_SINGLE REPLAY_DUAL INSANITY SANITY_QUOTA SANITY_SEC" - -if [ "$SLOW" = "no" ]; then -# 5 min - export IOZONE="no" -fi +export TF_FAIL=$TMP/tf.fail if [ "$ACC_SM_ONLY" ]; then - for O in $TESTSUITE_LIST; do - export ${O}="no" + 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 | tr "[:lower:]" "[:upper:]"` - export ${O}="yes" + O=`echo ${O%.sh} | tr "-" "_"` + O=`echo $O | tr "[:lower:]" "[:upper:]"` + export ${O}="yes" done fi -LFSCK="no" # bug 13698 - -LIBLUSTRETESTS=${LIBLUSTRETESTS:-../liblustre/tests} STARTTIME=`date +%s` -RANTEST="" -LUSTRE=${LUSTRE:-`dirname $0`/..} +LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)} . $LUSTRE/tests/test-framework.sh -init_test_env $@ +init_test_env if $GSS; then # liblustre doesn't support GSS export LIBLUSTRE=no +else + export SANITY_GSS="no" fi SETUP=${SETUP:-setupall} @@ -62,268 +63,124 @@ FORMAT=${FORMAT:-formatall} CLEANUP=${CLEANUP:-stopall} setup_if_needed() { - mount | grep $MOUNT && return - $FORMAT && $SETUP + 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 } -title() { - log "-----============= acceptance-small: "$*" ============----- `date`" - RANTEST=${RANTEST}$*", " +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 } -for NAME in $CONFIGS; do - export NAME MOUNT START CLEAN - . $LUSTRE/tests/cfg/$NAME.sh - - assert_env mds_HOST MDS_MKFS_OPTS MDSDEV - assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT - assert_env FSNAME MOUNT MOUNT2 - - setup_if_needed - - if [ "$RUNTESTS" != "no" ]; then - title runtests - bash runtests - $CLEANUP - $SETUP - RUNTESTS="done" - fi - - if [ "$SANITY" != "no" ]; then - title sanity - bash sanity.sh - $CLEANUP - $SETUP - SANITY="done" - fi - - which dbench > /dev/null 2>&1 || DBENCH=no - if [ "$DBENCH" != "no" ]; then - title dbench - SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'` - DB_THREADS=$((SPACE / 50000)) - [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS - - $DEBUG_OFF - duration="" - [ "$SLOW" = "no" ] && duration=" -t 120" - if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then - bash rundbench 1 $duration - $DEBUG_ON - $CLEANUP - $SETUP - fi - if [ $DB_THREADS -gt 1 ]; then - $DEBUG_OFF - bash rundbench $DB_THREADS $duration - $DEBUG_ON - $CLEANUP - $SETUP - fi - rm -f /mnt/lustre/`hostname`/client.txt - DBENCH="done" - fi - - chown $UID $MOUNT - which bonnie++ > /dev/null 2>&1 || BONNIE=no - if [ "$BONNIE" != "no" ]; then - title bonnie - $LFS setstripe $MOUNT 0 -1 -1 - MIN=`cat /proc/fs/lustre/osc/*-osc-*/kbytesfree | sort -n | head -n1` - SPACE=$(( OSTCOUNT * MIN )) - [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4)) - $DEBUG_OFF - bonnie++ -f -r 0 -s $((SIZE / 1024)) -n 10 -u $UID -d $MOUNT - $DEBUG_ON - $CLEANUP - $SETUP - BONNIE="done" - fi - - export O_DIRECT - which iozone > /dev/null 2>&1 || IOZONE=no - if [ "$IOZONE" != "no" ]; then - title iozone - MIN=`cat /proc/fs/lustre/osc/*-osc-*/kbytesfree | sort -n | head -n1` - SPACE=$(( OSTCOUNT * MIN )) - [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4)) - IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE" - IOZFILE="$MOUNT/iozone" - # $SPACE was calculated with all OSTs - $LFS setstripe $IOZFILE 0 -1 -1 - $DEBUG_OFF - iozone $IOZONE_OPTS -f $IOZFILE - $DEBUG_ON - $CLEANUP - $SETUP - - # check if O_DIRECT support is implemented in kernel - if [ -z "$O_DIRECT" ]; then - touch $MOUNT/f.iozone - if ! ./directio write $MOUNT/f.iozone 0 1; then - O_DIRECT=no - fi - rm -f $MOUNT/f.iozone - fi - if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then - $DEBUG_OFF - iozone -I $IOZONE_OPTS $IOZFILE.odir - $DEBUG_ON - $CLEANUP - $SETUP - fi - - SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'` - IOZ_THREADS=$((SPACE / SIZE * 2 / 3 )) - [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS - IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .` - if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then - $DEBUG_OFF - THREAD=1 - IOZFILE="-F " - while [ $THREAD -le $IOZ_THREADS ]; do - IOZFILE="$IOZFILE $MOUNT/iozone.$THREAD" - THREAD=$((THREAD + 1)) - done - iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE - $DEBUG_ON - $CLEANUP - $SETUP - elif [ $IOZVER -lt 3145 ]; then - VER=`iozone -v | awk '/Revision:/ { print $3 }'` - echo "iozone $VER too old for multi-thread test" - fi - IOZONE="done" - fi - - if [ "$FSX" != "no" ]; then - title fsx - SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'` - [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4)) - $DEBUG_OFF - ./fsx -c 50 -p 1000 -P $TMP -l $SIZE \ - -N $(($COUNT * 100)) $MOUNT/fsxfile - $DEBUG_ON - $CLEANUP - $SETUP - FSX="done" - fi - - if [ "$SANITYN" != "no" ]; then - title sanityN - $DEBUG_OFF - - mkdir -p $MOUNT2 - mount_client $MOUNT2 - #echo "can't mount2 for '$NAME', skipping sanityN.sh" - START=: CLEAN=: bash sanityN.sh - umount $MOUNT2 - - $DEBUG_ON - $CLEANUP - $SETUP - SANITYN="done" - fi - - if [ "$LFSCK" != "no" -a -x /usr/sbin/lfsck ]; then - title lfsck - E2VER=`e2fsck -V 2>&1 | head -n 1 | cut -d' ' -f 2` - if grep -q obdfilter /proc/fs/lustre/devices; then - if [ `echo $E2VER | cut -d. -f2` -ge 39 ] && \ - [ "`echo $E2VER | grep cfs`" ]; then - bash lfscktest.sh - else - e2fsck -V - echo "e2fsck does not support lfsck, skipping" - fi - else - echo "remote OST, skipping test" - fi - LFSCK="done" - fi - - if [ "$LIBLUSTRE" != "no" ]; then - title liblustre - assert_env MGSNID MOUNT2 - $CLEANUP - unload_modules - # Liblustre needs accept=all, noacl - [ -f /etc/modprobe.conf ] && MODPROBECONF=/etc/modprobe.conf - [ -f /etc/modprobe.d/Lustre ] && MODPROBECONF=/etc/modprobe.d/Lustre - - LNETOPTS="$(awk '/^options lnet/ { print $0}' $MODPROBECONF | \ - sed 's/^options lnet //g') accept=all" \ - MDS_MOUNT_OPTS=$(echo $MDS_MOUNT_OPTS | sed 's/^[ \t]*//;s/[ \t]*$//') \ - MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl" \ - MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS/#,/-o } \ - $SETUP - export LIBLUSTRE_MOUNT_POINT=$MOUNT2 - export LIBLUSTRE_MOUNT_TARGET=$MGSNID:/$FSNAME - export LIBLUSTRE_TIMEOUT=`cat /proc/sys/lustre/timeout` - #export LIBLUSTRE_DEBUG_MASK=`cat /proc/sys/lnet/debug` - if [ -x $LIBLUSTRETESTS/sanity ]; then - mkdir -p $MOUNT2 - echo $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET - $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET - fi - $CLEANUP - #$SETUP - LIBLUSTRE="done" - fi - - $CLEANUP -done - -if [ "$REPLAY_SINGLE" != "no" ]; then - title replay-single - bash replay-single.sh - REPLAY_SINGLE="done" -fi - -if [ "$CONF_SANITY" != "no" ]; then - title conf-sanity - bash conf-sanity.sh - CONF_SANITY="done" -fi +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)" +} -if [ "$RECOVERY_SMALL" != "no" ]; then - title recovery-small - bash recovery-small.sh - RECOVERY_SMALL="done" -fi +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 + local rc + local status + local duration + local start_ts=$(date +%s) + rm -rf $TF_FAIL + title $suite_name + log_test $suite_name + bash $suite_script ${!suite_only} + rc=$? + duration=$(($(date +%s) - $start_ts)) + if [ -f $TF_FAIL -o $rc -ne 0 ]; then + status="FAIL" + else + status="PASS" + fi + echo "Script: $status" + log_test_status $duration $status + + $CLEANUP + [ x$suite = xSGPDD_SURVEY ] || $SETUP + + eval ${suite}="done" + else + echo "Skipping $suite_name" + fi +} -if [ "$REPLAY_OST_SINGLE" != "no" ]; then - title replay-ost-single - bash replay-ost-single.sh - REPLAY_OST_SINGLE="done" -fi +run_suites() { + for suite in $*; do + run_suite $suite + done +} -if [ "$REPLAY_DUAL" != "no" ]; then - title replay-dual - bash replay-dual.sh - REPLAY_DUAL="done" -fi +export NAME MOUNT START CLEAN +. $LUSTRE/tests/cfg/$NAME.sh -if [ "$INSANITY" != "no" ]; then - title insanity - bash insanity.sh -r - INSANITY="done" -fi +assert_env mds_HOST MDS_MKFS_OPTS +assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT +assert_env FSNAME MOUNT MOUNT2 -if [ "$SANITY_QUOTA" != "no" ]; then - title sanity-quota - bash sanity-quota.sh - SANITY_QUOTA="done" -fi +setup_if_needed +init_logging -if [ "$SANITY_SEC" != "no" ]; then - title sanity-sec - bash sanity-sec.sh -fi +run_suites ${ACC_SM_ONLY:-$DEFAULT_SUITES} RC=$? title FINISHED echo "Finished at `date` in $((`date +%s` - $STARTTIME))s" -echo "Tests ran: $RANTEST" 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