aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skp
diff options
context:
space:
mode:
authorGravatar borenet <borenet@chromium.org>2016-07-21 10:27:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-21 10:27:00 -0700
commit85f0e63ca476568143a36242b438390f7e6d5c82 (patch)
treeb5b378c2df8e623c979f123283273139d16a7c9b /tools/skp
parent95302da19d8b0a3bcd9d9be0e79f486760787f09 (diff)
Add "skp" asset
Don't get rid of SKP_VERSION and associated stuff just yet. BUG=skia:5427 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2167763002 DOCS_PREVIEW= https://skia.org/?cl=2167763002 Review-Url: https://codereview.chromium.org/2167763002
Diffstat (limited to 'tools/skp')
-rw-r--r--tools/skp/recreate_skps.py96
-rw-r--r--tools/skp/webpages_playback.py5
2 files changed, 4 insertions, 97 deletions
diff --git a/tools/skp/recreate_skps.py b/tools/skp/recreate_skps.py
deleted file mode 100644
index b7ca07a9a7..0000000000
--- a/tools/skp/recreate_skps.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-"""Run the webpages_playback automation script."""
-
-
-import os
-import subprocess
-import sys
-
-sys.path.insert(0, os.getcwd())
-
-from common.py.utils import gs_utils
-from common.py.utils import shell_utils
-
-
-SKP_VERSION_FILE = 'SKP_VERSION'
-
-
-def _get_skp_version():
- """Find an unused SKP version."""
- current_skp_version = None
- with open(SKP_VERSION_FILE) as f:
- current_skp_version = int(f.read().rstrip())
-
- # Find the first SKP version which has no uploaded SKPs.
- new_version = current_skp_version + 1
- while True:
- gs_path = 'playback_%d/skps' % new_version
- if not gs_utils.GSUtils().does_storage_object_exist('chromium-skia-gm',
- gs_path):
- return new_version
- new_version += 1
-
-
-def main(chrome_src_path, browser_executable, dry_run):
- browser_executable = os.path.realpath(browser_executable)
- dry_run = (dry_run == 'True')
- skp_version = _get_skp_version()
- print 'SKP_VERSION=%d' % skp_version
-
- if os.environ.get('CHROME_HEADLESS'):
- # Start Xvfb if running on a bot.
- try:
- shell_utils.run('sudo Xvfb :0 -screen 0 1280x1024x24 &', shell=True)
- except Exception:
- # It is ok if the above command fails, it just means that DISPLAY=:0
- # is already up.
- pass
-
- upload_dir = 'playback_%d' % skp_version
- webpages_playback_cmd = [
- 'python', os.path.join(os.path.dirname(os.path.realpath(__file__)),
- 'webpages_playback.py'),
- '--page_sets', 'all',
- '--browser_executable', browser_executable,
- '--non-interactive',
- '--upload',
- '--alternate_upload_dir', upload_dir,
- '--chrome_src_path', chrome_src_path,
- ]
- if not dry_run:
- webpages_playback_cmd.append('--upload_to_partner_bucket')
-
- try:
- shell_utils.run(webpages_playback_cmd)
- finally:
- # Clean up any leftover browser instances. This can happen if there are
- # telemetry crashes, processes are not always cleaned up appropriately by
- # the webpagereplay and telemetry frameworks.
- procs = subprocess.check_output(['ps', 'ax'])
- for line in procs.splitlines():
- if browser_executable in line:
- pid = line.strip().split(' ')[0]
- if pid != str(os.getpid()) and not 'python' in line:
- try:
- shell_utils.run(['kill', '-9', pid])
- except shell_utils.CommandFailedException as e:
- print e
- else:
- print 'Refusing to kill self.'
-
- print 'writing %s: %s' % (SKP_VERSION_FILE, skp_version)
- with open(SKP_VERSION_FILE, 'w') as f:
- f.write(str(skp_version))
-
-
-if '__main__' == __name__:
- if len(sys.argv) != 4:
- print >> sys.stderr, ('USAGE: %s <chrome src path> <browser executable> '
- '<dry run>')
- sys.exit(1)
- main(*sys.argv[1:])
diff --git a/tools/skp/webpages_playback.py b/tools/skp/webpages_playback.py
index d5f45d65e6..8e78e0d31e 100644
--- a/tools/skp/webpages_playback.py
+++ b/tools/skp/webpages_playback.py
@@ -63,7 +63,10 @@ import tempfile
import time
import traceback
-sys.path.insert(0, os.getcwd())
+SKIA_DIR = os.path.abspath(os.path.join(
+ os.path.realpath(os.path.dirname(__file__)),
+ os.pardir, os.pardir))
+sys.path.insert(0, SKIA_DIR)
from common.py.utils import gs_utils
from common.py.utils import shell_utils