Bug 1480879 - Run the hazard analysis self-test as part of the hazard jobs, r=jonco
authorSteve Fink <sfink@mozilla.com>
Thu, 02 Aug 2018 09:49:27 -0700
changeset 497298 c45f9de01d9e2d65c740f7386b5bf1f76e8bcf64
parent 497297 f6173c4ae224f1a7df7a23195003fe312331e85d
child 497299 de0d7eda05f72b832218f73a06ef5134f5536076
push id9996
push userarchaeopteryx@coole-files.de
push dateThu, 18 Oct 2018 18:37:15 +0000
treeherdermozilla-beta@8efe26839243 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1480879
milestone64.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 1480879 - Run the hazard analysis self-test as part of the hazard jobs, r=jonco
js/src/devtools/rootAnalysis/run-test.py
taskcluster/scripts/builder/build-haz-linux.sh
taskcluster/scripts/builder/hazard-analysis.sh
--- a/js/src/devtools/rootAnalysis/run-test.py
+++ b/js/src/devtools/rootAnalysis/run-test.py
@@ -5,23 +5,22 @@
 
 import os
 import site
 import subprocess
 import argparse
 
 from glob import glob
 
-testdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 't'))
+scriptdir = os.path.abspath(os.path.dirname(__file__))
+testdir = os.path.join(scriptdir, 't')
 
 site.addsitedir(testdir)
 from testlib import Test, equal
 
-scriptdir = os.path.abspath(os.path.dirname(__file__))
-
 parser = argparse.ArgumentParser(description='run hazard analysis tests')
 parser.add_argument(
     '--js', default=os.environ.get('JS'),
     help='JS binary to run the tests with')
 parser.add_argument(
     '--sixgill', default=os.environ.get('SIXGILL', os.path.join(testdir, "sixgill")),
     help='Path to root of sixgill installation')
 parser.add_argument(
@@ -72,25 +71,27 @@ if not cfg.sixgill_plugin:
 
 subprocess.check_call([cfg.js, '-e', 'if (!getBuildConfiguration()["has-ctypes"]) quit(1)'])
 
 
 def binpath(prog):
     return os.path.join(cfg.sixgill_bin, prog)
 
 
+outroot = os.path.join(testdir, 'out')
+
 try:
-    os.mkdir(os.path.join('t', 'out'))
+    os.mkdir(outroot)
 except OSError:
     pass
 
 for name in cfg.tests:
     name = os.path.basename(name)
     indir = os.path.join(testdir, name)
-    outdir = os.path.join(testdir, 'out', name)
+    outdir = os.path.join(outroot, name)
     try:
         os.mkdir(outdir)
     except OSError:
         pass
 
     test = Test(indir, outdir, cfg, verbose=cfg.verbose)
 
     os.chdir(outdir)
--- a/taskcluster/scripts/builder/build-haz-linux.sh
+++ b/taskcluster/scripts/builder/build-haz-linux.sh
@@ -68,16 +68,17 @@ if [[ "$PROJECT" = "browser" ]]; then (
     # 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
 
 build_js_shell
+analysis_self_test
 
 # Artifacts folder is outside of the cache.
 mkdir -p "$HOME"/artifacts/ || true
 
 function onexit () {
     grab_artifacts "$WORKSPACE/analysis" "$HOME/artifacts"
 }
 
--- a/taskcluster/scripts/builder/hazard-analysis.sh
+++ b/taskcluster/scripts/builder/hazard-analysis.sh
@@ -1,32 +1,33 @@
 #!/bin/bash -ex
 
 [ -n "$WORKSPACE" ]
 [ -n "$MOZ_OBJDIR" ]
 [ -n "$GECKO_DIR" ]
 
 HAZARD_SHELL_OBJDIR=$WORKSPACE/obj-haz-shell
+JSBIN="$HAZARD_SHELL_OBJDIR/dist/bin/js"
 JS_SRCDIR=$GECKO_DIR/js/src
 ANALYSIS_SRCDIR=$JS_SRCDIR/devtools/rootAnalysis
+GCCDIR="$TOOLTOOL_DIR/gcc"
 
-export CC="$TOOLTOOL_DIR/gcc/bin/gcc"
-export CXX="$TOOLTOOL_DIR/gcc/bin/g++"
-export PATH="$TOOLTOOL_DIR/gcc/bin:$PATH"
-export LD_LIBRARY_PATH="$TOOLTOOL_DIR/gcc/lib64"
+export CC="$GCCDIR/bin/gcc"
+export CXX="$GCCDIR/bin/g++"
+export PATH="$GCCDIR/bin:$PATH"
+export LD_LIBRARY_PATH="$GCCDIR/lib64"
 export RUSTC="$TOOLTOOL_DIR/rustc/bin/rustc"
 export CARGO="$TOOLTOOL_DIR/rustc/bin/cargo"
 export LLVM_CONFIG="$TOOLTOOL_DIR/clang/bin/llvm-config"
 
 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
     )
@@ -63,17 +64,17 @@ function configure_analysis () {
     if [[ -z "$HAZ_DEP" ]]; then
         [ -d "$analysis_dir" ] && rm -rf "$analysis_dir"
     fi
 
     mkdir -p "$analysis_dir" || true
     (
         cd "$analysis_dir"
         cat > defaults.py <<EOF
-js = "$HAZARD_SHELL_OBJDIR/dist/bin/js"
+js = "$JSBIN"
 analysis_scriptdir = "$ANALYSIS_SRCDIR"
 objdir = "$MOZ_OBJDIR"
 source = "$GECKO_DIR"
 sixgill = "$TOOLTOOL_DIR/sixgill/usr/libexec/sixgill"
 sixgill_bin = "$TOOLTOOL_DIR/sixgill/usr/bin"
 EOF
 
         local rev
@@ -102,16 +103,20 @@ function run_analysis () {
     fi
 
     (
         cd "$analysis_dir"
         $PYTHON "$ANALYSIS_SRCDIR/analyze.py" -v --buildcommand="$GECKO_DIR/taskcluster/scripts/builder/hazard-${build_type}.sh"
     )
 }
 
+function analysis_self_test () {
+    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(dirname "$JSBIN")" $PYTHON "$ANALYSIS_SRCDIR/run-test.py" -v --js "$JSBIN" --sixgill "$TOOLTOOL_DIR/sixgill" --gccdir "$GCCDIR"
+}
+
 function grab_artifacts () {
     local analysis_dir
     analysis_dir="$1"
     local artifacts
     artifacts="$2"
 
     (
         cd "$analysis_dir"