| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Toolbox to manage all the json files in this directory. | 6 """Toolbox to manage all the json files in this directory. |
| 7 | 7 |
| 8 It can reformat them in their canonical format or ensures they are well | 8 It can reformat them in their canonical format or ensures they are well |
| 9 formatted. | 9 formatted. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 import argparse | 12 import argparse |
| 13 import ast | 13 import ast |
| 14 import collections | 14 import collections |
| 15 import glob | 15 import glob |
| 16 import json | 16 import json |
| 17 import os | 17 import os |
| 18 import subprocess | 18 import subprocess |
| 19 import sys | 19 import sys |
| 20 | 20 |
| 21 | 21 |
| 22 THIS_DIR = os.path.dirname(os.path.abspath(__file__)) | 22 THIS_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 23 SRC_DIR = os.path.dirname(os.path.dirname(THIS_DIR)) | 23 SRC_DIR = os.path.dirname(os.path.dirname(THIS_DIR)) |
| 24 BLINK_DIR = os.path.join(SRC_DIR, 'third_party', 'WebKit') |
| 24 sys.path.insert(0, os.path.join(SRC_DIR, 'third_party', 'colorama', 'src')) | 25 sys.path.insert(0, os.path.join(SRC_DIR, 'third_party', 'colorama', 'src')) |
| 25 | 26 |
| 26 import colorama | 27 import colorama |
| 27 | 28 |
| 28 | 29 |
| 29 SKIP = { | 30 SKIP = { |
| 30 # These are not 'builders'. | 31 # These are not 'builders'. |
| 31 'compile_targets', 'gtest_tests', 'filter_compile_builders', | 32 'compile_targets', 'gtest_tests', 'filter_compile_builders', |
| 32 'non_filter_builders', 'non_filter_tests_builders', | 33 'non_filter_builders', 'non_filter_tests_builders', |
| 33 | 34 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 'telemetry_gpu_test', | 74 'telemetry_gpu_test', |
| 74 } | 75 } |
| 75 | 76 |
| 76 | 77 |
| 77 class Error(Exception): | 78 class Error(Exception): |
| 78 """Processing error.""" | 79 """Processing error.""" |
| 79 | 80 |
| 80 | 81 |
| 81 def get_isolates(): | 82 def get_isolates(): |
| 82 """Returns the list of all isolate files.""" | 83 """Returns the list of all isolate files.""" |
| 83 files = subprocess.check_output(['git', 'ls-files'], cwd=SRC_DIR).splitlines() | 84 |
| 85 def git_ls_files(cwd): |
| 86 return subprocess.check_output(['git', 'ls-files'], cwd=cwd).splitlines() |
| 87 |
| 88 files = git_ls_files(SRC_DIR) + git_ls_files(BLINK_DIR) |
| 84 return [os.path.basename(f) for f in files if f.endswith('.isolate')] | 89 return [os.path.basename(f) for f in files if f.endswith('.isolate')] |
| 85 | 90 |
| 86 | 91 |
| 87 def process_builder_convert(data, test_name): | 92 def process_builder_convert(data, test_name): |
| 88 """Converts 'test_name' to run on Swarming in 'data'. | 93 """Converts 'test_name' to run on Swarming in 'data'. |
| 89 | 94 |
| 90 Returns True if 'test_name' was found. | 95 Returns True if 'test_name' was found. |
| 91 """ | 96 """ |
| 92 result = False | 97 result = False |
| 93 for test in data['gtest_tests']: | 98 for test in data['gtest_tests']: |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 elif args.mode == 'remaining': | 308 elif args.mode == 'remaining': |
| 304 print_remaining(args.test_name, tests_location) | 309 print_remaining(args.test_name, tests_location) |
| 305 return result | 310 return result |
| 306 except Error as e: | 311 except Error as e: |
| 307 sys.stderr.write('%s\n' % e) | 312 sys.stderr.write('%s\n' % e) |
| 308 return 1 | 313 return 1 |
| 309 | 314 |
| 310 | 315 |
| 311 if __name__ == "__main__": | 316 if __name__ == "__main__": |
| 312 sys.exit(main()) | 317 sys.exit(main()) |
| OLD | NEW |