• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 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
5PYTHON_VERSION_COMPATIBILITY = "PY2+3"
6
7DEPS = [
8  'builder_name_schema',
9]
10
11
12def RunSteps(api):
13  names = [
14    'Build-Debian10-Clang-x64-Release-Android',
15    'Upload-Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-Shard_12-Coverage',
16  ]
17  for name in names:
18    d = api.builder_name_schema.DictForBuilderName(name)
19    got = api.builder_name_schema.MakeBuilderName(**d)
20    assert got == name
21
22  # Failures.
23  try:
24    api.builder_name_schema.MakeBuilderName(role='nope')
25  except ValueError:
26    pass
27
28  try:
29    api.builder_name_schema.MakeBuilderName(compiler='Build', os='ab')
30  except ValueError:
31    pass
32
33  try:
34    api.builder_name_schema.MakeBuilderName(role='Build', bogus='BOGUS')
35  except ValueError:
36    pass
37
38  try:
39    api.builder_name_schema.MakeBuilderName(
40        role='Build',
41        os='Debian10',
42        compiler='Clang',
43        target_arch='x64',
44        configuration='Release',
45        extra_config='A%sB' % api.builder_name_schema.BUILDER_NAME_SEP)
46  except ValueError:
47    pass
48
49  try:
50    api.builder_name_schema.DictForBuilderName('Build-')
51  except ValueError:
52    pass
53
54  try:
55    api.builder_name_schema.DictForBuilderName(
56        'Build-Debian10-Clang-x64-Release-Android-Bogus')
57  except ValueError:
58    pass
59
60  try:
61    api.builder_name_schema.DictForBuilderName(
62        'Bogus-Debian10-Clang-x64-Release-Android')
63  except ValueError:
64    pass
65
66  try:
67    api.builder_name_schema.MakeBuilderName(role='Upload')
68  except ValueError:
69    pass
70
71  try:
72    m = {
73      'role': 'Upload',
74      'sub-role-1': 'fake',
75    }
76    api.builder_name_schema.MakeBuilderName(**m)
77  except ValueError:
78    pass
79
80  try:
81    api.builder_name_schema.MakeBuilderName(
82        role='Build',
83        os='Debian10',
84        compiler='Clang',
85        target_arch='x64',
86        configuration='Release',
87        extra_config='Android',
88        extra_extra_config='Bogus',
89    )
90  except ValueError:
91    pass
92
93def GenTests(api):
94  yield api.test('test')
95