2016-10-14 13:32:09 +00:00
|
|
|
# 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 which runs the Skia infra tests.
|
|
|
|
|
|
|
|
|
|
|
|
DEPS = [
|
2018-05-24 13:14:18 +00:00
|
|
|
'infra',
|
2017-05-13 02:09:38 +00:00
|
|
|
'recipe_engine/context',
|
2019-06-27 19:25:03 +00:00
|
|
|
'recipe_engine/path',
|
2016-10-14 13:32:09 +00:00
|
|
|
'recipe_engine/properties',
|
|
|
|
'recipe_engine/step',
|
2017-02-02 14:02:37 +00:00
|
|
|
'vars',
|
2016-10-14 13:32:09 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def RunSteps(api):
|
|
|
|
api.vars.setup()
|
|
|
|
|
2016-10-20 18:38:30 +00:00
|
|
|
# Run the infra tests.
|
2017-06-14 19:25:31 +00:00
|
|
|
repo_name = api.properties['repository'].split('/')[-1]
|
|
|
|
if repo_name.endswith('.git'):
|
|
|
|
repo_name = repo_name[:-len('.git')]
|
2019-06-27 19:25:03 +00:00
|
|
|
repo_root = api.path['start_dir'].join(repo_name)
|
2019-06-24 18:53:47 +00:00
|
|
|
infra_tests = repo_root.join('infra', 'bots', 'infra_tests.py')
|
2016-10-14 13:32:09 +00:00
|
|
|
|
2019-06-24 18:53:47 +00:00
|
|
|
# Merge the default environment with the Go environment.
|
|
|
|
env = {}
|
|
|
|
env.update(api.infra.go_env)
|
|
|
|
for k, v in api.vars.default_env.iteritems():
|
|
|
|
# The PATH variable gets merged; all others get replaced.
|
|
|
|
if k == 'PATH':
|
|
|
|
# This works because the value for PATH in go_env and default_env includes
|
|
|
|
# the '%(PATH)s' placeholder.
|
|
|
|
env[k] = env[k] % {k: v}
|
|
|
|
else:
|
|
|
|
env[k] = v
|
|
|
|
|
2019-06-27 19:25:03 +00:00
|
|
|
with api.context(cwd=repo_root, env=env):
|
|
|
|
# Some tests assume that they're being run inside a git repo.
|
|
|
|
api.step('git init', cmd=['git', 'init'])
|
|
|
|
api.step('git add .', cmd=['git', 'add', '.'])
|
|
|
|
api.step('git commit', cmd=['git', 'commit', '-a', '-m', 'initial commit'])
|
|
|
|
|
2019-06-24 18:53:47 +00:00
|
|
|
# Unfortunately, the recipe tests are flaky due to file removal on Windows.
|
|
|
|
# Run multiple attempts.
|
|
|
|
last_exc = None
|
|
|
|
for _ in range(3):
|
|
|
|
try:
|
|
|
|
api.step('infra_tests', cmd=['python', '-u', infra_tests])
|
|
|
|
break
|
|
|
|
except api.step.StepFailure as e: # pragma: nocover
|
|
|
|
last_exc = e
|
|
|
|
else: # pragma: nocover
|
|
|
|
raise last_exc
|
2016-10-14 13:32:09 +00:00
|
|
|
|
|
|
|
def GenTests(api):
|
|
|
|
yield (
|
|
|
|
api.test('infra_tests') +
|
2019-06-24 18:53:47 +00:00
|
|
|
api.properties(buildername='Housekeeper-PerCommit-InfraTests_Win',
|
2017-01-17 19:35:06 +00:00
|
|
|
repository='https://skia.googlesource.com/skia.git',
|
2016-10-14 13:32:09 +00:00
|
|
|
path_config='kitchen',
|
|
|
|
swarm_out_dir='[SWARM_OUT_DIR]')
|
|
|
|
)
|