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