Bug 916677 - Do not check expectations in explain.py (move to mozharness script), r=terrence
authorSteve Fink <sfink@mozilla.com>
Tue, 05 Nov 2013 09:10:13 -0800
changeset 169204 e69975bf90027f19a454784f93baa3376fa3c704
parent 169203 ae25b8cc8ff8e94582649a3f82fabbeb6d0a638d
child 169205 c4fc26fa3b1062ce862f9803978c3152baf8f104
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs916677
milestone28.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 916677 - Do not check expectations in explain.py (move to mozharness script), r=terrence DONTBUILD because NPOTB yet
js/src/devtools/rootAnalysis/analyze.py
js/src/devtools/rootAnalysis/explain.py
--- a/js/src/devtools/rootAnalysis/analyze.py
+++ b/js/src/devtools/rootAnalysis/analyze.py
@@ -123,17 +123,16 @@ JOBS = { 'dbs':
              (('%(sixgill_bin)s/xdbkeys', 'src_body.xdb',),
               'allFunctions.txt'),
 
          'hazards':
              (generate_hazards, 'rootingHazards.txt'),
 
          'explain':
              (('python', '%(analysis_scriptdir)s/explain.py',
-               '--expect-file=%(expect_file)s',
                '%(hazards)s', '%(gcFunctions)s',
                '[explained_hazards]', '[unnecessary]', '[refs]'),
               ('hazards.txt', 'unnecessary.txt', 'refs.txt'))
          }
 
 def out_indexes(command):
     for i in range(len(command)):
         m = re.match(r'^\[(.*)\]$', command[i])
@@ -206,38 +205,33 @@ parser.add_argument('--jobs', '-j', defa
                     help='number of simultaneous analyzeRoots.js jobs')
 parser.add_argument('--list', const=True, nargs='?', type=bool,
                     help='display available steps')
 parser.add_argument('--buildcommand', '--build', '-b', type=str, nargs='?',
                     help='command to build the tree being analyzed')
 parser.add_argument('--tag', '-t', type=str, nargs='?',
                     help='name of job, also sets build command to "build.<tag>"')
 parser.add_argument('--expect-file', type=str, nargs='?',
-                    help='file containing expected number of hazards/refs')
+                    help='deprecated option, temporarily still present for backwards compatibility')
 
 args = parser.parse_args()
 for k,v in vars(args).items():
     if v is not None:
         data[k] = v
 
 if args.tag and not args.buildcommand:
     args.buildcommand="build.%s" % args.tag
 
 if args.buildcommand:
     data['buildcommand'] = args.buildcommand
 elif 'BUILD' in os.environ:
     data['buildcommand'] = os.environ['BUILD']
 else:
     data['buildcommand'] = 'make -j4 -s'
 
-if args.expect_file:
-    data['expect_file'] = args.expect_file
-else:
-    data['expect_file'] = '%(analysis_scriptdir)s/expect.json'
-
 if 'ANALYZED_OBJDIR' in os.environ:
     data['objdir'] = os.environ['ANALYZED_OBJDIR']
 
 if 'SOURCE' in os.environ:
     data['source'] = os.environ['SOURCE']
 
 steps = [ 'dbs',
           'callgraph',
--- a/js/src/devtools/rootAnalysis/explain.py
+++ b/js/src/devtools/rootAnalysis/explain.py
@@ -1,31 +1,21 @@
 #!/usr/bin/python
 
 import re
 import argparse
-import sys
 
 parser = argparse.ArgumentParser(description='Process some integers.')
 parser.add_argument('rootingHazards', nargs='?', default='rootingHazards.txt')
 parser.add_argument('gcFunctions', nargs='?', default='gcFunctions.txt')
 parser.add_argument('hazards', nargs='?', default='hazards.txt')
 parser.add_argument('extra', nargs='?', default='unnecessary.txt')
 parser.add_argument('refs', nargs='?', default='refs.txt')
-parser.add_argument('--expect-hazards', type=int, default=None)
-parser.add_argument('--expect-refs', type=int, default=None)
-parser.add_argument('--expect-file', type=str, default=None)
 args = parser.parse_args()
 
-if args.expect_file:
-    import json
-    data = json.load(file(args.expect_file, 'r'))
-    args.expect_hazards = args.expect_hazards or data.get('expect-hazards')
-    args.expect_refs = args.expect_refs or data.get('expect-refs')
-
 num_hazards = 0
 num_refs = 0
 try:
     with open(args.rootingHazards) as rootingHazards, \
         open(args.hazards, 'w') as hazards, \
         open(args.extra, 'w') as extra, \
         open(args.refs, 'w') as refs:
         current_gcFunction = None
@@ -56,32 +46,33 @@ try:
             if m:
                 num_refs += 1
                 print >>refs, line
                 continue
 
             m = re.match(r"^Function.*has unrooted.*of type.*live across GC call '(.*?)'", line)
             if m:
                 current_gcFunction = m.group(1)
-                hazardousGCFunctions.setdefault(current_gcFunction, []).append(line);
+                hazardousGCFunctions.setdefault(current_gcFunction, []).append(line)
                 hazardOrder.append((current_gcFunction, len(hazardousGCFunctions[current_gcFunction]) - 1))
                 num_hazards += 1
                 continue
 
             if current_gcFunction:
                 if not line.strip():
                     # Blank line => end of this hazard
                     current_gcFunction = None
                 else:
                     hazardousGCFunctions[current_gcFunction][-1] += line
 
         with open(args.gcFunctions) as gcFunctions:
-            gcExplanations = {} # gcFunction => stack showing why it can GC
+            gcExplanations = {}  # gcFunction => stack showing why it can GC
 
             current_func = None
+            explanation = None
             for line in gcFunctions:
                 m = re.match(r'^GC Function: (.*)', line)
                 if m:
                     if current_func:
                         gcExplanations[current_func] = explanation
                     current_func = None
                     if m.group(1) in hazardousGCFunctions:
                         current_func = m.group(1)
@@ -97,24 +88,8 @@ try:
 
 except IOError as e:
     print 'Failed: %s' % str(e)
 
 print("Wrote %s" % args.hazards)
 print("Wrote %s" % args.extra)
 print("Wrote %s" % args.refs)
 print("Found %d hazards and %d unsafe references" % (num_hazards, num_refs))
-
-if args.expect_hazards is not None and args.expect_hazards != num_hazards:
-    if args.expect_hazards < num_hazards:
-        print("TEST-UNEXPECTED-FAILURE: %d more hazards than expected (expected %d, saw %d)" % (num_hazards - args.expect_hazards, args.expect_hazards, num_hazards))
-        sys.exit(1)
-    else:
-        print("%d fewer hazards than expected! (expected %d, saw %d)" % (args.expect_hazards - num_hazards, args.expect_hazards, num_hazards))
-
-if args.expect_refs is not None and args.expect_refs != num_refs:
-    if args.expect_refs < num_refs:
-        print("TEST-UNEXPECTED-FAILURE: %d more unsafe refs than expected (expected %d, saw %d)" % (num_refs - args.expect_refs, args.expect_refs, num_refs))
-        sys.exit(1)
-    else:
-        print("%d fewer unsafe refs than expected! (expected %d, saw %d)" % (args.expect_refs - num_refs, args.expect_refs, num_refs))
-
-sys.exit(0)