blob: 1be59f210676e10b2ae44069cfe5bec3d1de8e02 [file] [log] [blame]
# Copyright 2020 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.
from recipe_engine import post_process, recipe_test_api
class RollUtilTestApi(recipe_test_api.RecipeTestApi):
def commit(self, hash, message):
return ' '.join((hash, message))
def commit_data(self, *commits):
return self.step_data(
'roll message.git log',
stdout=self.m.raw_io.output('\0'.join(commits)),
)
def cancelled(self):
return self.post_process(post_process.MustRunRE, '.*cancelling roll.*')
def not_cancelled(self):
return self.post_process(
post_process.DoesNotRunRE, '.*cancelling roll.*'
)
def rolls_forward(self, prefix='', name='check roll direction'):
return self.step_data(prefix + name, retcode=0)
def rolls_backward(self, prefix='', name='check roll direction'):
return self.step_data(prefix + name, retcode=1)