Bug 1250709 - Extract out hazard logic to a separate file, r=garndt
☠☠ backed out by 6ce797db2a45 ☠ ☠
authorSteve Fink <sfink@mozilla.com>
Thu, 11 Feb 2016 20:28:08 -0800
changeset 288692 c73617bdfdfa52f98c33b46586eec0ad2e695193
parent 288691 901b1c651c982ccbf42604231c723d168e1cde69
child 288693 b5bffc3757191411f15de9f8ed432f64fe69703c
push id30087
push usercbook@mozilla.com
push dateTue, 15 Mar 2016 09:43:43 +0000
treeherdermozilla-central@5e14887312d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgarndt
bugs1250709
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1250709 - Extract out hazard logic to a separate file, r=garndt
testing/taskcluster/scripts/builder/build-mulet-haz-linux.sh
testing/taskcluster/scripts/builder/hazard-analysis.sh
--- a/testing/taskcluster/scripts/builder/build-mulet-haz-linux.sh
+++ b/testing/taskcluster/scripts/builder/build-mulet-haz-linux.sh
@@ -1,69 +1,22 @@
 #!/bin/bash -ex
 
 ################################### build-mulet-haz-linux.sh ###################################
 # Ensure all the scripts in this dir are on the path....
 DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 PATH=$DIRNAME:$PATH
 
 . desktop-setup.sh
-
-# Install the sixgill tool
-TOOLTOOL_MANIFEST=js/src/devtools/rootAnalysis/build/sixgill.manifest
-. install-packages.sh "$GECKO_DIR"
-
-# Build a shell to use to run the analysis
-HAZARD_SHELL_OBJDIR=$MOZ_OBJDIR/obj-haz-shell
-JS_SRCDIR=$GECKO_DIR/js/src
-ANALYSIS_SRCDIR=$JS_SRCDIR/devtools/rootAnalysis
+. hazard-analysis.sh
 
-( cd $JS_SRCDIR; autoconf-2.13 )
-mkdir -p $HAZARD_SHELL_OBJDIR || true
-cd $HAZARD_SHELL_OBJDIR
-export CC="$GECKO_DIR/gcc/bin/gcc"
-export CXX="$GECKO_DIR/gcc/bin/g++"
-$JS_SRCDIR/configure --enable-optimize --disable-debug --enable-ctypes --enable-nspr-build --without-intl-api --with-ccache
-make -j4
+build_js_shell
 
-# configure the analysis
-mkdir -p $WORKSPACE/analysis || true
-cd $WORKSPACE/analysis
-cat > defaults.py <<EOF
-js = "$HAZARD_SHELL_OBJDIR/dist/bin/js"
-analysis_scriptdir = "$ANALYSIS_SRCDIR"
-objdir = "$MOZ_OBJDIR"
-source = "$GECKO_DIR"
-sixgill = "$GECKO_DIR/sixgill/usr/libexec/sixgill"
-sixgill_bin = "$GECKO_DIR/sixgill/usr/bin"
-EOF
-
-# run the analysis (includes building the tree)
-python $ANALYSIS_SRCDIR/analyze.py --buildcommand=$GECKO_DIR/testing/mozharness/scripts/spidermonkey/build.b2g
-
-### Extract artifacts
+configure_analysis "$WORKSPACE/analysis"
+run_analysis "$WORKSPACE/analysis" b2g
 
 # Artifacts folder is outside of the cache.
 mkdir -p $HOME/artifacts/ || true
 
-cd $WORKSPACE/analysis
-ls -lah
-
-for f in *.txt *.lst; do
-    gzip -9 -c "$f" > "$HOME/artifacts/$f.gz"
-done
-
-# Check whether the user requested .xdb file upload in the top commit comment
-
-if hg log -l1 --template '{desc}\n' | grep -q 'haz: --upload-xdbs'; then
-    for f in *.xdb; do
-        bzip2 -c "$f" > "$HOME/artifacts/$f.bz2"
-    done
-fi
-
-### Check for hazards
-
-if grep 'Function.*has unrooted.*live across GC call' rootingHazards.txt; then
-    echo "TEST-UNEXPECTED-FAIL hazards detected" >&2
-    exit 1
-fi
+grab_artifacts "$WORKSPACE/analysis" "$HOME/artifacts"
+check_hazards "$WORKSPACE/analysis"
 
 ################################### script end ###################################
new file mode 100755
--- /dev/null
+++ b/testing/taskcluster/scripts/builder/hazard-analysis.sh
@@ -0,0 +1,81 @@
+#!/bin/bash -ex
+
+HAZARD_SHELL_OBJDIR=$MOZ_OBJDIR/obj-haz-shell
+JS_SRCDIR=$GECKO_DIR/js/src
+ANALYSIS_SRCDIR=$JS_SRCDIR/devtools/rootAnalysis
+
+# Install the sixgill tool
+TOOLTOOL_MANIFEST=js/src/devtools/rootAnalysis/build/sixgill.manifest
+. install-packages.sh "$GECKO_DIR"
+
+export CC="$GECKO_DIR/gcc/bin/gcc"
+export CXX="$GECKO_DIR/gcc/bin/g++"
+
+function build_js_shell () {
+    ( cd $JS_SRCDIR; autoconf-2.13 )
+    mkdir -p $HAZARD_SHELL_OBJDIR || true
+    cd $HAZARD_SHELL_OBJDIR
+    $JS_SRCDIR/configure --enable-optimize --disable-debug --enable-ctypes --enable-nspr-build --without-intl-api --with-ccache
+    make -j4
+}
+
+function configure_analysis () {
+    local analysis_dir
+    analysis_dir="$1"
+
+    mkdir -p "$analysis_dir" || true
+    (
+        cd "$analysis_dir"
+        cat > defaults.py <<EOF
+js = "$HAZARD_SHELL_OBJDIR/dist/bin/js"
+analysis_scriptdir = "$ANALYSIS_SRCDIR"
+objdir = "$MOZ_OBJDIR"
+source = "$GECKO_DIR"
+sixgill = "$GECKO_DIR/sixgill/usr/libexec/sixgill"
+sixgill_bin = "$GECKO_DIR/sixgill/usr/bin"
+EOF
+    )
+}
+
+function run_analysis () {
+    local analysis_dir
+    analysis_dir="$1"
+    local build_type
+    build_type="$2"
+
+    (
+        cd "$analysis_dir"
+        python "$ANALYSIS_SRCDIR/analyze.py" --buildcommand="$GECKO_DIR/testing/mozharness/scripts/spidermonkey/build.${build_type}"
+    )
+}
+
+function grab_artifacts () {
+    local analysis_dir
+    analysis_dir="$1"
+    local artifacts
+    artifacts="$2"
+
+    (
+        cd "$analysis_dir"
+        ls -lah
+
+        for f in *.txt *.lst; do
+            gzip -9 -c "$f" > "${artifacts}/$f.gz"
+        done
+
+        # Check whether the user requested .xdb file upload in the top commit comment
+
+        if hg --cwd "$GECKO_DIR" log -l1 --template '{desc}\n' | grep -q 'haz: --upload-xdbs'; then
+            for f in *.xdb; do
+                bzip2 -c "$f" > "${artifacts}/$f.bz2"
+            done
+        fi
+    )
+}
+
+function check_hazards () {
+    if grep 'Function.*has unrooted.*live across GC call' "$1"/rootingHazards.txt; then
+        echo "TEST-UNEXPECTED-FAIL hazards detected" >&2
+        exit 1
+    fi
+}