aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipe_modules/builder_name_schema/examples/full.py
blob: 5e5f77ffcb552ac1bf06b55a9ec301d395310b06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2017 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 = [
  'builder_name_schema',
]


def RunSteps(api):
  name = 'Build-Debian9-Clang-x64-Release-Android'
  d = api.builder_name_schema.DictForBuilderName(name)
  got = api.builder_name_schema.MakeBuilderName(**d)
  assert got == name

  # Failures.
  try:
    api.builder_name_schema.MakeBuilderName('nope')
  except ValueError:
    pass

  try:
    api.builder_name_schema.MakeBuilderName(
        role='Build', os='a%sb' % api.builder_name_schema.BUILDER_NAME_SEP)
  except ValueError:
    pass

  try:
    api.builder_name_schema.MakeBuilderName(role='Build', bogus='BOGUS')
  except ValueError:
    pass

  try:
    api.builder_name_schema.MakeBuilderName(
        role='Build',
        os='Debian9',
        compiler='Clang',
        target_arch='x64',
        configuration='Release',
        extra_config='A%sB' % api.builder_name_schema.BUILDER_NAME_SEP)
  except ValueError:
    pass

  try:
    api.builder_name_schema.DictForBuilderName('Build-')
  except ValueError:
    pass

  try:
    api.builder_name_schema.DictForBuilderName(
        'Build-Debian9-Clang-x64-Release-Android-Bogus')
  except ValueError:
    pass

  try:
    api.builder_name_schema.DictForBuilderName(
        'Bogus-Debian9-Clang-x64-Release-Android')
  except ValueError:
    pass


def GenTests(api):
  yield api.test('test')