example.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. 'recipe_engine/json',
  6. 'recipe_engine/raw_io',
  7. 'recipe_engine/path',
  8. 'recipe_engine/platform',
  9. 'recipe_engine/properties',
  10. 'recipe_engine/python',
  11. 'recipe_engine/step',
  12. 'tryserver',
  13. ]
  14. def RunSteps(api):
  15. api.path['checkout'] = api.path['slave_build']
  16. if api.properties.get('patch_text'):
  17. api.step('patch_text test', [
  18. 'echo', str(api.tryserver.get_footers(api.properties['patch_text']))])
  19. api.step('patch_text test', [
  20. 'echo', str(api.tryserver.get_footer(
  21. 'Foo', api.properties['patch_text']))])
  22. return
  23. api.tryserver.maybe_apply_issue()
  24. if api.tryserver.can_apply_issue:
  25. api.tryserver.get_footers()
  26. api.tryserver.get_files_affected_by_patch(
  27. api.properties.get('test_patch_root'))
  28. if api.tryserver.is_tryserver:
  29. api.tryserver.set_subproject_tag('v8')
  30. api.tryserver.set_patch_failure_tryjob_result()
  31. api.tryserver.set_compile_failure_tryjob_result()
  32. api.tryserver.set_test_failure_tryjob_result()
  33. api.tryserver.set_invalid_test_results_tryjob_result()
  34. with api.tryserver.set_failure_hash():
  35. api.python.failing_step('fail', 'foo')
  36. def GenTests(api):
  37. description_step = api.override_step_data(
  38. 'git_cl description', stdout=api.raw_io.output('foobar'))
  39. yield (api.test('with_svn_patch') +
  40. api.properties(patch_url='svn://checkout.url'))
  41. yield (api.test('with_git_patch') +
  42. api.properties(
  43. patch_storage='git',
  44. patch_project='v8',
  45. patch_repo_url='http://patch.url/',
  46. patch_ref='johndoe#123.diff'))
  47. yield (api.test('with_rietveld_patch') +
  48. api.properties.tryserver() +
  49. description_step)
  50. yield (api.test('with_wrong_patch') + api.platform('win', 32))
  51. yield (api.test('with_rietveld_patch_new') +
  52. api.properties.tryserver(test_patch_root='sub/project') +
  53. description_step)
  54. yield (api.test('with_wrong_patch_new') + api.platform('win', 32) +
  55. api.properties(test_patch_root='sub\\project'))
  56. yield (api.test('basic_tags') +
  57. api.properties(
  58. patch_text='hihihi\nfoo:bar\nbam:baz',
  59. footer='foo'
  60. ) +
  61. api.step_data(
  62. 'parse description',
  63. api.json.output({'Foo': ['bar']})) +
  64. api.step_data(
  65. 'parse description (2)',
  66. api.json.output({'Foo': ['bar']}))
  67. )