example.py 2.51 KB
Newer Older
1 2 3 4 5
# Copyright 2014 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.

DEPS = [
6 7
  'recipe_engine/json',
  'recipe_engine/raw_io',
8 9 10 11
  'recipe_engine/path',
  'recipe_engine/platform',
  'recipe_engine/properties',
  'recipe_engine/python',
12
  'recipe_engine/step',
13 14 15 16 17
  'tryserver',
]


def RunSteps(api):
18
  api.path['checkout'] = api.path['slave_build']
19 20 21 22 23 24 25 26
  if api.properties.get('patch_text'):
    api.step('patch_text test', [
        'echo', str(api.tryserver.get_footers(api.properties['patch_text']))])
    api.step('patch_text test', [
        'echo', str(api.tryserver.get_footer(
            'Foo', api.properties['patch_text']))])
    return

27
  api.tryserver.maybe_apply_issue()
28 29
  if api.tryserver.can_apply_issue:
    api.tryserver.get_footers()
30 31
  api.tryserver.get_files_affected_by_patch(
      api.properties.get('test_patch_root'))
32 33 34 35 36 37 38 39 40 41 42 43 44 45

  if api.tryserver.is_tryserver:
    api.tryserver.set_subproject_tag('v8')

  api.tryserver.set_patch_failure_tryjob_result()
  api.tryserver.set_compile_failure_tryjob_result()
  api.tryserver.set_test_failure_tryjob_result()
  api.tryserver.set_invalid_test_results_tryjob_result()

  with api.tryserver.set_failure_hash():
    api.python.failing_step('fail', 'foo')


def GenTests(api):
46 47
  description_step = api.override_step_data(
      'git_cl description', stdout=api.raw_io.output('foobar'))
48 49 50 51 52 53 54 55 56 57 58
  yield (api.test('with_svn_patch') +
         api.properties(patch_url='svn://checkout.url'))

  yield (api.test('with_git_patch') +
         api.properties(
              patch_storage='git',
              patch_project='v8',
              patch_repo_url='http://patch.url/',
              patch_ref='johndoe#123.diff'))

  yield (api.test('with_rietveld_patch') +
59 60
         api.properties.tryserver() +
         description_step)
61 62

  yield (api.test('with_wrong_patch') + api.platform('win', 32))
63 64

  yield (api.test('with_rietveld_patch_new') +
65 66
         api.properties.tryserver(test_patch_root='sub/project') +
         description_step)
67 68 69

  yield (api.test('with_wrong_patch_new') + api.platform('win', 32) +
         api.properties(test_patch_root='sub\\project'))
70 71 72 73 74 75 76 77 78 79 80 81 82

  yield (api.test('basic_tags') +
         api.properties(
             patch_text='hihihi\nfoo:bar\nbam:baz',
             footer='foo'
         ) +
         api.step_data(
             'parse description',
             api.json.output({'Foo': ['bar']})) +
         api.step_data(
             'parse description (2)',
             api.json.output({'Foo': ['bar']}))
  )