Bug 1310819 - Fix developer runs of hazard analysis, r=fitzgen
authorSteve Fink <sfink@mozilla.com>
Mon, 17 Oct 2016 14:04:38 -0700
changeset 318515 071a50677336bbc0173bb4a9419971e7abd09a7c
parent 318514 72a82d357f155154d5837a0951b708d269fac749
child 318516 e3b464e34825445fa85040206d9b806f60647afd
push id30843
push usercbook@mozilla.com
push dateWed, 19 Oct 2016 15:02:57 +0000
treeherdermozilla-central@f40960c63bfa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen
bugs1310819
milestone52.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 1310819 - Fix developer runs of hazard analysis, r=fitzgen
js/src/devtools/rootAnalysis/README.md
taskcluster/scripts/builder/build-haz-linux.sh
taskcluster/scripts/builder/hazard-analysis.sh
--- a/js/src/devtools/rootAnalysis/README.md
+++ b/js/src/devtools/rootAnalysis/README.md
@@ -18,23 +18,30 @@ 3.  Install taskcluster-vcs, eg by doing
         npm install taskcluster-vcs
         export PATH="$PATH:$(pwd)/node_modules/.bin"
 
 4. In some directory, using $SRCDIR as the top of your Gecko source checkout,
     run these commands:
 
         mkdir work
         cd work
-        GECKO_DIR=$SRCDIR $SRCDIR/taskcluster/scripts/builder/build-haz-linux.sh $(pwd) --dep
+        ( export GECKO_DIR=$SRCDIR; $GECKO_DIR/taskcluster/scripts/builder/build-haz-linux.sh $(pwd) --dep )
 
 The `--dep` is optional, and will avoid rebuilding the JS shell used to run the
-analysis later. Output goes to `analysis/hazards.txt`. This will run the
+analysis later.
+
+If you see the error ``/lib/../lib64/crti.o: unrecognized relocation (0x2a) in section .init`` then have a version mismatch between the precompiled gcc used in automation and your installed glibc. The easiest way to fix this is to delete the ld provided with the precompiled gcc (it will be in two places, one given in the first part of the error message), which will cause gcc to fall back to your system ld. But you will need to additionally pass ``--no-tooltool`` to build-haz-linux.sh. With the current package, you could do the deletion with
+
+    rm gcc/bin/ld
+    rm gcc/x86_64-unknown-linux-gnu/bin/ld
+
+Output goes to `analysis/hazards.txt`. This will run the
 analysis on the js/src tree only; if you wish to analyze the full browser, use
 
-    GECKO_DIR=$SRCDIR $SRCDIR/taskcluster/scripts/builder/build-haz-linux.sh --project browser $(pwd)
+    ( export GECKO_DIR=$SRCDIR; $GECKO_DIR/taskcluster/scripts/builder/build-haz-linux.sh --project browser $(pwd) )
 
 After running the analysis once, you can reuse the `*.xdb` database files
 generated, using modified analysis scripts, by running
 `analysis/run-analysis.sh` (or pass `--list` to see ways to select even more
 restrictive parts of the overall analysis; the default is `gcTypes` which will
 do everything but regenerate the xdb files).
 
 Also, you can pass `-v` to get exact command lines to cut & paste for running the
--- a/taskcluster/scripts/builder/build-haz-linux.sh
+++ b/taskcluster/scripts/builder/build-haz-linux.sh
@@ -3,24 +3,28 @@
 function usage() {
     echo "Usage: $0 [--project <shell|browser>] <workspace-dir> flags..."
     echo "flags are treated the same way as a commit message would be"
     echo "(as in, they are scanned for directives just like a try: ... line)"
 }
 
 PROJECT=shell
 WORKSPACE=
+DO_TOOLTOOL=1
 while [[ $# -gt 0 ]]; do
     if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
         usage
         exit 0
     elif [[ "$1" == "--project" ]]; then
         shift
         PROJECT="$1"
         shift
+    elif [[ "$1" == "--no-tooltool" ]]; then
+        shift
+        DO_TOOLTOOL=
     elif [[ -z "$WORKSPACE" ]]; then
         WORKSPACE=$( cd "$1" && pwd )
         shift
         break
     fi
 done
 
 SCRIPT_FLAGS="$@"
@@ -45,23 +49,26 @@ GECKO_DIR=$( cd "$GECKO_DIR" && pwd )
 
 # Directory to populate with tooltool-installed tools
 export TOOLTOOL_DIR="$WORKSPACE"
 
 # Directory to hold the (useless) object files generated by the analysis.
 export MOZ_OBJDIR="$WORKSPACE/obj-analyzed"
 mkdir -p "$MOZ_OBJDIR"
 
-tc-vcs checkout --force-clone $WORKSPACE/tooltool $TOOLTOOL_REPO $TOOLTOOL_REPO $TOOLTOOL_REV
-( cd $TOOLTOOL_DIR; python $WORKSPACE/tooltool/tooltool.py --url https://api.pub.build.mozilla.org/tooltool/ -m $GECKO_DIR/$TOOLTOOL_MANIFEST fetch -c $TOOLTOOL_CACHE )
+if [ -n "$DO_TOOLTOOL" ]; then
+  tc-vcs checkout --force-clone $WORKSPACE/tooltool $TOOLTOOL_REPO $TOOLTOOL_REPO $TOOLTOOL_REV
+  ( cd $TOOLTOOL_DIR; python $WORKSPACE/tooltool/tooltool.py --url https://api.pub.build.mozilla.org/tooltool/ -m $GECKO_DIR/$TOOLTOOL_MANIFEST fetch -c $TOOLTOOL_CACHE )
+fi
 
 export NO_MERCURIAL_SETUP_CHECK=1
 
 if [[ "$PROJECT" = "browser" ]]; then (
     cd "$WORKSPACE"
+    set "$WORKSPACE"
     . setup-ccache.sh
     # Mozbuild config:
     export MOZBUILD_STATE_PATH=$WORKSPACE/mozbuild/
     # Create .mozbuild so mach doesn't complain about this
     mkdir -p $MOZBUILD_STATE_PATH
 ) fi
 . hazard-analysis.sh
 
--- a/taskcluster/scripts/builder/hazard-analysis.sh
+++ b/taskcluster/scripts/builder/hazard-analysis.sh
@@ -13,21 +13,23 @@ export CXX="$TOOLTOOL_DIR/gcc/bin/g++"
 
 PYTHON=python2.7
 if ! which $PYTHON; then
     PYTHON=python
 fi
 
 
 function check_commit_msg () {
+    ( set +e;
     if [[ -n "$AUTOMATION" ]]; then
         hg --cwd "$GECKO_DIR" log -r. --template '{desc}\n' | grep -F -q -- "$1"
     else
         echo -- "$SCRIPT_FLAGS" | grep -F -q -- "$1"
     fi
+    )
 }
 
 if check_commit_msg "--dep"; then
     HAZ_DEP=1
 fi
 
 function build_js_shell () {
     # Must unset MOZ_OBJDIR and MOZCONFIG here to prevent the build system from