blob: 619d2d088252b6ec2dde3c63402117240216b1bc [file] [log] [blame]
# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
"""Recipe for running a specified script from."""
from PB.recipes.pigweed.run_script import InputProperties
DEPS = [
'fuchsia/status_check',
'pigweed/checkout',
'pigweed/environment',
'recipe_engine/properties',
'recipe_engine/step',
]
PROPERTIES = InputProperties
PYTHON_VERSION_COMPATIBILITY = "PY3"
def RunSteps(api, props):
api.checkout()
env = api.environment.init(api.checkout.root, props.environment_options)
cmd = [api.checkout.root.join(props.script)]
cmd.extend(props.arguments)
with env():
api.step('run {}'.format(props.script), cmd)
def GenTests(api):
def properties(**kwargs):
new_kwargs = api.checkout.git_properties()
new_kwargs.update(kwargs)
return api.properties(**new_kwargs)
yield (
api.status_check.test('run_script')
+ properties(script='foo/bar/run-tests.sh', arguments='foo bar'.split())
)