Commit 48546cf2 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[blinkpy] Do not use CWD as output dir on Swarming

The merge_web_test_results.py script used to use the current working
directory when --output-directory isn't specified but --output-json is
(which is the case on Swarming). This could be dangerous as the script
will clean everything in the output directory.

This CL changes the behaviour to always create a temporary output
directory if it's not specified.

Bug: 960994
Change-Id: If1dd0f060557e7fb7014ea0a1dc2ba0bf234e1e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606820Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659717}
parent f028b851
......@@ -507,7 +507,7 @@ class DirMerger(Merger):
# If we're only 'merging' one file, don't output to the log. Not a
# very useful message.
if len(to_merge) > 1:
_log.debug("Creating merged %s from %s", out_path, to_merge)
_log.debug("Creating merged %s from %s", out_path, to_merge)
for match_func, merge_func in reversed(self.helpers):
......@@ -781,11 +781,6 @@ directory. The script will be given the arguments plus
assert (result_key, build_prop_key) in RESULTS_JSON_VALUE_OVERRIDE_WITH_BUILD_PROPERTY, (
"%s not in %s" % (result_key, RESULTS_JSON_VALUE_OVERRIDE_WITH_BUILD_PROPERTY))
if not args.output_directory:
args.output_directory = os.getcwd()
args.allow_existing_output_directory = True
args.remove_existing_output_directory = True
assert not args.input_directories
args.input_directories = [os.path.dirname(f) for f in args.positional]
args.positional = []
......@@ -797,6 +792,7 @@ directory. The script will be given the arguments plus
if not args.output_directory:
args.output_directory = tempfile.mkdtemp(suffix='webkit_layout_test_results.')
args.allow_existing_output_directory = True
assert args.output_directory
assert args.input_directories
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment