Chromium Code Reviews| Index: tools/checkbins/checkbins.py |
| diff --git a/tools/checkbins/checkbins.py b/tools/checkbins/checkbins.py |
| index 213f30a303b2a3e93ce7cda11be47f748360f4b8..9531f2421f48aa78e8e1636490f02cb375f9b694 100755 |
| --- a/tools/checkbins/checkbins.py |
| +++ b/tools/checkbins/checkbins.py |
| @@ -10,6 +10,7 @@ In essense it runs a subset of BinScope tests ensuring that binaries have |
| /NXCOMPAT, /DYNAMICBASE and /SAFESEH. |
| """ |
| +import json |
| import os |
| import optparse |
| import sys |
| @@ -44,6 +45,8 @@ def main(options, args): |
| pe_total = 0 |
| pe_passed = 0 |
| + failures = [] |
| + |
| for file in os.listdir(directory): |
| path = os.path.abspath(os.path.join(directory, file)) |
| if not IsPEFile(path): |
| @@ -103,8 +106,15 @@ def main(options, args): |
| # Update tally. |
| if success: |
| pe_passed = pe_passed + 1 |
| + else: |
| + failures.append(path) |
| print "Result: %d files found, %d files passed" % (pe_total, pe_passed) |
| + |
| + if options.json: |
| + with open(options.json, 'w') as f: |
| + json.dump(failures, f) |
|
scottmg
2015/11/18 21:45:05
Is it useful to have something that's not an array
Paweł Hajdan Jr.
2015/11/19 11:27:29
Good question.
The consumer of that is in the sam
|
| + |
| if pe_passed != pe_total: |
| sys.exit(1) |
| @@ -113,6 +123,7 @@ if __name__ == '__main__': |
| option_parser = optparse.OptionParser(usage=usage) |
| option_parser.add_option("-v", "--verbose", action="store_true", |
| default=False, help="Print debug logging") |
| + option_parser.add_option("--json", help="Path to JSON output file") |
| options, args = option_parser.parse_args() |
| if not args: |
| option_parser.print_help() |