3 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of version 2 of the GNU General Public License as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it would be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # Further, this software is distributed without any warranty that it is
14 # free of the rightful claim of any third person regarding infringement
15 # or the like. Any license provided herein, whether implied or
16 # otherwise, applies only to this software file. Patent licenses, if
17 # any, provided herein do not apply to combinations of this program with
18 # other software, or any other product whatsoever.
20 # You should have received a copy of the GNU General Public License along
21 # with this program; if not, write the Free Software Foundation, Inc., 59
22 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25 # Mountain View, CA 94043, or:
29 # For further information regarding this notice, see:
31 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
34 # automatic qa system. 31/08/00 dxm@sgi.com
36 # configuration (you could tune this)
43 export MKFS_OPTIONS=${MKFS_OPTIONS:=-bsize=4096}
44 export MOUNT_OPTIONS=${MOUNT_OPTIONS:=-ologbufs=2}
54 if [ "$started" = "1" ]
56 echo "auto-qa stopped" | wall
62 # send special email if a cron'd qa run fails
66 mail -s "XFS QA status report" $ADMINEMAIL \
78 || _fail "can't access workarea $WORKAREA"
79 [ -r "$WORKAREA/linux/Makefile" ] \
80 || _fail "can't read makefile $WORKAREA/linux/Makefile"
83 BEGIN { FS = "[ \t=]+" }
85 /^PATCHLEVEL =/ { b=$2 }
86 /^SUBLEVEL =/ { c=$2 }
87 /^EXTRAVERSION =/ { d=$2 }
89 print "VERSION=" a "." b "." c d " ; SVERSION=" a "." b "." c
91 ' < $WORKAREA/linux/Makefile`
94 # this should be constant
98 if [ ! -z "$CVSROOT" ]; then
99 WORKAREA="$ROOT/linux-2.4-xfs"
101 [ -z "$WORKAREA" ] && WORKAREA="$ROOT/linux-xfs"
106 export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/ptools:/usr/local/bin"
108 QADIR="$WORKAREA/cmd/xfstests"
110 CONFIG="$ROOT/$HOST.config"
111 COMMON_CONFIG="$WORKAREA/cmd/xfstests/common.config"
115 # need to add auto-qa hosts here
120 EMAIL="nathans@larry"
121 ADMINEMAIL="nathans@larry"
126 ADMINEMAIL="tes@larry"
131 ADMINEMAIL="kaos@larry"
135 EMAIL="nathans@larry"
136 ADMINEMAIL="nathans@larry"
140 _fail "auto-qa: no configuration information for host '$HOST'"
144 # do some cleanup on exit
148 umount $SCRATCH_DEV &> /dev/null
149 umount $TEST_DEV &> /dev/null
150 if [ "$started" = 1 ]
152 echo "auto-qa stopped" | wall
157 trap "_cleanup; exit \$status" 0 1 2 3 15
191 _set_state `echo $state | sed "s/-.*$/-$new/"`
203 $ROOT/su -c "$*" < /dev/null ;# HACK - we need a hacked su at the mo
208 exec $ROOT/su -c "(shutdown -r now \"auto-qa rebooting\" )&" < /dev/null
211 _update_autoqa_file()
214 SELF_UPDATE="cmd/xfstests/tools/auto-qa"
215 if [ -z "$CVSROOT" ]; then
216 cmd="p_tupdate $SELF_UPDATE"
218 cmd="cvs -z3 update $SELF_UPDATE"
220 exec $SH -c "cd $WORKAREA ; $cmd; chmod +x $SELF_UPDATE ; exec $SELF"
225 if [ -z "$CVSROOT" ]; then
226 _log " *** p_tupdate"
229 || _fail " !!! p_tupdate failed"
231 _log " *** p_check/p_purge"
233 p_check -s | p_purge -yiu 2>&1 \
234 || _fail " !!! p_check/p_purge failed"
236 _log " *** non-trunk files"
239 || _fail " !!! p_list failed"
241 _log " *** cvs update"
248 _log "*** linux-xfs QA (`date`)"
252 # check preconditions for starting state
261 _fail " !!! cron-init while not in \"*done\" state"
266 # we don't auto restart after reboot, but cron the restart
267 # to happen a bit later - it's much easier and safer that way
268 if [ "$state" != "cron-restarted" ]
270 _fail " !!! cron-restarted while not in \"cron-restarted\" state"
280 [ "$UID" -eq 0 ] && _fail " !!! QA most be run as a normal user"
281 [ -d "$ROOT" ] || _fail " !!! QA root \"$ROOT\" not found"
282 [ -d "$WORKAREA" ] || _fail " !!! QA workarea \"$WORKAREA\" not found"
283 [ -r "$CONFIG" ] || _fail " !!! Can't read config file $CONFIG"
284 . "$COMMON_CONFIG" || _fail " !!! Couldn't source $COMMON_CONFIG"
287 IMAGE="$BOOT/vmlinuz$EXTRA"
288 SYSTEMMAP="$BOOT/System.map-$VERSION$EXTRA"
289 MODULES="/lib/modules/$SVERSION"
294 echo "auto-qa started" | wall
300 _log " *** state $state start (`date`)"
301 _log " (user=$USER, host=$HOST)"
307 echo "" > $ROOT/qa.log
308 echo "" > $ROOT/qa.full
309 _log "******************************************************"
310 _log "QA init $VERSION (`date`)"
311 _log "******************************************************"
312 _log "--- kernel ($IMAGE)"
313 _log "--- modules ($MODULES)"
315 _change_state "inited"
320 _log " *** QA initialized"
330 # we need to configure or else we might fail to clean
331 for pkg in attr acl xfsprogs dmapi xfsdump xfstests
333 cd $WORKAREA/cmd/$pkg
334 _log " *** clean $pkg tools"
335 make realclean 2>&1 \
336 || _fail " !!! clean $pkg failed"
339 _log " *** clean linux"
342 || _fail " !!! clean linux failed"
344 _log " *** install configuration file"
345 cp -f $CONFIG $WORKAREA/linux/.config 2>&1 \
346 || _fail " !!! failed to install config"
348 _log " *** remove version file"
349 rm -f include/linux/version.h 2>&1 \
350 || _fail " !!! failed to clean version"
357 _log " *** reconfig kernel"
359 _change_state "clean" ; # we better start from scratch if this fails
362 # we want to use default options for any new config options.
363 echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | \
364 make EXTRAVERSION=$EXTRA oldconfig 2>&1 \
365 || _fail " !!! reconfig oldconfig failed"
366 make EXTRAVERSION=$EXTRA dep 2>&1 \
367 || _fail " !!! reconfig dep failed"
369 new_state="buildtools"
373 _log " *** build and install tools"
374 for pkg in attr acl xfsprogs dmapi xfsdump xfstests
376 cd $WORKAREA/cmd/$pkg
378 # use e-fence - but this will only take effect on configure
379 export MALLOCLIB=/usr/lib/libefence.a
380 make configure 2>&1 \
381 || _fail " !!! configure $pkg failed"
383 || _fail " !!! build $pkg failed"
385 _sudo make install install-dev 2>&1 \
386 || _fail " !!! install $pkg failed"
388 # attr and acl now have install-lib targets as well
389 [ "$pkg" == "attr" -o "$pkg" == "acl" ] || continue
390 _sudo make install-lib 2>&1 \
391 || _fail " !!! install $pkg failed"
394 new_state="buildkernel"
398 _log " *** build kernel"
400 _change_state "clean" ; # we better start from scratch if this fails
403 make -j4 EXTRAVERSION=$EXTRA bzImage modules 2>&1 \
404 || _fail " !!! build bzImage/modules failed"
409 _log " *** blat old modules"
411 _sudo rm -rf $MODULES
413 _log " *** install kernel"
415 _sudo cp -f $WORKAREA/linux/arch/i386/boot/bzImage $IMAGE 2>&1 \
416 || _fail " !!! install kernel failed"
417 _sudo cp -f $WORKAREA/linux/System.map $SYSTEMMAP 2>&1 \
418 || _fail " !!! install kernel failed"
419 _sudo make EXTRAVERSION=$EXTRA modules_install 2>&1 \
420 || _fail " !!! install modules failed"
422 _log " *** reinit lilo"
423 _sudo /sbin/lilo 2>&1 \
424 || _fail " !!! reinit lilo failed"
429 _log " *** select qa kernel"
430 _sudo /sbin/lilo -R linux-xfs-qa 2>&1 \
431 || _fail " !!! lilo failed"
433 _log " *** prepare to restart"
434 _change_state "restarted"
436 _log " *** restarting"
438 _restart # doesn't return
442 _log " *** QA reentered after restart"
449 _log " *** uname $uname"
450 _log " *** user tools"
451 ls -l /sbin/*xfs* /usr/sbin/*xfs* 2>&1
453 ls -l /boot/*$EXTRA* 2>&1
454 _log " *** kernel modules"
455 ls -l /lib/modules/$SVERSION$EXTRA/kernel/fs/xfs/*
457 if [ "$MODULAR" -eq 0 ]
466 _log " *** modules dependencies"
468 _sudo depmod -a 2>&1 \
469 || _fail " !!! failed to depmod -a"
471 _log " *** unmounting XFS mounts"
473 _sudo umount -a -t xfs 2>&1
475 _log " *** removing modules"
477 for m in xfsidbg xfs kdbm_pg kdbm_vm
479 _sudo rmmod $m 2> /dev/null
482 _log " *** installing modules"
484 _sudo modprobe xfs 2>&1 \
485 || _fail " !!! failed to modprobe xfs"
492 _log " *** unmounting TEST_DEV"
494 _sudo umount $TEST_DEV 2>&1
496 _log " *** unmounting SCRATCH_DEV"
498 _sudo umount $SCRATCH_DEV 2>&1
500 _log " *** clean TEST_DEV"
502 _sudo mkfs -t xfs -f $MKFS_OPTIONS $TEST_DEV 2>&1 \
503 || _fail " !!! failed to mkfs TEST_DEV"
505 _log " *** mounting TEST_DEV"
507 _sudo mount -t xfs $TEST_DEV $TEST_DIR 2>&1 \
508 || _fail " !!! failed to mount"
517 _log " *** run soak test"
518 _sudo ./soak $SOAK_PASSES $SOAK_STRESS $SOAK_PROC\
519 || _fail " !!! failed to run soak test"
527 _log " *** run tests"
528 _sudo ./check -l -g auto 2>&1 | tee $ROOT/qa.out
531 _log " *** send status mail"
532 mail -s "XFS QA status report" $EMAIL < $ROOT/qa.out 2>&1
538 _log "*** QA run complete"
545 _log " *** do nothing"
549 _fail " !!! unknown state $state"
553 _log " *** state $state done (`date`)"
554 [ "$new_state" = "" ] && _fail " !!! no new state set"
555 _change_state $new_state