Sane error message on unknown revision.
[build-farm.git] / build_test.fns
index 7ed0ed0e3f1bdb0101041e7a65fd3f7f59d7ebf4..b7649bde3db5bbfd80774fe7ebc21ccba4831a39 100644 (file)
@@ -7,11 +7,13 @@
 # Copyright (C) 2001, 2003 by Martin Pool <mbp@samba.org>
 
 # default maximum runtime for any command
-MAXTIME=12000
+MAXTIME=25200 # 7 hours
+SMBD_MAXTIME=18000 # 5 hours for a samba process ..
 # default maximum memory size (100M) for any command
 MAXMEM=100000
 RUN_FROM_BUILD_FARM=yes
 export RUN_FROM_BUILD_FARM
+export MAXTIME SMBD_MAXTIME
 
 deptrees="";
 
@@ -195,7 +197,7 @@ lock_file() {
                fi
 
                if test -f "$lckf"; then
-                       test $machine = $host || {
+                       test x$machine = x$host || {
                                echo "lock file $lckf is valid for other machine $machine"
                                return 1
                        }
@@ -289,6 +291,39 @@ do_make() {
        return 0
 }
 
+
+############################
+# do the coverage report
+############################
+
+action_lcovreport() {
+       if [ "$LCOV_REPORT" = "yes" ]; then
+               case "$tree" in
+               lorikeet-heimdal*)
+                       lcov --directory $builddir --capture --output-file $builddir/$tree.lcov.info
+                       ;;
+               samba_3_master*)
+                       lcov --base-directory $builddir --directory $builddir/.. --capture --output-file $builddir/$tree.lcov.info
+                       ;;
+               samba_4*)
+                       # rm -f heimdal/lib/*/{lex,parse,sel-lex}.{gcda,gcno}
+                       lcov --base-directory $builddir --directory $builddir/.. --capture --output-file $builddir/$tree.lcov.info
+                       ;;
+               *)
+                       lcov --base-directory $builddir --directory $builddir --capture --output-file $builddir/$tree.lcov.info
+                       ;;
+               esac
+               genhtml -o $builddir/coverage $builddir/$tree.lcov.info
+               rc=$?
+               echo "return code: $rc"
+       else
+               echo "LCOV_REPORT not set and lcovreport asked"
+               echo "Most probably an error please fix !"
+               return 1
+       fi
+}
+
+
 ############################
 # configure the tree
 ############################
@@ -774,13 +809,30 @@ test_tree() {
                        mount
                        vmstat
 
+                       if [ "x$PREHOOKS" != "x" ]; then
+                               for hooks in $PREHOOKS; do
+                                       if [ "x$hooks" = "x$action" ]; then
+                                               ( prehook_$action )
+                                       fi
+                               done
+                       fi
+
                        ( action_$action )
                        action_status=$?
 
+                       if [ "x$POSTHOOKS" != "x" ]; then
+                               for hooks in $POSTHOOKS; do
+                                       if [ "x$hooks" = "x$action" ]; then
+                                               ( posthook_$action )
+                                       fi
+                               done
+                       fi
+
                        df .
 
                        if [ $action_status != 0 ]; then
                                echo "ACTION FAILED: $action";
+                               echo " return code $action_status $action";
                        else
                                echo "ACTION PASSED: $action";
                        fi
@@ -790,26 +842,6 @@ test_tree() {
                        fi
                done
 
-               if [ "$LCOV_REPORT" = "yes" ]; then
-                       case "$tree" in
-                       lorikeet-heimdal*)
-                               lcov --directory $builddir --capture --output-file $builddir/$tree.lcov.info
-                               ;;
-                       samba_3_master*)
-                               lcov --base-directory $builddir --directory $builddir/.. --capture --output-file $builddir/$tree.lcov.info
-                               ;;
-                       samba_4*)
-                               # ugly hack for s4, as lcov is otherwise not able to find 
-                               # these files
-                               rm -f heimdal/lib/*/{lex,parse,sel-lex}.{gcda,gcno}
-                               lcov --base-directory $builddir --directory $builddir/.. --capture --output-file $builddir/$tree.lcov.info
-                               ;;
-                       *)
-                               lcov --base-directory $builddir --directory $builddir --capture --output-file $builddir/$tree.lcov.info
-                               ;;
-                       esac
-                       genhtml -o $builddir/coverage $builddir/$tree.lcov.info
-               fi
 
                if [ "$noclean" = "yes" ]; then
                        echo cleanup skipped!
@@ -826,7 +858,7 @@ test_tree() {
        if [ "$LCOV_REPORT" = "yes" ]; then
                chmod u=rwX,g=rX,o=rX -R $builddir/coverage
                rsync -rct -q --password-file=.password -z --timeout=200 \
-               $builddir/coverage/ $host@build.samba.org::lcov_data/$host/$tree/
+                       $builddir/coverage/ $host@build.samba.org::lcov_data/$host/$tree/
        fi
 
        cd $test_root