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

Unified Diff: scripts/slave/recipe_modules/isolate/resources/find_isolated_tests.py

Issue 620703002: Add isolate.clean_isolated_files and use in all related recipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 3 months 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
Index: scripts/slave/recipe_modules/isolate/resources/find_isolated_tests.py
diff --git a/scripts/slave/recipe_modules/isolate/resources/find_isolated_tests.py b/scripts/slave/recipe_modules/isolate/resources/find_isolated_tests.py
index 2b55afab53fd5e58bb85d8eb2ba606209a33631f..e8022cb796854ad5f506a639daa6c074c9558cae 100755
--- a/scripts/slave/recipe_modules/isolate/resources/find_isolated_tests.py
+++ b/scripts/slave/recipe_modules/isolate/resources/find_isolated_tests.py
@@ -36,20 +36,30 @@ def hash_file(filepath):
def main():
parser = optparse.OptionParser(
- usage='%prog --build-dir <path> --output-json <path>',
+ usage='%prog --build-dir <path> '
+ '[--output-json <path> | --clean-isolated-files]',
description=sys.modules[__name__].__doc__)
parser.add_option(
'--build-dir',
help='Path to a directory to search for *.isolated files.')
parser.add_option(
'--output-json',
- help='File to dump JSON results into.')
+ help='File to dump JSON results into. '
+ 'Mutually exclusive with --clean-isolated-files.')
+ parser.add_option(
+ '--clean-isolated-files',
+ action='store_true',
+ help='Whether to clean out all .isolated files. '
+ 'Mutually exclusive with --output-json.')
options, _ = parser.parse_args()
if not options.build_dir:
parser.error('--build-dir option is required')
- if not options.output_json:
- parser.error('--output-json option is required')
+ if not (options.output_json or options.clean_isolated_files):
+ parser.error('either --output-json or --clean-isolated-files is required')
+ if options.output_json and options.clean_isolated_files:
+ parser.error('only one of --output-json and '
+ '--clean-isolated-files is allowed')
result = {}
@@ -61,11 +71,18 @@ def main():
# It's a split .isolated file, e.g. foo.0.isolated. Ignore these.
continue
- sha1_hash = hash_file(filepath)
- result[test_name] = sha1_hash
-
- with open(options.output_json, 'wb') as f:
- json.dump(result, f)
+ if options.clean_isolated_files:
+ # TODO(csharp): Remove deletion entirely once the isolate
+ # tracked dependencies are inputs for the isolated files.
+ # http://crbug.com/419031
+ os.remove(filepath)
+ else:
+ sha1_hash = hash_file(filepath)
+ result[test_name] = sha1_hash
+
+ if options.output_json:
+ with open(options.output_json, 'wb') as f:
+ json.dump(result, f)
return 0
« no previous file with comments | « scripts/slave/recipe_modules/isolate/api.py ('k') | scripts/slave/recipes/chromium.expected/dynamic_swarmed_gtest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698