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
44 if [ "$started" = "1" ]
46 echo "auto-qa stopped" | wall
52 # send special email if a cron'd qa run fails
56 mail -s "xfs qa status report" $ADMINEMAIL \
65 # configuration (you could tune this)
74 # this should be constant
78 if [ ! -z "$CVSROOT" ]; then
79 WORKAREA="$ROOT/linux-2.4-xfs"
81 [ -z "$WORKAREA" ] && WORKAREA="$ROOT/linux-xfs"
85 export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/ptools:/usr/local/bin"
87 QADIR="$WORKAREA/cmd/xfstests"
89 IMAGE="$BOOT/vmlinuz-$VERSION$EXTRA"
90 SYSTEMMAP="$BOOT/System.map-$VERSION$EXTRA"
91 CONFIG="$ROOT/$HOST.config"
92 MODULES="/lib/modules/$VERSION$EXTRA"
93 COMMON_CONFIG="$WORKAREA/cmd/xfstests/common.config"
97 # need to add auto-qa hosts here
103 ADMINEMAIL="dxm@larry"
108 ADMINEMAIL="dxm@larry"
113 ADMINEMAIL="dxm@larry"
117 EMAIL="nathans@larry"
118 ADMINEMAIL="nathans@larry"
122 EMAIL="nathans@larry"
123 ADMINEMAIL="nathans@larry"
127 _fail "auto-qa: no configuration information for host '$HOST'"
131 # do some cleanup on exit
135 umount $SCRATCH_DEV &> /dev/null
136 umount $TEST_DEV &> /dev/null
137 if [ "$started" = 1 ]
139 echo "auto-qa stopped" | wall
144 trap "_cleanup; exit \$status" 0 1 2 3 15
178 _set_state `echo $state | sed "s/-.*$/-$new/"`
190 $ROOT/su -c "$*" < /dev/null ;# HACK - we need a hacked su at the mo
195 # erk - why won't this thing reboot reliably??
196 exec $ROOT/su -c "(shutdown -r 2 \"auto-qa rebooting\" ; sleep 10 ; reboot ; sleep 10 ; reboot )&" < /dev/null
199 _update_autoqa_file()
202 SELF_UPDATE="cmd/xfstests/tools/auto-qa"
203 if [ -z "$CVSROOT" ]; then
204 cmd="p_tupdate $SELF_UPDATE"
206 cmd="cvs -z3 update $SELF_UPDATE"
208 exec $SH -c "cd $WORKAREA ; $cmd; chmod +x $SELF_UPDATE ; exec $SELF"
213 if [ -z "$CVSROOT" ]; then
214 _log " *** p_tupdate"
217 || _fail " !!! p_tupdate failed"
219 _log " *** p_check/p_purge"
221 p_check -s | p_purge -yiu 2>&1 \
222 || _fail " !!! p_check/p_purge failed"
224 _log " *** non-trunk files"
227 || _fail " !!! p_list failed"
229 _log " *** cvs update"
236 _log "*** linux-xfs QA (`date`)"
240 # check preconditions for starting state
249 _fail " !!! cron-init while not in \"*done\" state"
254 # we don't auto restart after reboot, but cron the restart
255 # to happen a bit later - it's much easier and safer that way
256 if [ $state != "cron-restarted" ]
258 _fail " !!! cron-restarted while not in \"cron-restarted\" state"
268 [ $UID -eq 0 ] && _fail " !!! QA most be run as a normal user"
269 [ -d $ROOT ] || _fail " !!! QA root \"$ROOT\" not found"
270 [ -d $WORKAREA ] || _fail " !!! QA workarea \"$WORKAREA\" not found"
271 [ -r $CONFIG ] || _fail " !!! Can't read config file $CONFIG"
272 . $COMMON_CONFIG || _fail " !!! Couldn't source $COMMON_CONFIG"
277 echo "auto-qa started" | wall
283 _log " *** state $state start (`date`)"
284 _log " (user=$USER, host=$HOST)"
290 echo "" > $ROOT/qa.log
291 echo "" > $ROOT/qa.full
292 _log "******************************************"
293 _log "QA init (`date`)"
294 _log "******************************************"
296 _change_state "inited"
301 _log " *** QA initialized"
311 # we need to configure or else we might fail to clean
312 for pkg in attr acl xfsprogs xfsdump xfstests
314 cd $WORKAREA/cmd/$pkg
315 _log " *** clean $pkg tools"
316 make realclean 2>&1 \
317 || _fail " !!! clean $pkg failed"
320 _log " *** clean quota tools"
321 cd $WORKAREA/cmd/quota
322 ( rm -f configure ; autoconf ; sh configure ; make clean ) 2>&1 \
323 || _fail " !!! clean quota failed"
325 _log " *** clean linux"
328 || _fail " !!! clean linux failed"
330 _log " *** install configuration file"
331 cp -f $CONFIG $WORKAREA/linux/.config 2>&1 \
332 || _fail " !!! failed to install config"
334 _log " *** remove version file"
335 rm -f include/linux/version.h 2>&1 \
336 || _fail " !!! failed to clean version"
343 _log " *** reconfig kernel"
345 _change_state "clean" ; # we better start from scratch if this fails
348 # we want to use default options for any new config options.
349 echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | \
350 make EXTRAVERSION=$EXTRA oldconfig 2>&1 \
351 || _fail " !!! reconfig oldconfig failed"
352 make EXTRAVERSION=$EXTRA dep 2>&1 \
353 || _fail " !!! reconfig dep failed"
359 _log " *** build kernel"
361 _change_state "clean" ; # we better start from scratch if this fails
364 make -j2 EXTRAVERSION=$EXTRA bzImage 2>&1 \
365 || _fail " !!! build bzImage failed"
366 make -j2 EXTRAVERSION=$EXTRA modules 2>&1 \
367 || _fail " !!! build modules failed"
369 _log " *** build and install tools"
370 for pkg in attr acl xfsprogs xfsdump xfstests
372 cd $WORKAREA/cmd/$pkg
374 # use e-fence - but this will only take effect on configure
375 export MALLOCLIB=/usr/lib/libefence.a
376 make configure 2>&1 \
377 || _fail " !!! configure $pkg failed"
379 || _fail " !!! build $pkg failed"
381 _sudo make install install-dev 2>&1 \
382 || _fail " !!! install $pkg failed"
385 _log " *** build and install quota tools"
386 cd $WORKAREA/cmd/quota
389 # use e-fence - but this will only take effect on configure
390 export MALLOCLIB=/usr/lib/libefence.a
391 ( autoconf ; sh configure --prefix=/usr; make all ) 2>&1 \
392 || _fail " !!! build quota failed"
393 _sudo make install 2>&1 \
394 || _fail " !!! install quota failed"
400 _log " *** blat old modules"
402 _sudo rm -rf $MODULES
404 _log " *** install kernel"
406 _sudo cp -f $WORKAREA/linux/arch/i386/boot/bzImage $IMAGE 2>&1 \
407 || _fail " !!! install kernel failed"
408 _sudo cp -f $WORKAREA/linux/System.map $SYSTEMMAP 2>&1 \
409 || _fail " !!! install kernel failed"
410 _sudo make EXTRAVERSION=$EXTRA modules_install 2>&1 \
411 || _fail " !!! install modules failed"
413 _log " *** reinit lilo"
414 _sudo /sbin/lilo 2>&1 \
415 || _fail " !!! reinit lilo failed"
420 _log " *** select qa kernel"
421 _sudo /sbin/lilo -R linux-xfs-qa 2>&1 \
422 || _fail " !!! lilo failed"
424 _log " *** prepare to restart"
425 _change_state "restarted"
427 _log " *** restarting"
429 _restart # doesn't return
433 _log " *** QA reentered after restart"
440 _log " *** uname $uname"
441 _log " *** user tools"
442 ls -l /sbin/*xfs* /usr/sbin/*xfs* 2>&1
444 ls -l /boot/*$EXTRA* 2>&1
445 _log " *** kernel modules"
446 ls -l /lib/modules/$VERSION$EXTRA/kernel/fs/pagebuf/* \
447 /lib/modules/$VERSION$EXTRA/kernel/fs/xfs/* \
448 /lib/modules/$VERSION$EXTRA/kernel/fs/xfs_support/*
450 if [ $MODULAR -eq 0 ]
459 _log " *** modules dependencies"
461 _sudo depmod -a 2>&1 \
462 || _fail " !!! failed to depmod -a"
464 _log " *** unmounting XFS mounts"
466 _sudo umount -a -t xfs 2>&1
468 _log " *** removing modules"
470 for m in xfsidbg xfs pagebuf kdbm_pg kdbm_vm
472 _sudo rmmod $m 2> /dev/null
475 _log " *** installing modules"
477 _sudo modprobe xfs 2>&1 \
478 || _fail " !!! failed to modprobe xfs"
485 _log " *** unmounting TEST_DEV"
487 _sudo umount $TEST_DEV 2>&1
489 _log " *** unmounting SCRATCH_DEV"
491 _sudo umount $SCRATCH_DEV 2>&1
493 _log " *** clean TEST_DEV"
495 _sudo mkfs -t xfs -f $TEST_DEV 2>&1 \
496 || _fail " !!! failed to mkfs TEST_DEV"
498 _log " *** mounting TEST_DEV"
500 _sudo mount -t xfs $TEST_DEV $TEST_DIR 2>&1 \
501 || _fail " !!! failed to mount"
510 _log " *** run soak test"
511 _sudo ./soak $SOAK_PASSES $SOAK_STRESS $SOAK_PROC\
512 || _fail " !!! failed to run soak test"
520 _log " *** run tests"
521 _sudo ./check -l -g auto 2>&1 | tee $ROOT/qa.out
524 _log " *** send status mail"
525 mail -s "xfs qa status report" $EMAIL < $ROOT/qa.out 2>&1
531 _log "*** QA run complete"
538 _log " *** do nothing"
542 _fail " !!! unknown state $state"
546 _log " *** state $state done (`date`)"
547 [ "$new_state" = "" ] && _fail " !!! no new state set"
548 _change_state $new_state