fix after xfs_support change & tweak reboot
[xfstests-dev.git] / tools / auto-qa
index fb06ec70ea6cf1a874999551361f45dcdeac7fdb..89796d0dbe2bb28df3cb9fb5fd5c0b8622c88aa8 100755 (executable)
@@ -65,7 +65,7 @@ _fail()
 # configuration (you could tune this)
 
 EXTRA="-xfs-qa"
-VERSION="2.4.0"
+VERSION="2.4.2"
 BOOT="/boot"
 SOAK_PASSES="-1"
 SOAK_STRESS="10000"
@@ -75,7 +75,12 @@ SOAK_PROC="3"
 
 ROOT="$HOME/qa"
 HOST=`hostname -s`
-export WORKAREA="$ROOT/linux-xfs"
+if [ ! -z "$CVSROOT" ]; then
+    WORKAREA="$ROOT/linux-2.4-xfs"
+else
+    [ -z "$WORKAREA" ] && WORKAREA="$ROOT/linux-xfs"
+fi
+export WORKAREA
 
 export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/ptools:/usr/local/bin"
 STATE=$ROOT/qa.state
@@ -83,10 +88,8 @@ QADIR="$WORKAREA/cmd/xfstests"
 SUDO="su -c"
 IMAGE="$BOOT/vmlinuz-$VERSION$EXTRA"
 SYSTEMMAP="$BOOT/System.map-$VERSION$EXTRA"
-CONFIG="$ROOT/$HOST-$VERSION$EXTRA.config"
+CONFIG="$ROOT/$HOST.config"
 MODULES="/lib/modules/$VERSION$EXTRA"
-SELF="$ROOT/auto-qa"
-SELF_UPDATE="cmd/xfstests/tools/auto-qa"
 COMMON_CONFIG="$WORKAREA/cmd/xfstests/common.config"
 SH="/bin/sh"
 LOG="$ROOT/qa.log"
@@ -115,6 +118,11 @@ in
        ADMINEMAIL="nathans@larry"
        MODULAR=0
        ;;
+    goldfish)
+       EMAIL="nathans@larry"
+       ADMINEMAIL="nathans@larry"
+       MODULAR=1
+       ;;
     *)
         _fail "auto-qa: no configuration information for host '$HOST'"
         ;;
@@ -184,9 +192,47 @@ _sudo()
 
 _restart()
 {
-    exec $ROOT/su -c "shutdown -r 2 \"auto-qa rebooting\" &" < /dev/null
+    # erk - why won't this thing reboot reliably??
+    exec $ROOT/su -c "(shutdown -r 2 \"auto-qa rebooting\" ; sleep 10 ; reboot ; sleep 10 ; reboot )&" < /dev/null
+}
+
+_update_autoqa_file()
+{
+    SELF="$ROOT/auto-qa"
+    SELF_UPDATE="cmd/xfstests/tools/auto-qa"
+    if [ -z "$CVSROOT" ]; then
+           cmd="p_tupdate $SELF_UPDATE"
+    else
+           cmd="cvs -z3 update $SELF_UPDATE"
+    fi
+    exec $SH -c "cd $WORKAREA ; $cmd; chmod +x $SELF_UPDATE ; exec $SELF"
 }
 
+_update_workarea()
+{
+    if [ -z "$CVSROOT" ]; then
+       _log "        *** p_tupdate"
+       cd $WORKAREA 
+       p_tupdate 2>&1 \
+                       || _fail "            !!! p_tupdate failed"
+
+       _log "        *** p_check/p_purge"
+       cd $WORKAREA 
+       p_check -s | p_purge -yiu 2>&1 \
+                       || _fail "            !!! p_check/p_purge failed"
+
+       _log "        *** non-trunk files"
+       cd $WORKAREA 
+       p_list -c 2>&1 \
+                       || _fail "            !!! p_list failed"
+    else
+       _log "        *** cvs update"
+       cd $WORKAREA
+       cvs -z3 update -d
+    fi
+}
+            
+
 _log "*** linux-xfs QA (`date`)"
 
 _get_state
@@ -248,7 +294,7 @@ do
             _log "******************************************"
 
             _change_state "inited"
