bug 462271 - Sisyphus - JavaScript Tests - support autoconf built spidermonkey, r=tomcat
authorBob Clary <bclary@bclary.com>
Wed, 05 Nov 2008 13:59:23 -0800
changeset 21349 8c3fd1c530597380c3209e8d0100dd9c9a97b21b
parent 21348 6ec2df736d628d69906ee56b3d93267b239618d2
child 21350 1b53b22ecf5e99e8b0399982b9b9ff8a98d83e44
push id3495
push userbclary@mozilla.com
push dateWed, 05 Nov 2008 22:00:16 +0000
treeherdermozilla-central@8c3fd1c53059 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstomcat
bugs462271
milestone1.9.1b2pre
bug 462271 - Sisyphus - JavaScript Tests - support autoconf built spidermonkey, r=tomcat
testing/sisyphus/bin/build.sh
testing/sisyphus/bin/clobber.sh
testing/sisyphus/bin/library.sh
testing/sisyphus/bin/tester.sh
--- a/testing/sisyphus/bin/build.sh
+++ b/testing/sisyphus/bin/build.sh
@@ -76,17 +76,17 @@ case $product in
                         executablepath=$product-$buildtype/dist/Thunderbird.app/Contents/MacOS
                     elif [[ "$product" == "fennec" ]]; then
                         executablepath=$product-$buildtype/dist/Fennec.app/Contents/MacOS
                     fi
                 fi
                 ;;
             linux)
                 executablepath=$product-$buildtype/dist/bin
-            ;;
+                ;;
         esac
 
         if [[ "$OSID" != "nt" && "$product" != "fennec" ]]; then
             #
             # patch unix-like startup scripts to exec instead of 
             # forking new processes
             #
             executable=`get_executable $product $branch $executablepath`
@@ -103,27 +103,91 @@ case $product in
             if [ -e run-mozilla.sh ]; then
                 echo "$SCRIPT: patching run-mozilla.sh"
                 cp $TEST_DIR/bin/run-mozilla.diff .
                 patch -N -p0 < run-mozilla.diff
             fi
         fi
         ;;
     js)
-#    cd $BUILDTREE/mozilla/js/src
+
+        if [[ -e "$BUILDTREE/mozilla/js/src/Makefile.ref" ]]; then
+
+            # use the old-style Makefile.ref build environment for spidermonkey
+
+            if [[ $buildtype == "debug" ]]; then
+                export JSBUILDOPT=
+            else
+                export JSBUILDOPT=BUILD_OPT=1
+            fi
+
+            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT} clean" 2>&1; then
+                error "during js/src clean" $LINENO
+            fi 
+
+            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT}" 2>&1; then
+                error "during js/src build" $LINENO
+            fi
 
-    if [[ $buildtype == "debug" ]]; then
-        export JSBUILDOPT=
-    else
-        export JSBUILDOPT=BUILD_OPT=1
-    fi
+        else
+
+            # use the new fangled autoconf build environment for spidermonkey
+
+            # recreate the OBJ directories to match the old naming standards
+            TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
+            source $TEST_JSDIR/config.sh
+
+            mkdir -p "$BUILDTREE/mozilla/js/src/$JS_OBJDIR"
+
+            if [[ ! -e "$BUILDTREE/mozilla/js/src/configure" ]]; then
+
+                if findprogram autoconf-2.13; then
+                    AUTOCONF=autoconf-2.13
+                elif findprogram autoconf213; then
+                    AUTOCONF=autoconf213
+                else
+                    error "autoconf 2.13 not detected"
+                fi
 
-    if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT} clean" 2>&1; then
-        error "during js/src clean" $LINENO
-    fi 
+                cd "$BUILDTREE/mozilla/js/src"
+                eval "$AUTOCONF" 
+
+            fi
+
+            cd "$BUILDTREE/mozilla/js/src/$JS_OBJDIR"
+
+            if [[ -e "Makefile" ]]; then
+                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make clean" 2>&1; then
+                    error "during js/src clean" $LINENO
+                fi
+            fi
+
+            # XXX: Todo
+            # This reproduces the limited approach which previously existed with Makefile.ref but
+            # does not provide the full functionality provided by the available configure options.
+            # Ideally, it would be good to use a mozconfig approach (if available) that would generate
+            # the necessary configure command line arguments. This would provide the generality to
+            # specify arbitrary configure options.
+            #
 
-    if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT}" 2>&1; then
-        error "during js/src build" $LINENO
-    fi
-    ;;
+            if [[ "$buildtype" == "debug" ]]; then
+                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; ../configure --prefix=$BUILDTREE/mozilla/js/src/$JS_OBJDIR  --disable-optimize --enable-debug"; then
+                    error "during js/src/$JS_OBJDIR configure" $LINENO
+                fi
+            else
+                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; ../configure --prefix=$BUILDTREE/mozilla/js/src/$JS_OBJDIR  --enable-optimize --disable-debug"; then
+                    error "during js/src/$JS_OBJDIR configure" $LINENO
+                fi
+            fi
+
+            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make" 2>&1; then
+                error "during js/src build" $LINENO
+            fi
+
+            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make install" 2>&1; then
+                error "during js/src install" $LINENO
+            fi
+
+        fi
+        ;;
 esac
 
 
