Chromium Code Reviews| Index: build/android/tombstones.py |
| diff --git a/build/android/tombstones.py b/build/android/tombstones.py |
| index 712f90fac81dd3f51d2e6906f684388c1b2bd896..0bc24fddd085eadc1efc642d61dfed98814fc3e8 100755 |
| --- a/build/android/tombstones.py |
| +++ b/build/android/tombstones.py |
| @@ -212,6 +212,18 @@ def _GetTombstonesForDevice(device, args): |
| return ret |
| +def _clearAllTombstones(device): |
|
jbudorick
2016/08/01 17:39:18
nit: _ClearAllTombstones
BigBossZhiling
2016/08/01 22:35:13
Done.
|
| + """Clear all tombstones in the device.. |
|
jbudorick
2016/08/01 17:39:18
nit: only one . at the end
BigBossZhiling
2016/08/01 22:35:13
Done.
|
| + |
| + Args: |
| + device: An instance of DeviceUtils. |
| + """ |
| + all_tombstones = list(_ListTombstones(device)) |
| + if not all_tombstones: |
| + logging.warning('No tombstones.') |
| + |
| + for tombstone_file, _ in all_tombstones: |
| + _EraseTombstone(device, tombstone_file) |
| def main(): |
| custom_handler = logging.StreamHandler(sys.stdout) |
| @@ -239,6 +251,8 @@ def main(): |
| help='Path to the root build directory.') |
| parser.add_argument('--adb-path', type=os.path.abspath, |
| help='Path to the adb binary.') |
| + parser.add_argument('--erase-all-with-noprocess', action='store_true', |
| + help='Erase all tombstones without doing any process.') |
| args = parser.parse_args() |
| devil_chromium.Initialize(adb_path=args.adb_path) |
| @@ -249,23 +263,27 @@ def main(): |
| if args.output_directory: |
| constants.SetOutputDirectory(args.output_directory) |
| - # Do an up-front test that the output directory is known. |
| - constants.CheckOutputDirectory() |
| if args.device: |
| devices = [device_utils.DeviceUtils(args.device)] |
| else: |
| devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
| - # This must be done serially because strptime can hit a race condition if |
| - # used for the first time in a multithreaded environment. |
| - # http://bugs.python.org/issue7980 |
| - tombstones = [] |
| - for device in devices: |
| - tombstones += _GetTombstonesForDevice(device, args) |
| - |
| - _ResolveTombstones(args.jobs, tombstones) |
| - |
| + if args.erase_all_with_noprocess: |
| + for device in devices: |
| + for tombstone_file, _ in _ListTombstones(device): |
| + _EraseTombstone(device, tombstone_file) |
| + else: |
| + # Do an up-front test that the output directory is known. |
| + constants.CheckOutputDirectory() |
| + |
| + # This must be done serially because strptime can hit a race condition if |
| + # used for the first time in a multithreaded environment. |
| + # http://bugs.python.org/issue7980 |
| + tombstones = [] |
| + for device in devices: |
| + tombstones += _GetTombstonesForDevice(device, args) |
| + _ResolveTombstones(args.jobs, tombstones) |
| if __name__ == '__main__': |
| sys.exit(main()) |