-            exec $SH -c "cd $WORKAREA ; p_tupdate $SELF_UPDATE ; chmod +x $SELF_UPDATE ; exec $SELF"
+            _update_autoqa_file
             ;;
             
         *inited)
@@ -257,53 +303,37 @@ do
             ;;
         
         *update)
-            _log "        *** p_tupdate"
-            cd $WORKAREA 
-            p_tupdate 2>&1 \
-                                    || _fail "            !!! p_tupdate failed"
-
-            _log "        *** p_check/p_purge"
-            cd $WORKAREA 
-            p_check -s | p_purge -yiu 2>&1 \
-                                    || _fail "            !!! p_check/p_purge failed"
-
-            _log "        *** non-trunk files"
-            cd $WORKAREA 
-            p_list -c 2>&1 \
-                                    || _fail "            !!! p_list failed"
-
+            _update_workarea
             new_state="clean"
             ;;
-            
+
         *clean)
             # we need to configure or else we might fail to clean
             for pkg in attr acl xfsprogs xfsdump xfstests
+           do
                 cd $WORKAREA/cmd/$pkg
-                _log "        *** configure $pkg for clean"
-                make configure 2>&1 \
-                                    || _fail "            !!! configure $pkg for clean failed"
                 _log "        *** clean $pkg tools"
                 make realclean 2>&1 \
-                                    || _fail "            !!! clean $pkg failed"
+                        || _fail "            !!! clean $pkg failed"
             done
 
             _log "        *** clean quota tools"
             cd $WORKAREA/cmd/quota
             ( rm -f configure ; autoconf ; sh configure ; make clean ) 2>&1 \
-                                    || _fail "            !!! clean quota failed"
+                        || _fail "            !!! clean quota failed"
 
             _log "        *** clean linux"
             cd $WORKAREA/linux
             make mrproper 2>&1 \
-                                    || _fail "            !!! clean linux failed"
+                        || _fail "            !!! clean linux failed"
 
             _log "        *** install configuration file"
             cp -f $CONFIG $WORKAREA/linux/.config 2>&1 \
-                                    || _fail "            !!! failed to install config"
+                        || _fail "            !!! failed to install config"
             
             _log "        *** remove version file"
             rm -f include/linux/version.h 2>&1 \
-                                    || _fail "            !!! failed to clean version"
+                        || _fail "            !!! failed to clean version"
 
             new_state="reconfig"
             ;;
@@ -312,15 +342,15 @@ do
         
             _log "        *** reconfig kernel"
             
-            _change_state "clean" ;# if this fails, we'd better start from scratch
+            _change_state "clean" ; # we better start from scratch if this fails
             
             cd $WORKAREA/linux
             # we want to use default options for any new config options.
             echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | \
                 make EXTRAVERSION=$EXTRA oldconfig 2>&1 \
-                                    || _fail "            !!! reconfig oldconfig failed"
+                        || _fail "            !!! reconfig oldconfig failed"
             make EXTRAVERSION=$EXTRA dep 2>&1 \
-                                    || _fail "            !!! reconfig dep failed"
+                        || _fail "            !!! reconfig dep failed"
 
             new_state="build"
             ;;
@@ -328,13 +358,13 @@ do
         *build)
             _log "        *** build kernel"
             
-            _change_state "clean" ;# if this fails, we'd better start from scratch
+            _change_state "clean" ; # we better start from scratch if this fails
             
             cd $WORKAREA/linux
             make -j2 EXTRAVERSION=$EXTRA bzImage 2>&1 \
-                                    || _fail "            !!! build bzImage failed"
+                        || _fail "            !!! build bzImage failed"
             make -j2 EXTRAVERSION=$EXTRA modules 2>&1 \
-                                    || _fail "            !!! build modules failed"
+                        || _fail "            !!! build modules failed"
                                     
             _log "        *** build and install tools"
             for pkg in attr acl xfsprogs xfsdump xfstests 
@@ -344,23 +374,24 @@ do
                 # use e-fence - but this will only take effect on configure
                 export MALLOCLIB=/usr/lib/libefence.a
                 make configure 2>&1 \
-                                    || _fail "            !!! configure $pkg failed"
+                        || _fail "            !!! configure $pkg failed"
                 make default 2>&1 \
