Restore ios_flavor.

Just like Android, there's enough special ceremony needed to move files
to and from iOS devices that this reads most clearly as its own flavor.

CQ_INCLUDE_TRYBOTS=skia.primary:Test-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release

Change-Id: I01c8e5494c364cc61e219568f022219f7c3f5fdc
Reviewed-on: https://skia-review.googlesource.com/7988
Reviewed-by: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-02-02 18:55:03 -05:00
parent 0dda9cb881
commit 20f00784b8
5 changed files with 125 additions and 44 deletions

View File

@ -11,6 +11,7 @@ from recipe_engine import recipe_api
from . import default_flavor
from . import gn_android_flavor
from . import gn_flavor
from . import ios_flavor
from . import pdfium_flavor
from . import valgrind_flavor
@ -28,11 +29,12 @@ VERSION_NONE = -1
def is_android(builder_cfg):
return 'Android' in builder_cfg.get('extra_config', '')
def is_ios(builder_cfg):
return 'iOS' == builder_cfg.get('os', '')
def is_pdfium(builder_cfg):
return 'PDFium' in builder_cfg.get('extra_config', '')
def is_valgrind(builder_cfg):
return 'Valgrind' in builder_cfg.get('extra_config', '')
@ -42,6 +44,8 @@ class SkiaFlavorApi(recipe_api.RecipeApi):
"""Return a flavor utils object specific to the given builder."""
if is_android(builder_cfg):
return gn_android_flavor.GNAndroidFlavorUtils(self.m)
elif is_ios(builder_cfg):
return ios_flavor.iOSFlavorUtils(self.m)
elif is_pdfium(builder_cfg):
return pdfium_flavor.PDFiumFlavorUtils(self.m)
elif is_valgrind(builder_cfg):

View File

@ -135,16 +135,6 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
clang_linux = str(self.m.vars.slave_dir.join('clang_linux'))
extra_config = self.m.vars.builder_cfg.get('extra_config', '')
os = self.m.vars.builder_cfg.get('os', '')
if 'iOS' == os:
self._py('package ' + name,
self.m.vars.skia_dir.join('gn', 'package_ios.py'),
args=[str(app)])
self._run(name,
['ios-deploy', '-b', str(app) + '.app',
'-I', '--args', ' '.join(map(str, cmd[1:]))])
return
if 'SAN' in extra_config:
# Sanitized binaries may want to run clang_linux/bin/llvm-symbolizer.

View File

@ -0,0 +1,52 @@
# Copyright 2017 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.
import gn_flavor
# Infra step failures interact really annoyingly with swarming retries.
kInfraStep = False
class iOSFlavorUtils(gn_flavor.GNFlavorUtils):
def step(self, name, cmd, env=None, **kwargs):
app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0])
self._py('package ' + name,
self.m.vars.skia_dir.join('gn', 'package_ios.py'),
args=[str(app)])
self._run(name,
['ios-deploy', '-b', '%s.app' % app,
'-I', '--args', ' '.join(map(str, cmd[1:]))])
def _run_ios_script(self, script, first, *rest):
full = self.m.vars.skia_dir.join('platform_tools/ios/bin/ios_' + script)
self.m.run(self.m.step,
name = '%s %s' % (script, first),
cmd = [full, first] + list(rest),
infra_step=kInfraStep)
def copy_file_to_device(self, host, device):
self._run_ios_script('push_file', host, device)
def copy_directory_contents_to_device(self, host, device):
self._run_ios_script('push_if_needed', host, device)
def copy_directory_contents_to_host(self, device, host):
self._run_ios_script('pull_if_needed', device, host)
def remove_file_on_device(self, path): # pragma: nocover
self._run_ios_script('rm', path)
def create_clean_device_dir(self, path):
self._run_ios_script('rm', path)
self._run_ios_script('mkdir', path)
def read_file_on_device(self, path): # pragma: nocover
full = self.m.vars.skia_dir.join('platform_tools/ios/bin/ios_cat_file')
rc = self.m.run(self.m.step,
name = 'cat_file %s' % path,
cmd = [full, path],
stdout=self.m.raw_io.output(),
infra_step=kInfraStep)
return rc.stdout.rstrip() if rc.stdout else rc.stdout

