Update Samba build farm to new web site layout.
[build-farm.git] / build_test.fns
index 496bf7f89fbeb34dc98121176a10ed435fada92d..3d66fc559e38b99cbd62b801a7479c075e4e5c04 100644 (file)
@@ -164,7 +164,7 @@ choose_scm() {
        tree=$1
 
        case "$tree" in
-                       samba* | rsync | libreplace | talloc | tdb | ldb | pidl | ccache* | waf*)
+                       samba* | rsync | libreplace | talloc | tdb | ntdb | ldb | pidl | ccache* | waf*)
                        echo "git"
                                return 0
                        ;;
@@ -196,7 +196,9 @@ lock_file() {
                        return 0
                fi
 
-               if test -f "$lckf"; then
+               # We need to assert that the file is > 0 size, as otherwise we never
+                # recover from disk full situations
+               if test -f "$lckf" && test -s "$lckf"; then
                        test x$machine = x$host || {
                                echo "lock file $lckf is valid for other machine $machine"
                                return 1
@@ -253,7 +255,7 @@ do_make() {
        MMTIME=$MAXTIME
        # some trees don't need as much time
        case "$tree" in
-               rsync | tdb | talloc | libreplace | ccache* | waf*)
+               rsync | tdb | ntdb | talloc | libreplace | ccache* | waf*)
                        if [ "$compiler" != "checker" ]; then
                                MMTIME=`expr $MMTIME / 5`
                        fi
@@ -318,12 +320,11 @@ action_lcovreport() {
                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*|tdb|ntdb|talloc|ldb|libreplace)
+                       lcov --base-directory $builddir/bin --directory $builddir/bin --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
+               waf)
+                       lcov --base-directory $builddir/demos --directory $builddir/demos --capture --output-file $builddir/$tree.lcov.info
                        ;;
                *)
                        lcov --base-directory $builddir --directory $builddir --capture --output-file $builddir/$tree.lcov.info
@@ -339,13 +340,33 @@ action_lcovreport() {
        fi
 }
 
