example.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Copyright 2014 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. DEPS = [
  5. 'bot_update',
  6. 'gclient',
  7. 'recipe_engine/path',
  8. 'recipe_engine/properties',
  9. ]
  10. def RunSteps(api):
  11. api.gclient.use_mirror = True
  12. src_cfg = api.gclient.make_config(CACHE_DIR='[GIT_CACHE]')
  13. soln = src_cfg.solutions.add()
  14. soln.name = 'src'
  15. soln.url = 'https://chromium.googlesource.com/chromium/src.git'
  16. soln.revision = api.properties.get('revision')
  17. api.gclient.c = src_cfg
  18. api.gclient.c.revisions.update(api.properties.get('revisions', {}))
  19. api.gclient.c.got_revision_mapping['src'] = 'got_cr_revision'
  20. api.gclient.c.patch_projects['v8'] = ('src/v8', 'HEAD')
  21. api.gclient.c.patch_projects['angle/angle'] = ('src/third_party/angle',
  22. 'HEAD')
  23. patch = api.properties.get('patch', True)
  24. clobber = True if api.properties.get('clobber') else False
  25. no_shallow = True if api.properties.get('no_shallow') else False
  26. output_manifest = api.properties.get('output_manifest', False)
  27. with_branch_heads = api.properties.get('with_branch_heads', False)
  28. refs = api.properties.get('refs', [])
  29. oauth2 = api.properties.get('oauth2', False)
  30. root_solution_revision = api.properties.get('root_solution_revision')
  31. suffix = api.properties.get('suffix')
  32. gerrit_no_reset = True if api.properties.get('gerrit_no_reset') else False
  33. gerrit_no_rebase_patch_ref = bool(
  34. api.properties.get('gerrit_no_rebase_patch_ref'))
  35. if api.properties.get('test_apply_gerrit_ref'):
  36. api.bot_update.apply_gerrit_ref(
  37. root='/tmp/test/root',
  38. gerrit_no_reset=gerrit_no_reset,
  39. gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref)
  40. else:
  41. api.bot_update.ensure_checkout(
  42. no_shallow=no_shallow,
  43. patch=patch,
  44. with_branch_heads=with_branch_heads,
  45. output_manifest=output_manifest,
  46. refs=refs, patch_oauth2=oauth2,
  47. clobber=clobber,
  48. root_solution_revision=root_solution_revision,
  49. suffix=suffix,
  50. gerrit_no_reset=gerrit_no_reset,
  51. gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref)
  52. def GenTests(api):
  53. yield api.test('basic') + api.properties(
  54. patch=False,
  55. revision='abc'
  56. )
  57. yield api.test('basic_with_branch_heads') + api.properties(
  58. with_branch_heads=True,
  59. suffix='with branch heads'
  60. )
  61. yield api.test('basic_output_manifest') + api.properties(
  62. output_manifest=True,
  63. )
  64. yield api.test('tryjob') + api.properties(
  65. issue=12345,
  66. patchset=654321,
  67. rietveld='https://rietveld.example.com/',
  68. )
  69. yield api.test('trychange') + api.properties(
  70. refs=['+refs/change/1/2/333'],
  71. )
  72. yield api.test('trychange_oauth2') + api.properties(
  73. oauth2=True,
  74. )
  75. yield api.test('tryjob_fail') + api.properties(
  76. issue=12345,
  77. patchset=654321,
  78. rietveld='https://rietveld.example.com/',
  79. ) + api.step_data('bot_update', retcode=1)
  80. yield api.test('tryjob_fail_patch') + api.properties(
  81. issue=12345,
  82. patchset=654321,
  83. rietveld='https://rietveld.example.com/',
  84. fail_patch='apply',
  85. ) + api.step_data('bot_update', retcode=88)
  86. yield api.test('tryjob_fail_patch_download') + api.properties(
  87. issue=12345,
  88. patchset=654321,
  89. rietveld='https://rietveld.example.com/',
  90. fail_patch='download'
  91. ) + api.step_data('bot_update', retcode=87)
  92. yield api.test('no_shallow') + api.properties(
  93. no_shallow=1
  94. )
  95. yield api.test('clobber') + api.properties(
  96. clobber=1
  97. )
  98. yield api.test('reset_root_solution_revision') + api.properties(
  99. root_solution_revision='revision',
  100. )
  101. yield api.test('gerrit_no_reset') + api.properties(
  102. gerrit_no_reset=1
  103. )
  104. yield api.test('gerrit_no_rebase_patch_ref') + api.properties(
  105. gerrit_no_rebase_patch_ref=True
  106. )
  107. yield api.test('apply_gerrit_ref') + api.properties(
  108. repository='chromium',
  109. gerrit_no_rebase_patch_ref=True,
  110. gerrit_no_reset=1,
  111. test_apply_gerrit_ref=True,
  112. )
  113. yield api.test('tryjob_v8') + api.properties(
  114. issue=12345,
  115. patchset=654321,
  116. rietveld='https://rietveld.example.com/',
  117. patch_project='v8',
  118. revisions={'src/v8': 'abc'}
  119. )
  120. yield api.test('tryjob_v8_head_by_default') + api.properties.tryserver(
  121. patch_project='v8',
  122. )
  123. yield api.test('tryjob_gerrit_angle') + api.properties.tryserver_gerrit(
  124. full_project_name='angle/angle',
  125. )