Commit 5097fa6f authored by Steve Fink's avatar Steve Fink
Browse files

Backed out changeset c73617bdfdfa (bug 1250709)

--HG--
extra : rebase_source : c67c2cf17911584a3d8c9eba78da8763b18c3aaf
parent 1a085c7e
Loading
Loading
Loading
Loading
+53 −6
Original line number Diff line number Diff line
@@ -6,17 +6,64 @@ DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PATH=$DIRNAME:$PATH

. desktop-setup.sh
. hazard-analysis.sh

build_js_shell
# Install the sixgill tool
TOOLTOOL_MANIFEST=js/src/devtools/rootAnalysis/build/sixgill.manifest
. install-packages.sh "$GECKO_DIR"

configure_analysis "$WORKSPACE/analysis"
run_analysis "$WORKSPACE/analysis" b2g
# 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

( 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

# 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

# Artifacts folder is outside of the cache.
mkdir -p $HOME/artifacts/ || true

grab_artifacts "$WORKSPACE/analysis" "$HOME/artifacts"
check_hazards "$WORKSPACE/analysis"
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

################################### script end ###################################
+0 −81
Original line number Diff line number Diff line
#!/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
}