--- a/testing/sisyphus/bin/clobber.sh
+++ b/testing/sisyphus/bin/clobber.sh
@@ -37,29 +37,33 @@
 #
 # ***** END LICENSE BLOCK *****
 
 source $TEST_DIR/bin/library.sh
 source $TEST_DIR/bin/set-build-env.sh $@
 
 case $product in
     firefox|thunderbird|fennec)
-#        cd $BUILDTREE/mozilla
 
         if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla; make -f client.mk clobber" 2>&1; then
-            error "during client.mk clobber" $LINENO
+            echo "error during client.mk clobber" $LINENO
+            echo "Forcing clobber" $LINENO
+            rm -fR $BUILDTREE/mozilla/$product-$buildtype/
         fi
         ;;
 
     js)
-#        cd $BUILDTREE/mozilla/js/src/editline
-        if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/editline; make -f Makefile.ref clobber" 2>&1; then
-            error "during editline clobber" $LINENO
-        fi
+
+        if [[ -e "$BUILDTREE/mozilla/js/src/Makefile.ref" ]]; then
+            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/editline; make -f Makefile.ref clobber" 2>&1; then
+                error "during editline clobber" $LINENO
+            fi
 
-#        cd ..
-        if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref clobber" 2>&1; then
-            echo "error during SpiderMonkey clobber." $LINENO
-            echo "Forcing clobber" $LINENO
+            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref clobber" 2>&1; then
+                echo "error during SpiderMonkey clobber." $LINENO
+                echo "Forcing clobber" $LINENO
+                rm -fR $BUILDTREE/mozilla/js/src/*_*.OBJ
+            fi
+        else
             rm -fR $BUILDTREE/mozilla/js/src/*_*.OBJ
         fi
         ;;
 esac
--- a/testing/sisyphus/bin/library.sh
+++ b/testing/sisyphus/bin/library.sh
@@ -101,16 +101,28 @@ error()
     fi
     exit 2
 } 
 
 
 if [[ -z "$LIBRARYSH" ]]; then
     # skip remainder of script if it has already included
 
+    # Darwin 8.11.1's |which| does not return a non-zero exit code if the 
+    # program can not be found. Therefore, kludge around it.
+    findprogram()
+    {
+        local program=$1
+        local location=`which $program 2>&1`
+        if [[ ! -x $location ]]; then
+            return 1
+        fi
+        return 0
+    }
+
     debug()
     {
         if [[ -n "$DEBUG" ]]; then
             echo "DEBUG: $@"
         fi
     }
 
     # console msg
@@ -168,17 +180,17 @@ if [[ -z "$LIBRARYSH" ]]; then
         ulimit -a | sed 's|^|ulimit:|'
 
         if [[ -e /proc/cpuinfo ]]; then
             cat /proc/cpuinfo | sed 's|^|cpuinfo:|'
         fi
         if [[ -e /proc/meminfo ]]; then
             cat /proc/meminfo | sed 's|^|meminfo:|'
         fi
-        if which system_profiler 2> /dev/null; then
+        if findprogram system_profiler; then
             system_profiler | sed 's|^|system_profiler:|'
         fi
     }
 
     # dumpvars varname1, ...
     #
     # dumps name=value pairs to stdout for each variable named 
     # in argument list
--- a/testing/sisyphus/bin/tester.sh
+++ b/testing/sisyphus/bin/tester.sh
@@ -112,25 +112,25 @@ for data in $datalist; do
         $testscript $testargs -d $TEST_DIR/data/$data.data >> $TEST_LOG 2>&1
     fi
 
     if [[ "$XPCOM_DEBUG_BREAK" == "stack" ]]; then
         case $OSID in
             nt)
                 ;;
             linux)
-                if which fix-linux-stack.pl > /dev/null; then
+                if findprogram fix-linux-stack.pl; then
                     fix-linux-stack.pl < $TEST_LOG > $TEST_LOG.tmp
                     mv $TEST_LOG.tmp $TEST_LOG
                 else
                     error "XPCOM_DEBUG_BREAK=stack specified but fix-linux-stack.pl is not available"
                 fi
                 ;;
             darwin)
-                if which fix-macosx-stack.pl > /dev/null; then
+                if findprogram fix-macosx-stack.pl; then
                     fix-macosx-stack.pl < $TEST_LOG > $TEST_LOG.tmp
                     mv $TEST_LOG.tmp $TEST_LOG
                 else
                     error "XPCOM_DEBUG_BREAK=stack specified but fix-macosx-stack.pl is not available"
                 fi
                 ;;
         esac
     fi