Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: tools/valgrind/scan-build.py

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/valgrind/memcheck/suppressions_mac.txt ('k') | tools/valgrind/valgrind_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/valgrind/scan-build.py
diff --git a/tools/valgrind/scan-build.py b/tools/valgrind/scan-build.py
index b58b6cc447e52871011ab3208fdd27c0fa9da766..b117d1ea58a8fa863dc5d297429aa70bedf9ec87 100755
--- a/tools/valgrind/scan-build.py
+++ b/tools/valgrind/scan-build.py
@@ -5,6 +5,7 @@
import argparse
import errno
+import json
import os
import re
import sys
@@ -24,7 +25,7 @@ Failed memory test: content
CACHE_DIR = "buildlogs.tmp"
# If we don't find anything after searching |CUTOFF| logs, we're probably done.
-CUTOFF = 100
+CUTOFF = 200
def EnsurePath(path):
"""Makes sure |path| does exist, tries to create it if it doesn't."""
@@ -191,6 +192,8 @@ def main(argv):
commands = parser.add_mutually_exclusive_group(required=True)
commands.add_argument("--update", action='store_true')
commands.add_argument("--find", metavar='search term')
+ parser.add_argument("--json", action='store_true',
+ help="Output in JSON format")
args = parser.parse_args()
path = os.path.abspath(os.path.dirname(argv[0]))
@@ -205,22 +208,38 @@ def main(argv):
builder.ScanLogs(lambda x:False)
if args.find:
+ result = []
tester = MultiLineChange(args.find.splitlines())
fyi.FetchInfo()
- print "SCANNING FOR ", args.find
+ if not args.json:
+ print "SCANNING FOR ", args.find
for builder in fyi.Builders():
- print "Scanning", builder.Name()
+ if not args.json:
+ print "Scanning", builder.Name()
occurrences = builder.ScanLogs(tester)
if occurrences:
min_build = min(occurrences)
path = builder.GetBuildPath(min_build)
- print "Earliest occurrence in build %d" % min_build
- print "Latest occurrence in build %d" % max(occurrences)
- print "Latest build: %d" % builder.LatestBuild()
- print path
- print "%d total" % len(occurrences)
-
+ if args.json:
+ data = {}
+ data['builder'] = builder.Name()
+ data['first_affected'] = min_build
+ data['last_affected'] = max(occurrences)
+ data['last_build'] = builder.LatestBuild()
+ data['frequency'] = ((int(builder.LatestBuild()) - int(min_build)) /
+ len(occurrences))
+ data['total'] = len(occurrences)
+ data['first_url'] = path
+ result.append(data)
+ else:
+ print "Earliest occurrence in build %d" % min_build
+ print "Latest occurrence in build %d" % max(occurrences)
+ print "Latest build: %d" % builder.LatestBuild()
+ print path
+ print "%d total" % len(occurrences)
+ if args.json:
+ json.dump(result, sys.stdout, indent=2, sort_keys=True)
if __name__ == "__main__":
sys.exit(main(sys.argv))
« no previous file with comments | « tools/valgrind/memcheck/suppressions_mac.txt ('k') | tools/valgrind/valgrind_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698