+action_callcatcherreport() {
+       if [ "$CALLCATCHER_REPORT" = "yes" ]; then
+               case "$tree" in
+               tdb|ntdb|talloc|ldb)
+                       callanalyse `find $builddir/bin -name \*.so*` $builddir/bin/* > $builddir/coverage/unused-fns.txt
+                       ;;
+               samba_4*)
+                       callanalyse `find $builddir/bin -name \*.so*` $builddir/bin/* > $builddir/coverage/all-unused-fns.txt 
+                       grep -v -f $srcdir/callcatcher-exceptions.grep $builddir/coverage/all-unused-fns.txt > $builddir/coverage/unused-fns.txt
+                       ;;
+               esac
+               rc=$?
+               echo "return code: $rc"
+       else
+               echo "CALLCATCHER_REPORT not set and callcatcher asked"
+               echo "Most probably an error please fix !"
+               return 1
+       fi
+}
+
 
 ############################
 # configure the tree
 ############################
 
 action_configure() {
-
+        # special handling for some trees
        case "$tree" in
            waf*)
                $builddir/timelimit $MAXTIME ./waf configure
@@ -417,7 +438,7 @@ action_config_log() {
 ############################
 
 action_config_header() {
-       hdr_files="config.h include/config.h bin/default/config.h bin/default/source4/include/config.h bin/default/source3/include/config.h"
+       hdr_files="config.h include/config.h include/autoconf/config.h bin/default/config.h bin/default/include/config.h bin/default/source3/include/config.h"
        for h in $hdr_files; do
                if [ -f $h ]; then
                        echo "contents of $h:"
@@ -555,6 +576,14 @@ action_test() {
        esac
 }
 
+#############################
+# Do nothing (needed if we have nothing to do for extra_actions)
+#############################
+
+action_none() {
+    return 0;
+}
+
 ###########################
 # do a test build of a particular tree
 # This is the master function called by generic.fns or
@@ -586,9 +615,9 @@ test_tree() {
        # darn, this affects sparse files too! disable it
        # ulimit -f 100000 2> /dev/null
 
-       # try and limit the number of open files to 250. That means we'll discover
-       # fd leaks faster
-       ulimit -n 250 2> /dev/null
+       # try and limit the number of open files to 500, up from 250. That means we'll discover
+       # fd leaks faster while allowing our very complex make test to run
+       ulimit -n 500 2> /dev/null
 
        # Keep stuff private
        umask 077
@@ -722,9 +751,9 @@ test_tree() {
                sw_config="$config --enable-socket-wrapper"
                ;;
        samba_4*)
-               sw_config="$config --enable-socket-wrapper"
-               sw_config="$sw_config --enable-nss-wrapper"
-               sw_config="$sw_config --enable-uid-wrapper"
+               sw_config="$config --enable-selftest"
+               sw_config="$sw_config --with-perl-lib-install-dir=$prefix/perl.lib"
+               sw_config="$sw_config --with-perl-arch-install-dir=$prefix/perl.arch"
                ;;
        samba_3*)
                sw_config="$config --enable-socket-wrapper"
@@ -740,6 +769,8 @@ test_tree() {
        esac
 
        if [ "$LCOV_REPORT" = "yes" ]; then
+               PRE_GCOV_CFLAGS=$CFLAGS
+               PRE_GCOV_LDFLAGS=$LDFLAGS
                GCOV_FLAGS="--coverage"
                CFLAGS="$CFLAGS $GCOV_FLAGS" 
                LDFLAGS="$LDFLAGS $GCOV_FLAGS" 
@@ -758,6 +789,11 @@ test_tree() {
                send_logs_skip "$log" "$err"
                unlock_file "$lck"
                echo "Ending build of $tree.$compiler in process $$ at `date`"
+               if [ "$LCOV_REPORT" = "yes" ]; then
+                   CFLAGS=$PRE_GCOV_CFLAGS
+                   LDFLAGS=$PRE_GCOV_LDFLAGS
+                   export CFLAGS LDFLAGS
+               fi
                return
        fi
 
@@ -767,11 +803,16 @@ test_tree() {
 
        #Action == what to do ie. configure config_log ...
        actions="$*"
+       extra_actions="$EXTRA_ACTIONS"
 
        if [ "$actions" = "" ]; then
                actions="configure config_log config_header build install test"
        fi
 
+       if [ "$extra_actions" = "" ]; then
+               extra_actions="none"
+       fi
+
        # start the build
        (
        {
@@ -877,6 +918,54 @@ test_tree() {
                        fi
                done
 
+               for action in $extra_actions; do
+                       if [ "x$action" = "x" ]; then
+                              break;
+                       fi
+
+                       echo Running action $action
+
+                       date
+
+                       cd $builddir || exit 1
+                       export srcdir
+                       df .
+                       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
+
+                       if [ $action_status != 0 ]; then 
+                               break;
+                       fi
+               done
+
 
                if [ "$noclean" = "yes" ]; then
                        echo cleanup skipped!
@@ -894,6 +983,9 @@ test_tree() {
                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/
+               CFLAGS=$PRE_GCOV_CFLAGS
+               LDFLAGS=$PRE_GCOV_LDFLAGS
+               export CFLAGS LDFLAGS
        fi
 
        cd $test_root
@@ -956,7 +1048,7 @@ per_run_hook() {
 
        old_trees="web popt distcc samba-gtk smb-build lorikeet-heimdal samba_3_2"
        old_trees="$old_tree samba_3_2_test samba4 samba_4_0_waf samba_4_0_waf.metze"
-       old_trees="$old_tree samba_3_X_test samba_3_X_devel samba_3_X_devel"
+       old_trees="$old_tree samba_3_X_test samba_3_X_devel samba_3_X_devel samba_3_waf samba_3_master tdb2"
        for d in $old_trees; do
                delete_old_tree $d
        done