View File

@ -1,4 +1,17 @@
[
{
"cmd": [
"[START_DIR]/skia/platform_tools/ios/bin/ios_push_if_needed",
"[START_DIR]/skia/resources",
"[START_DIR]/skia/resources"
],
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"SKIA_OUT": "[START_DIR]/out"
},
"name": "push_if_needed [START_DIR]/skia/resources"
},
{
"cmd": [
"python",
@ -61,47 +74,27 @@
},
{
"cmd": [
"python",
"-u",
"\nimport os, sys\nfrom common import chromium_utils # Error? See https://crbug.com/584783.\n\n\nif os.path.exists(sys.argv[1]):\n chromium_utils.RemoveDirectory(sys.argv[1])\n",
"[START_DIR]/skia/platform_tools/ios/bin/ios_rm",
"[CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data"
],
"env": {
"PYTHONPATH": "[START_DIR]/skia/infra/bots/.recipe_deps/build/scripts"
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"SKIA_OUT": "[START_DIR]/out"
},
"name": "rmtree data",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import os, sys@@@",
"@@@STEP_LOG_LINE@python.inline@from common import chromium_utils # Error? See https://crbug.com/584783.@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@if os.path.exists(sys.argv[1]):@@@",
"@@@STEP_LOG_LINE@python.inline@ chromium_utils.RemoveDirectory(sys.argv[1])@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
"name": "rm [CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data"
},
{
"cmd": [
"python",
"-u",
"\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
"[CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data",
"511"
"[START_DIR]/skia/platform_tools/ios/bin/ios_mkdir",
"[CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data"
],
"name": "makedirs data",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
"@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
"@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
"@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
"@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
"@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"SKIA_OUT": "[START_DIR]/out"
},
"name": "mkdir [CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data"
},
{
"cmd": [
@ -147,6 +140,14 @@
"@@@STEP_LOG_END@python.inline@@@"
]
},
{
"cmd": [
"[START_DIR]/skia/platform_tools/ios/bin/ios_pull_if_needed",
"[CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data",
"[CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data"
],
"name": "pull_if_needed [CUSTOM_[SWARM_OUT_DIR]]/perfdata/Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release/data"
},
{
"name": "$result",
"recipe_result": null,

View File

@ -1,4 +1,17 @@
[
{
"cmd": [
"[START_DIR]/skia/platform_tools/ios/bin/ios_push_if_needed",
"[START_DIR]/skia/resources",
"[START_DIR]/skia/resources"
],
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"SKIA_OUT": "[START_DIR]/out"
},
"name": "push_if_needed [START_DIR]/skia/resources"
},
{
"cmd": [
"python",
@ -173,6 +186,19 @@
"@@@STEP_LOG_END@python.inline@@@"
]
},
{
"cmd": [
"[START_DIR]/skia/platform_tools/ios/bin/ios_push_file",
"[START_DIR]/tmp/uninteresting_hashes.txt",
"[START_DIR]/tmp/uninteresting_hashes.txt"
],
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"SKIA_OUT": "[START_DIR]/out"
},
"name": "push_file [START_DIR]/tmp/uninteresting_hashes.txt"
},
{
"cmd": [
"python",
@ -195,6 +221,14 @@
"cwd": "[START_DIR]/skia",
"name": "dm"
},
{
"cmd": [
"[START_DIR]/skia/platform_tools/ios/bin/ios_pull_if_needed",
"[CUSTOM_[SWARM_OUT_DIR]]/dm",
"[CUSTOM_[SWARM_OUT_DIR]]/dm"
],
"name": "pull_if_needed [CUSTOM_[SWARM_OUT_DIR]]/dm"
},
{
"name": "$result",
"recipe_result": null,