Bug 1480879 - Format errors better for taskcluster, r=jonco
authorSteve Fink <sfink@mozilla.com>
Thu, 02 Aug 2018 10:20:15 -0700
changeset 489822 1c5c021b7271da663ed9631de95a842ac83fede1
parent 489821 8308ccadecfad676d2316242014a30d118b9b17d
child 489823 8a07eed99ca8315b5b275eec185561172f9e3ffe
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersjonco
bugs1480879
milestone64.0a1
Bug 1480879 - Format errors better for taskcluster, r=jonco
js/src/devtools/rootAnalysis/run-test.py
taskcluster/scripts/builder/hazard-analysis.sh
--- a/js/src/devtools/rootAnalysis/run-test.py
+++ b/js/src/devtools/rootAnalysis/run-test.py
@@ -3,17 +3,20 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import os
 import site
 import subprocess
 import argparse
 
+from glob import glob
+
 testdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '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'),
@@ -81,17 +84,18 @@ for name in cfg.tests:
     try:
         os.mkdir(outdir)
     except OSError:
         pass
 
     test = Test(indir, outdir, cfg, verbose=cfg.verbose)
 
     os.chdir(outdir)
-    subprocess.call(["sh", "-c", "rm *.xdb"])
+    for xdb in glob("*.xdb"):
+        os.unlink(xdb)
     if cfg.verbose:
         print("Running test %s" % name)
     testpath = os.path.join(indir, "test.py")
     testscript = open(testpath).read()
     testcode = compile(testscript, testpath, 'exec')
     try:
         exec(testcode, {'test': test, 'equal': equal})
     except subprocess.CalledProcessError:
--- a/taskcluster/scripts/builder/hazard-analysis.sh
+++ b/taskcluster/scripts/builder/hazard-analysis.sh
@@ -156,33 +156,37 @@ function check_hazards () {
     NUM_WRITE_HAZARDS=$(perl -lne 'print $1 if m!found (\d+)/\d+ allowed errors!' "$1"/heapWriteHazards.txt)
 
     set +x
     echo "TinderboxPrint: rooting hazards<br/>$NUM_HAZARDS"
     echo "TinderboxPrint: (unsafe references to unrooted GC pointers)<br/>$NUM_UNSAFE"
     echo "TinderboxPrint: (unnecessary roots)<br/>$NUM_UNNECESSARY"
     echo "TinderboxPrint: heap write hazards<br/>$NUM_WRITE_HAZARDS"
 
+    # Display errors in a way that will get picked up by the taskcluster scraper.
+    perl -le 'print "TEST-UNEXPECTED-FAIL | hazards | $ENV{NUM_HAZARDS} rooting hazards" if $ENV{NUM_HAZARDS}'
+    perl -lne 'print "TEST-UNEXPECTED-FAIL | hazards | $1 $2" if /^Function.* has (unrooted .*live across GC call).* (at .*)$/' "$1"/hazards.txt
+
     exit_status=0
 
     if [ $NUM_HAZARDS -gt 0 ]; then
-        echo "TEST-UNEXPECTED-FAIL $NUM_HAZARDS rooting hazards detected" >&2
+        echo "TEST-UNEXPECTED-FAIL | hazards | $NUM_HAZARDS rooting hazards detected" >&2
         echo "TinderboxPrint: documentation<br/><a href='https://wiki.mozilla.org/Javascript:Hazard_Builds#Diagnosing_a_rooting_hazards_failure'>static rooting hazard analysis failures</a>, visit \"Inspect Task\" link for hazard details"
         exit_status=1
     fi
 
     NUM_ALLOWED_WRITE_HAZARDS=0
     if [ $NUM_WRITE_HAZARDS -gt $NUM_ALLOWED_WRITE_HAZARDS ]; then
-        echo "TEST-UNEXPECTED-FAIL $NUM_WRITE_HAZARDS heap write hazards detected out of $NUM_ALLOWED_WRITE_HAZARDS allowed" >&2
+        echo "TEST-UNEXPECTED-FAIL | heap-write-hazards | $NUM_WRITE_HAZARDS heap write hazards detected out of $NUM_ALLOWED_WRITE_HAZARDS allowed" >&2
         echo "TinderboxPrint: documentation<br/><a href='https://wiki.mozilla.org/Javascript:Hazard_Builds#Diagnosing_a_heap_write_hazard_failure'>heap write hazard analysis failures</a>, visit \"Inspect Task\" link for hazard details"
         exit_status = 1
     fi
 
     if [ $NUM_DROPPED -gt 0 ]; then
-        echo "TEST-UNEXPECTED-FAIL $NUM_DROPPED CFGs dropped" >&2
+        echo "TEST-UNEXPECTED-FAIL | hazards | $NUM_DROPPED CFGs dropped" >&2
         echo "TinderboxPrint: sixgill unable to handle constructs<br/>$NUM_DROPPED"
         exit_status=1
     fi
 
     if [ $exit_status -ne 0 ]; then
         exit $exit_status
     fi
     )