-                                    || _fail "            !!! build $pkg failed"
+                        || _fail "            !!! build $pkg failed"
 
                 _sudo make install install-dev 2>&1 \
-                                    || _fail "            !!! install $pkg failed"
+                        || _fail "            !!! install $pkg failed"
             done
 
             _log "        *** build and install quota tools"
             cd $WORKAREA/cmd/quota
+            rm -f configure
             
             # use e-fence - but this will only take effect on configure
             export MALLOCLIB=/usr/lib/libefence.a
-            ( rm -f configure ; autoconf ; sh configure ; make all ) 2>&1 \
-                                    || _fail "            !!! build quota failed"
+            ( autoconf ; sh configure --prefix=/usr; make all ) 2>&1 \
+                        || _fail "            !!! build quota failed"
             _sudo make install 2>&1 \
-                                    || _fail "            !!! install quota failed"
+                        || _fail "            !!! install quota failed"
 
             new_state="install"
             ;;
@@ -373,22 +404,22 @@ do
             _log "        *** install kernel"
             cd $WORKAREA/linux
             _sudo cp -f $WORKAREA/linux/arch/i386/boot/bzImage $IMAGE 2>&1 \
-                                    || _fail "            !!! install kernel failed"
+                        || _fail "            !!! install kernel failed"
             _sudo cp -f $WORKAREA/linux/System.map $SYSTEMMAP 2>&1 \
-                                    || _fail "            !!! install kernel failed"
+                        || _fail "            !!! install kernel failed"
             _sudo make EXTRAVERSION=$EXTRA modules_install 2>&1 \
-                                    || _fail "            !!! install modules failed"
+                        || _fail "            !!! install modules failed"
 
             _log "        *** reinit lilo"
             _sudo /sbin/lilo 2>&1 \
-                                    || _fail "            !!! reinit lilo failed"
+                        || _fail "            !!! reinit lilo failed"
             new_state="restart"
             ;;
             
         *restart)
             _log "            *** select qa kernel"
             _sudo /sbin/lilo -R linux-xfs-qa 2>&1 \
-                                    || _fail "            !!! lilo failed"
+                        || _fail "            !!! lilo failed"
             
             _log "            *** prepare to restart"
             _change_state "restarted"
@@ -414,7 +445,7 @@ do
             _log "            *** kernel modules"
             ls -l /lib/modules/$VERSION$EXTRA/kernel/fs/pagebuf/* \
                   /lib/modules/$VERSION$EXTRA/kernel/fs/xfs/*     \
-                  /lib/modules/$VERSION$EXTRA/kernel/fs/xfs/support/* 
+                  /lib/modules/$VERSION$EXTRA/kernel/fs/xfs_support/* 
             
             if [ $MODULAR -eq 0 ]
             then
@@ -428,7 +459,7 @@ do
             _log "            *** modules dependencies"
             
             _sudo depmod -a  2>&1 \
-                                    || _fail "            !!! failed to depmod -a" 
+                        || _fail "            !!! failed to depmod -a" 
             
             _log "            *** unmounting XFS mounts"
             
@@ -444,7 +475,7 @@ do
             _log "            *** installing modules"
 
            _sudo modprobe xfs 2>&1 \
-                                    || _fail "            !!! failed to modprobe xfs"
+                        || _fail "            !!! failed to modprobe xfs"
 
             new_state="reset"
             ;;
@@ -462,12 +493,12 @@ do
             _log "            *** clean TEST_DEV"
             
             _sudo mkfs -t xfs -f $TEST_DEV 2>&1 \
-                                    || _fail "            !!! failed to mkfs TEST_DEV"
+                        || _fail "            !!! failed to mkfs TEST_DEV"
             
             _log "            *** mounting TEST_DEV"
             
             _sudo mount -t xfs $TEST_DEV $TEST_DIR 2>&1 \
-                                    || _fail "            !!! failed to mount"
+                        || _fail "            !!! failed to mount"
                                     
             new_state="run"
             ;;
@@ -478,7 +509,7 @@ do
             
             _log "            *** run soak test"
             _sudo ./soak $SOAK_PASSES $SOAK_STRESS $SOAK_PROC\
-                                    || _fail "            !!! failed to run soak test"
+                        || _fail "            !!! failed to run soak test"
 
             new_state="done"
             ;;