X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fruntests;h=64426d12948f492eb7c8dd9e7c2e4074dc4911ec;hb=a14cd92beb52755dd1115f93288f7f0479f59c12;hp=122a006d6c2f27551636b8d502e443a534f6f08e;hpb=3937bbdc07495e1e2dac638b11ccaf1120dd1508;p=fs%2Flustre-release.git diff --git a/lustre/tests/runtests b/lustre/tests/runtests index 122a006..64426d1 100755 --- a/lustre/tests/runtests +++ b/lustre/tests/runtests @@ -14,11 +14,6 @@ export NAME=${NAME:-local} init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} -SETUP=${SETUP:-setupall} -FORMAT=${FORMAT:-formatall} -CLEANUP=${CLEANUP:-stopall} - -ERROR= RUNTESTS_SRC=${RUNTESTS_SRC:-"/etc /bin"} [ "$COUNT" ] || COUNT=1000 [ "$SLOW" = "no" ] && COUNT=100 @@ -27,24 +22,7 @@ RUNTESTS_SRC=${RUNTESTS_SRC:-"/etc /bin"} [ "$MKDIRMANY" ] || MKDIRMANY="createmany -d" -while [ "$1" ]; do - case $1 in - *.xml) export NAME=`echo $1 | sed "s/.xml//"` ;; - *) OPTS="$OPTS $1" ;; - esac - shift -done - -MOUNTED=$(mounted_lustre_filesystems | head -1) -if [ -z "$MOUNTED" ]; then - formatall - setupall - MOUNTED="`mounted_lustre_filesystems`" - [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted" - I_MOUNTED=yes -fi - -MOUNT=$MOUNTED +check_and_setup_lustre OSCTMP=`echo $MOUNT | tr "/" "."` USED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -n 1` @@ -85,34 +63,36 @@ mkdir $DST || error "can't mkdir $DST" 10 # ok, that hopefully worked, so let's do a little more, with files that # haven't changed in the last day (hopefully they don't change during test) -FILES=`find $RUNTESTS_SRC -type f -mtime +1 | head -n $COUNT` -[ -z "$FILES" ] && error "No unchanged files - is $RUNTESTS_SRC a new dir?" +FILES=$TMP/runtests.files +# print0 is to use "NUL" instead of newline as filename terminator, bug 19702 +find $RUNTESTS_SRC -type f -mtime +1 -print0 | head -n $COUNT > $FILES +[ -s "$FILES" ] || error "$RUNTESTS_SRC contains only files modifed less than 2 days ago" log "copying files from $RUNTESTS_SRC to $DST$RUNTESTS_SRC at `date`" -tar cf - $FILES | tar xvf - -C $DST > /dev/null || error "copying $RUNTESTS_SRC" 11 +tar cf - --null --files-from $FILES | tar xvf - -C $DST > /dev/null || error "copying $RUNTESTS_SRC" 11 log "comparing newly copied files at `date`" -for f in $FILES; do + +cat $FILES | tr "\0" "\n" | ( rc=0; while read f; do [ $V ] && log "verifying $DST/$f" - diff -q $f $DST/$f || ERROR=11 + diff -q "$f" "$DST/$f" || rc=11 done +[ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" ) -[ "$ERROR" ] && error "old and new files are different" $ERROR log "finished at `date` ($(($(date +%s) - START)))" -$CLEANUP || exit 19 -$SETUP || exit 20 +stopall || exit 19 +setupall || exit 20 log "comparing previously copied files" -for f in $FILES; do - [ $V ] && log "verifying $DST/$f" - diff -q $f $DST/$f || ERROR=22 +cat $FILES | tr "\0" "\n" | ( rc=0; while read f; do + [ $V ] && log "verifying $DST/$f" + diff -q "$f" "$DST/$f" || rc=22 done +[ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" ) -[ "$ERROR" ] && error "old and new files are different on second diff" $ERROR - -$CLEANUP || exit 19 -$SETUP || exit 20 +stopall || exit 21 +setupall || exit 22 log "removing $DST" rm -r $V $DST || error "can't remove $DST" 37 @@ -143,6 +123,5 @@ if [ `expr $NOWUSED - $USED` -gt 1024 ]; then echo "Space not all freed: now ${NOWUSED}kB, was ${USED}kB." 1>&2 fi -if [ "$I_MOUNTED" = "yes" ]; then - $CLEANUP -fi +rm -f $FILES +check_and_cleanup_lustre