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 export WORKAREA="$ROOT/linux-xfs"
80 export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/ptools:/usr/local/bin"
82 QADIR="$WORKAREA/cmd/xfs/stress"
84 IMAGE="$BOOT/vmlinuz-$VERSION$EXTRA"
85 SYSTEMMAP="$BOOT/System.map-$VERSION$EXTRA"
86 CONFIG="$ROOT/$HOST-$VERSION$EXTRA.config"
87 MODULES="/lib/modules/$VERSION$EXTRA"
89 SELF_UPDATE="cmd/xfs/tools/auto-qa"
90 COMMON_CONFIG="$WORKAREA/cmd/xfs/stress/common.config"
94 # need to add auto-qa hosts here
100 ADMINEMAIL="dxm@larry"
105 ADMINEMAIL="dxm@larry"
110 ADMINEMAIL="dxm@larry"
114 EMAIL="nathans@larry"
115 ADMINEMAIL="nathans@larry"
119 _fail "auto-qa: no configuration information for host '$HOST'"
123 # do some cleanup on exit
127 umount $SCRATCH_DEV &> /dev/null
128 umount $TEST_DEV &> /dev/null
129 if [ "$started" = 1 ]
131 echo "auto-qa stopped" | wall
136 trap "_cleanup; exit \$status" 0 1 2 3 15
170 _set_state `echo $state | sed "s/-.*$/-$new/"`
182 $ROOT/su -c "$*" < /dev/null ;# HACK - we need a hacked su at the mo
187 exec $ROOT/su -c "shutdown -r 2 \"auto-qa rebooting\" &" < /dev/null
190 _log "*** linux-xfs QA (`date`)"
194 # check preconditions for starting state
203 _fail " !!! cron-init while not in \"*done\" state"
208 # we don't auto restart after reboot, but cron the restart
209 # to happen a bit later - it's much easier and safer that way
210 if [ $state != "cron-restarted" ]
212 _fail " !!! cron-restarted while not in \"cron-restarted\" state"
222 [ $UID -eq 0 ] && _fail " !!! QA most be run as a normal user"
223 [ -d $ROOT ] || _fail " !!! QA root \"$ROOT\" not found"
224 [ -d $WORKAREA ] || _fail " !!! QA workarea \"$WORKAREA\" not found"
225 [ -r $CONFIG ] || _fail " !!! Can't read config file $CONFIG"
226 . $COMMON_CONFIG || _fail " !!! Couldn't source $COMMON_CONFIG"
231 echo "auto-qa started" | wall
237 _log " *** state $state start (`date`)"
238 _log " (user=$USER, host=$HOST)"
244 echo "" > $ROOT/qa.log
245 echo "" > $ROOT/qa.full
246 _log "******************************************"
247 _log "QA init (`date`)"
248 _log "******************************************"
250 _change_state "inited"
251 exec $SH -c "cd $WORKAREA ; p_tupdate $SELF_UPDATE ; chmod +x $SELF_UPDATE ; exec $SELF"
255 _log " *** QA initialized"
260 _log " *** p_tupdate"
263 || _fail " !!! p_tupdate failed"
265 _log " *** p_check/p_purge"
267 p_check -s | p_purge -yiu 2>&1 \
268 || _fail " !!! p_check/p_purge failed"
270 _log " *** non-trunk files"
273 || _fail " !!! p_list failed"
279 # we need to configure or else we might fail to clean stress/src
280 _log " *** configure for clean"
282 make configure 2>&1 \
283 || _fail " !!! configure for clean failed"
285 _log " *** clean stress/src"
286 cd $WORKAREA/cmd/xfs/stress/src
288 || _fail " !!! clean stress/src failed"
290 _log " *** clean xfs tools"
292 make realclean 2>&1 \
293 || _fail " !!! clean tools failed"
295 _log " *** clean quota tools"
296 cd $WORKAREA/cmd/quota
297 ( rm -f configure ; autoconf ; sh configure ; make clean ) 2>&1 \
298 || _fail " !!! clean quota failed"
301 cd $WORKAREA/cmd/xfs/stress
302 rm -f *.full *.bad *.log *.time *.core core 2>&1 \
303 || _fail " !!! clean qa failed"
305 _log " *** clean linux"
308 || _fail " !!! clean linux failed"
310 _log " *** install configuration file"
311 cp -f $CONFIG $WORKAREA/linux/.config 2>&1 \
312 || _fail " !!! failed to install config"
314 _log " *** remove version file"
315 rm -f include/linux/version.h 2>&1 \
316 || _fail " !!! failed to clean version"
323 _log " *** reconfig kernel"
325 _change_state "clean" ;# if this fails, we'd better start from scratch
328 # we want to use default options for any new config options.
329 echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | \
330 make EXTRAVERSION=$EXTRA oldconfig 2>&1 \
331 || _fail " !!! reconfig oldconfig failed"
332 make EXTRAVERSION=$EXTRA dep 2>&1 \
333 || _fail " !!! reconfig dep failed"
339 _log " *** build kernel"
341 _change_state "clean" ;# if this fails, we'd better start from scratch
344 make -j2 EXTRAVERSION=$EXTRA bzImage 2>&1 \
345 || _fail " !!! build bzImage failed"
346 make -j2 EXTRAVERSION=$EXTRA modules 2>&1 \
347 || _fail " !!! build modules failed"
349 _log " *** build tools"
352 # use e-fence - but this will only take effect on configure
353 export MALLOCLIB=/usr/lib/libefence.a
354 make configure 2>&1 \
355 || _fail " !!! configure tools failed"
357 || _fail " !!! build tools failed"
359 _log " *** build quota tools"
360 cd $WORKAREA/cmd/quota
362 # use e-fence - but this will only take effect on configure
363 export MALLOCLIB=/usr/lib/libefence.a
364 ( rm -f configure ; autoconf ; sh configure ; make all ) 2>&1 \
365 || _fail " !!! build quota failed"
367 _log " *** build stress/src"
368 cd $WORKAREA/cmd/xfs/stress/src
371 || _fail " !!! build stress/src failed"
377 _log " *** blat old modules"
379 _sudo rm -rf $MODULES
381 _log " *** install kernel"
383 _sudo cp -f $WORKAREA/linux/arch/i386/boot/bzImage $IMAGE 2>&1 \
384 || _fail " !!! install kernel failed"
385 _sudo cp -f $WORKAREA/linux/System.map $SYSTEMMAP 2>&1 \
386 || _fail " !!! install kernel failed"
387 _sudo make EXTRAVERSION=$EXTRA modules_install 2>&1 \
388 || _fail " !!! install modules failed"
390 _log " *** install xfs tools"
392 _sudo make install 2>&1 \
393 || _fail " !!! install tools failed"
395 _log " *** install quota tools"
396 cd $WORKAREA/cmd/quota
397 _sudo make install 2>&1 \
398 || _fail " !!! install quota failed"
400 _log " *** reinit lilo"
401 _sudo /sbin/lilo 2>&1 \
402 || _fail " !!! reinit lilo failed"
407 _log " *** select qa kernel"
408 _sudo /sbin/lilo -R linux-xfs-qa 2>&1 \
409 || _fail " !!! lilo failed"
411 _log " *** prepare to restart"
412 _change_state "restarted"
414 _log " *** restarting"
416 _restart # doesn't return
420 _log " *** QA reentered after restart"
427 _log " *** uname $uname"
428 _log " *** user tools"
429 ls -l /sbin/*xfs* /usr/sbin/*xfs* 2>&1
431 ls -l /boot/*$EXTRA* 2>&1
432 _log " *** kernel modules"
433 ls -l /lib/modules/$VERSION$EXTRA/kernel/fs/pagebuf/* \
434 /lib/modules/$VERSION$EXTRA/kernel/fs/xfs/* \
435 /lib/modules/$VERSION$EXTRA/kernel/fs/xfs/support/*
437 if [ $MODULAR -eq 0 ]
446 _log " *** modules dependencies"
448 _sudo depmod -a 2>&1 \
449 || _fail " !!! failed to depmod -a"
451 _log " *** unmounting XFS mounts"
453 _sudo umount -a -t xfs 2>&1
455 _log " *** removing modules"
457 for m in xfsidbg xfs pagebuf kdbm_pg kdbm_vm
459 _sudo rmmod $m 2> /dev/null
462 _log " *** installing modules"
464 _sudo modprobe xfs 2>&1 \
465 || _fail " !!! failed to modprobe xfs"
472 _log " *** unmounting TEST_DEV"
474 _sudo umount $TEST_DEV 2>&1
476 _log " *** unmounting SCRATCH_DEV"
478 _sudo umount $SCRATCH_DEV 2>&1
480 _log " *** clean TEST_DEV"
482 _sudo mkfs -t xfs -f $TEST_DEV 2>&1 \
483 || _fail " !!! failed to mkfs TEST_DEV"
485 _log " *** mounting TEST_DEV"
487 _sudo mount -t xfs $TEST_DEV $TEST_DIR 2>&1 \
488 || _fail " !!! failed to mount"
497 _log " *** run soak test"
498 _sudo ./soak $SOAK_PASSES $SOAK_STRESS $SOAK_PROC\
499 || _fail " !!! failed to run soak test"
507 _log " *** run tests"
508 _sudo ./check -l -g auto 2>&1 | tee $ROOT/qa.out
511 _log " *** send status mail"
512 mail -s "xfs qa status report" $EMAIL < $ROOT/qa.out 2>&1
518 _log "*** QA run complete"
525 _log " *** do nothing"
529 _fail " !!! unknown state $state"
533 _log " *** state $state done (`date`)"
534 [ "$new_state" = "" ] && _fail " !!! no new state set"
535 _change_state $new_state