skia2/infra/bots/recipes/test.py

219 lines
6.5 KiB
Python
Raw Normal View History

# Copyright 2016 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.
# Recipe module for Skia Swarming test.
import json
DEPS = [
'env',
'flavor',
'recipe_engine/context',
'recipe_engine/file',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/raw_io',
'recipe_engine/step',
'run',
'vars',
]
def test_steps(api):
"""Run the DM test."""
do_upload = api.properties.get('do_upload') == 'true'
images = api.properties.get('images') == 'true'
lotties = api.properties.get('lotties') == 'true'
resources = api.properties.get('resources') == 'true'
skps = api.properties.get('skps') == 'true'
svgs = api.properties.get('svgs') == 'true'
api.flavor.install(
images=images,
lotties=lotties,
resources=resources,
skps=skps,
svgs=svgs,
)
use_hash_file = False
if do_upload:
host_dm_dir = str(api.flavor.host_dirs.dm_dir)
api.flavor.create_clean_host_dir(api.path['start_dir'].join('test'))
device_dm_dir = str(api.flavor.device_dirs.dm_dir)
if host_dm_dir != device_dm_dir:
api.flavor.create_clean_device_dir(device_dm_dir)
# Obtain the list of already-generated hashes.
hash_filename = 'uninteresting_hashes.txt'
host_hashes_file = api.vars.tmp_dir.join(hash_filename)
hashes_file = api.flavor.device_path_join(
api.flavor.device_dirs.tmp_dir, hash_filename)
api.run(
api.python.inline,
'get uninteresting hashes',
program="""
import contextlib
import math
import socket
import sys
import time
import urllib2
HASHES_URL = sys.argv[1]
RETRIES = 5
TIMEOUT = 60
WAIT_BASE = 15
socket.setdefaulttimeout(TIMEOUT)
for retry in range(RETRIES):
try:
with contextlib.closing(
urllib2.urlopen(HASHES_URL, timeout=TIMEOUT)) as w:
hashes = w.read()
with open(sys.argv[2], 'w') as f:
f.write(hashes)
break
except Exception as e:
print 'Failed to get uninteresting hashes from %s:' % HASHES_URL
print e
if retry == RETRIES:
raise
waittime = WAIT_BASE * math.pow(2, retry)
print 'Retry in %d seconds.' % waittime
time.sleep(waittime)
""",
args=[api.properties['gold_hashes_url'], host_hashes_file],
abort_on_failure=False,
fail_build_on_failure=False,
infra_step=True)
if api.path.exists(host_hashes_file):
api.flavor.copy_file_to_device(host_hashes_file, hashes_file)
use_hash_file = True
# Find DM flags.
args = json.loads(api.properties['dm_flags'])
props = json.loads(api.properties['dm_properties'])
args.append('--properties')
# Map iteration order is arbitrary; in order to maintain a consistent step
# ordering, sort by key.
for k in sorted(props.keys()):
v = props[k]
if v == '${SWARMING_BOT_ID}':
v = api.vars.swarming_bot_id
elif v == '${SWARMING_TASK_ID}':
v = api.vars.swarming_task_id
if v != '':
args.extend([k, v])
# Paths to required resources.
if resources:
args.extend(['--resourcePath', api.flavor.device_dirs.resource_dir])
if skps:
args.extend(['--skps', api.flavor.device_dirs.skp_dir])
if images:
args.extend([
'--images', api.flavor.device_path_join(
api.flavor.device_dirs.images_dir, 'dm'),
'--colorImages', api.flavor.device_path_join(
api.flavor.device_dirs.images_dir, 'colorspace'),
])
if svgs:
args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
if lotties:
args.extend([
'--lotties',
api.flavor.device_path_join(
api.flavor.device_dirs.resource_dir, 'skottie'),
api.flavor.device_dirs.lotties_dir,
])
if use_hash_file:
args.extend(['--uninterestingHashesFile', hashes_file])
if do_upload:
args.extend(['--writePath', api.flavor.device_dirs.dm_dir])
# Run DM.
api.run(api.flavor.step, 'dm', cmd=args, abort_on_failure=False)
if do_upload:
# Copy images and JSON to host machine if needed.
api.flavor.copy_directory_contents_to_host(
api.flavor.device_dirs.dm_dir, api.flavor.host_dirs.dm_dir)
def RunSteps(api):
api.vars.setup()
api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
api.flavor.setup('dm')
try:
test_steps(api)
finally:
api.flavor.cleanup_steps()
api.run.check_failure()
TEST_BUILDERS = [
Shuffle jobs off Nexus5x. All Golo devices except 2 are AWOL. We added 6 to the Skolo, but they can't keep up. This CL moves the following jobs off Nexus5x: - All ASAN jobs to Pixel. Most other devices we have can't be rooted, so they can't run ASAN. - Vulkan NoGPUThreads arm64 jobs to NVIDIA_Shield. Of the devices that support Vulkan, this has the most available capacity. - I removed the arm32 Vulkan NoGPUThreads jobs because it seems a bit esoteric. - Also removed arm32 Vulkan Debug Perf because I can't imagine it would ever give us info that arm64 doesn't already provide. (We ignore Perf data from Debug builds.) - Other arm32 Vulkan jobs stayed on Nexus5x because we don't have any other Vulkan-capable devices with spare capacity. - Most arm32 jobs to MotoG4 and de-duplicated. This device has an ARMv8 processor but runs everything in arm32 mode, which is exactly what these jobs are trying to test. We have a bunch of MotoG4s in the Skolo; however, they don't support Vulkan or ASAN. - NoGPUThreads and NativeFonts arm64 jobs to GalaxyS6. There are only 6 in the Skolo, but for some reason these devices are particularly fast. They also don't support Vulkan or ASAN. - Currently GalaxyS6 CPU arm64 jobs fail, possibly due to OOM. I will try to move those jobs in a future CL. Sorted jobs.json. Change-Id: If02584a9c04906f4b9c31b4ba3f1da0289a5b8a9 Reviewed-on: https://skia-review.googlesource.com/141281 Commit-Queue: Joe Gregorio <jcgregorio@google.com> Auto-Submit: Ben Wagner <benjaminwagner@google.com> Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-07-15 19:12:01 +00:00
'Test-Android-Clang-Pixel-GPU-Adreno530-arm-Debug-All-Android_ASAN',
'Test-Android-Clang-Pixel2XL-GPU-Adreno540-arm64-Debug-All-Android',
'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-Lottie',
'Test-Win10-Clang-ShuttleC-GPU-GTX960-x86_64-Debug-All-ANGLE',
]
def GenTests(api):
for builder in TEST_BUILDERS:
props = dict(
buildername=builder,
buildbucket_build_id='123454321',
dm_flags='["dm","--dummy","--flags"]',
dm_properties=('{"key1":"value1","key2":"",'
'"bot":"${SWARMING_BOT_ID}",'
'"task":"${SWARMING_TASK_ID}"}'),
revision='abc123',
path_config='kitchen',
gold_hashes_url='https://example.com/hashes.txt',
swarm_out_dir='[SWARM_OUT_DIR]',
task_id='task_12345',
resources='true',
)
if 'ASAN' not in builder:
props['do_upload'] = 'true'
if 'Lottie' in builder:
props['lotties'] = 'true'
else:
props['images'] = 'true'
props['skps'] = 'true'
props['svgs'] = 'true'
test = (
api.test(builder) +
api.properties(**props) +
api.path.exists(
api.path['start_dir'].join('skia'),
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
'skimage', 'VERSION'),
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
'skp', 'VERSION'),
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
'svg', 'VERSION'),
api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
) +
api.step_data('get swarming bot id',
stdout=api.raw_io.output('skia-bot-123')) +
api.step_data('get swarming task id',
stdout=api.raw_io.output('123456'))
)
if 'Win' in builder and not 'LenovoYogaC630' in builder:
test += api.platform('win', 64)
yield test