Esempio n. 1
0
def main():
    supp = suppressions.GetSuppressions()

    all_supps = []
    for supps in supp.values():
        all_supps += [s.description for s in supps]
    sys.stdout.write(
        urllib2.urlopen(
            'http://chromium-build-logs.appspot.com/unused_suppressions',
            '\n'.join(all_supps)).read())
    return 0
Esempio n. 2
0
def main(argv):
  supp = suppressions.GetSuppressions()

  # all_reports is a map {report: list of urls containing this report}
  all_reports = defaultdict(list)
  report_hashes = {}

  for f in argv:
    f_reports, url = ReadReportsFromFile(f)
    for (hash, report) in f_reports:
      all_reports[report] += [url]
      report_hashes[report] = hash

  reports_count = 0
  for r in all_reports:
    cur_supp = supp['common_suppressions']
    if all([re.search("%20Mac%20|mac_valgrind", url)
            for url in all_reports[r]]):
      # Include mac suppressions if the report is only present on Mac
      cur_supp += supp['mac_suppressions']
    elif all([re.search("Windows%20", url) for url in all_reports[r]]):
      # Include win32 suppressions if the report is only present on Windows
      cur_supp += supp['win_suppressions']
    elif all([re.search("Linux%20", url) for url in all_reports[r]]):
      cur_supp += supp['linux_suppressions']
    elif all([re.search("%20Heapcheck", url)
              for url in all_reports[r]]):
      cur_supp += supp['heapcheck_suppressions']
    if all(["DrMemory" in url for url in all_reports[r]]):
      cur_supp += supp['drmem_suppressions']
    if all(["DrMemory%20full" in url for url in all_reports[r]]):
      cur_supp += supp['drmem_full_suppressions']

    match = False
    for s in cur_supp:
      if s.Match(r.split("\n")):
        match = True
        break
    if not match:
      reports_count += 1
      print "==================================="
      print "This report observed at"
      for url in all_reports[r]:
        print "  %s" % url
      print "didn't match any suppressions:"
      print "Suppression (error hash=#%s#):" % (report_hashes[r])
      print r
      print "==================================="

  if reports_count > 0:
    print ("%d unique reports don't match any of the suppressions" %
           reports_count)
  else:
    print "Congratulations! All reports are suppressed!"
def main(argv):
    supp = suppressions.GetSuppressions()

    # all_reports is a map {report: list of urls containing this report}
    all_reports = defaultdict(list)
    report_hashes = {}
    symbol_reports = defaultdict(list)

    # Create argument parser.
    parser = argparse.ArgumentParser()
    parser.add_argument('--top-symbols',
                        type=int,
                        default=0,
                        help='Print a list of the top <n> symbols')
    parser.add_argument(
        '--symbol-filter',
        action='append',
        help=
        'Filter out all suppressions not containing the specified symbol(s). '
        'Matches against the mangled names.')
    parser.add_argument(
        '--exclude-symbol',
        action='append',
        help='Filter out all suppressions containing the specified symbol(s). '
        'Matches against the mangled names.')

    parser.add_argument('reports',
                        metavar='report file',
                        nargs='+',
                        help='List of report files')
    args = parser.parse_args(argv)

    for f in args.reports:
        f_reports, url = ReadReportsFromFile(f)
        for (hash, report) in f_reports:
            all_reports[report] += [url]
            report_hashes[report] = hash

    reports_count = 0
    for r in all_reports:
        cur_supp = supp['common_suppressions']
        if all([
                re.search("%20Mac%20|mac_valgrind", url)
                for url in all_reports[r]
        ]):
            # Include mac suppressions if the report is only present on Mac
            cur_supp += supp['mac_suppressions']
        elif all([re.search("Windows%20", url) for url in all_reports[r]]):
            # Include win32 suppressions if the report is only present on Windows
            cur_supp += supp['win_suppressions']
        elif all([re.search("Linux%20", url) for url in all_reports[r]]):
            cur_supp += supp['linux_suppressions']
        # Separate from OS matches as we want to match "Linux%20Heapcheck" twice:
        if all([re.search("%20Heapcheck", url) for url in all_reports[r]]):
            cur_supp += supp['heapcheck_suppressions']
        if all(["DrMemory" in url for url in all_reports[r]]):
            cur_supp += supp['drmem_suppressions']
        if all(["DrMemory%20full" in url for url in all_reports[r]]):
            cur_supp += supp['drmem_full_suppressions']

        # Test if this report is already suppressed
        skip = False
        for s in cur_supp:
            if s.Match(r.split("\n")):
                skip = True
                break

        # Skip reports if none of the symbols are in the report.
        if args.symbol_filter and all(not s in r for s in args.symbol_filter):
            skip = True
        if args.exclude_symbol and any(s in r for s in args.exclude_symbol):
            skip = True

        if not skip:
            reports_count += 1
            print "==================================="
            print "This report observed at"
            for url in all_reports[r]:
                print "  %s" % url
            print "didn't match any suppressions:"
            print "Suppression (error hash=#%s#):" % (report_hashes[r])
            print r
            print "==================================="

            if args.top_symbols > 0:
                symbols = GetSymbolsFromReport(r)
                for symbol in symbols:
                    symbol_reports[symbol].append(report_hashes[r])

    if reports_count > 0:
        print("%d unique reports don't match any of the suppressions" %
              reports_count)
        if args.top_symbols > 0:
            PrintTopSymbols(symbol_reports, args.top_symbols)

    else:
        print "Congratulations! All reports are suppressed!"