diff options
author | Ben Wagner <benjaminwagner@google.com> | 2018-03-09 13:42:56 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-10 19:03:28 +0000 |
commit | 299b882f2094f6382e127b35112ac4d517482cbf (patch) | |
tree | 426c973837f7b734a443f42347111894287eb27a /infra/bots/assets | |
parent | 79ee1b0c4ee9b2b8be3e6b3865b0bebcf634ffef (diff) |
Add ProcDump support to gn_flavor.py.
Adds procdump_win asset.
Enable ProcDump for some of the jobs failing in skia:7177 as a test
case. If it has no ill effect, we can proceed with enabling it for all
Win bots (and remove "ProcDump" tag).
Bug: skia:7626, skia:7177
Change-Id: I50c67ecfca86fe0c6d91d5f970f81485cc9cfd0a
Reviewed-on: https://skia-review.googlesource.com/113265
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/assets')
-rw-r--r-- | infra/bots/assets/procdump_win/VERSION | 1 | ||||
-rwxr-xr-x | infra/bots/assets/procdump_win/common.py | 26 | ||||
-rwxr-xr-x | infra/bots/assets/procdump_win/create.py | 38 | ||||
-rwxr-xr-x | infra/bots/assets/procdump_win/create_and_upload.py | 42 | ||||
-rwxr-xr-x | infra/bots/assets/procdump_win/download.py | 16 | ||||
-rwxr-xr-x | infra/bots/assets/procdump_win/upload.py | 16 |
6 files changed, 139 insertions, 0 deletions
diff --git a/infra/bots/assets/procdump_win/VERSION b/infra/bots/assets/procdump_win/VERSION new file mode 100644 index 0000000000..c227083464 --- /dev/null +++ b/infra/bots/assets/procdump_win/VERSION @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/infra/bots/assets/procdump_win/common.py b/infra/bots/assets/procdump_win/common.py new file mode 100755 index 0000000000..caa0ad899c --- /dev/null +++ b/infra/bots/assets/procdump_win/common.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Common vars used by scripts in this directory.""" + + +import os +import sys + +FILE_DIR = os.path.dirname(os.path.abspath(__file__)) +INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir)) + +sys.path.insert(0, INFRA_BOTS_DIR) +from assets import assets + +ASSET_NAME = os.path.basename(FILE_DIR) + + +def run(cmd): + """Run a command, eg. "upload" or "download". """ + assets.main([cmd, ASSET_NAME] + sys.argv[1:]) diff --git a/infra/bots/assets/procdump_win/create.py b/infra/bots/assets/procdump_win/create.py new file mode 100755 index 0000000000..7160f830c3 --- /dev/null +++ b/infra/bots/assets/procdump_win/create.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset.""" + + +import argparse +import common +import subprocess +import utils + + +# Download URL can be found on this page: +# https://docs.microsoft.com/en-us/sysinternals/downloads/procdump +PROCDUMP_URL = 'https://download.sysinternals.com/files/Procdump.zip' + + +def create_asset(target_dir): + """Create the asset.""" + with utils.tmp_dir(): + subprocess.check_call(["curl", PROCDUMP_URL, "-o", "procdump.zip"]) + subprocess.check_call(["unzip", "procdump.zip", "-d", target_dir]) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--target_dir', '-t', required=True) + args = parser.parse_args() + create_asset(args.target_dir) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/procdump_win/create_and_upload.py b/infra/bots/assets/procdump_win/create_and_upload.py new file mode 100755 index 0000000000..de56a80fa8 --- /dev/null +++ b/infra/bots/assets/procdump_win/create_and_upload.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset and upload it.""" + + +import argparse +import common +import os +import subprocess +import sys +import utils + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--gsutil') + args = parser.parse_args() + + with utils.tmp_dir(): + cwd = os.getcwd() + create_script = os.path.join(common.FILE_DIR, 'create.py') + upload_script = os.path.join(common.FILE_DIR, 'upload.py') + + try: + subprocess.check_call(['python', create_script, '-t', cwd]) + cmd = ['python', upload_script, '-t', cwd] + if args.gsutil: + cmd.extend(['--gsutil', args.gsutil]) + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + # Trap exceptions to avoid printing two stacktraces. + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/procdump_win/download.py b/infra/bots/assets/procdump_win/download.py new file mode 100755 index 0000000000..ca999e0378 --- /dev/null +++ b/infra/bots/assets/procdump_win/download.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Download the current version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('download') diff --git a/infra/bots/assets/procdump_win/upload.py b/infra/bots/assets/procdump_win/upload.py new file mode 100755 index 0000000000..bdfbda783e --- /dev/null +++ b/infra/bots/assets/procdump_win/upload.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Upload a new version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('upload') |