blob: d33f9409a4c0b57565fbdaa4d7b8705dc003ab1d [file] [log] [blame]
Nathaniel Manistaae4fbcd2015-09-23 16:29:44 +00001#!/usr/bin/env python2.7
Craig Tilleree36bce2016-01-19 12:56:21 -08002# Copyright 2015-2016, Google Inc.
Craig Tillerc2c79212015-02-16 12:00:01 -08003# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met:
8#
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# * Redistributions in binary form must reproduce the above
12# copyright notice, this list of conditions and the following disclaimer
13# in the documentation and/or other materials provided with the
14# distribution.
15# * Neither the name of Google Inc. nor the names of its
16# contributors may be used to endorse or promote products derived from
17# this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
nnoble0c475f02014-12-05 15:37:39 -080031
32"""Generates the appropriate build.json data for all the end2end tests."""
33
34
Craig Tiller1ebb7c82015-08-31 15:53:36 -070035import yaml
Julien Boeufd7f768b2015-05-08 16:37:16 -070036import collections
Craig Tiller1ebb7c82015-08-31 15:53:36 -070037import hashlib
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080038
Craig Tillerc8b357f2015-04-20 16:36:52 -070039
Craig Tiller6a275142015-12-02 11:03:09 -080040FixtureOptions = collections.namedtuple(
41 'FixtureOptions',
42 'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing')
43default_unsecure_fixture_options = FixtureOptions(
44 True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False)
Craig Tiller17effab2015-08-04 08:19:36 -070045socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False)
46default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True)
Craig Tillerd50993d2015-08-05 08:04:36 -070047uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix'])
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +020048
Craig Tiller1ebb7c82015-08-31 15:53:36 -070049
Craig Tillerc8b357f2015-04-20 16:36:52 -070050# maps fixture name to whether it requires the security library
51END2END_FIXTURES = {
Craig Tiller1726e832015-11-03 12:45:11 -080052 'h2_compress': default_unsecure_fixture_options,
Craig Tillerc586f4e2015-12-10 10:26:05 -080053 'h2_census': default_unsecure_fixture_options,
Craig Tiller1ebb7c82015-08-31 15:53:36 -070054 'h2_fakesec': default_secure_fixture_options._replace(ci_mac=False),
55 'h2_full': default_unsecure_fixture_options,
Craig Tiller6a275142015-12-02 11:03:09 -080056 'h2_full+poll': default_unsecure_fixture_options._replace(
57 platforms=['linux']),
Craig Tillerf218c8b2015-12-10 14:57:56 -080058 'h2_full+pipe': default_unsecure_fixture_options._replace(
59 platforms=['linux']),
60 'h2_full+poll+pipe': default_unsecure_fixture_options._replace(
61 platforms=['linux']),
Craig Tiller1726e832015-11-03 12:45:11 -080062 'h2_oauth2': default_secure_fixture_options._replace(ci_mac=False),
Craig Tiller6a275142015-12-02 11:03:09 -080063 'h2_proxy': default_unsecure_fixture_options._replace(includes_proxy=True,
64 ci_mac=False),
65 'h2_sockpair_1byte': socketpair_unsecure_fixture_options._replace(
66 ci_mac=False),
Craig Tiller1726e832015-11-03 12:45:11 -080067 'h2_sockpair': socketpair_unsecure_fixture_options._replace(ci_mac=False),
Craig Tiller6a275142015-12-02 11:03:09 -080068 'h2_sockpair+trace': socketpair_unsecure_fixture_options._replace(
69 tracing=True),
Craig Tiller1ebb7c82015-08-31 15:53:36 -070070 'h2_ssl': default_secure_fixture_options,
71 'h2_ssl+poll': default_secure_fixture_options._replace(platforms=['linux']),
Craig Tiller6a275142015-12-02 11:03:09 -080072 'h2_ssl_proxy': default_secure_fixture_options._replace(includes_proxy=True,
73 ci_mac=False),
Craig Tillerc6dea802015-11-25 09:21:48 -080074 'h2_uchannel': default_unsecure_fixture_options._replace(fullstack=False),
Craig Tiller1726e832015-11-03 12:45:11 -080075 'h2_uds+poll': uds_fixture_options._replace(platforms=['linux']),
76 'h2_uds': uds_fixture_options,
Craig Tillerc8b357f2015-04-20 16:36:52 -070077}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080078
Craig Tiller6a275142015-12-02 11:03:09 -080079TestOptions = collections.namedtuple(
Craig Tiller56c6b6a2016-01-20 08:27:37 -080080 'TestOptions', 'needs_fullstack needs_dns proxyable secure traceable cpu_cost')
81default_test_options = TestOptions(False, False, True, False, True, 1.0)
Craig Tiller17effab2015-08-04 08:19:36 -070082connectivity_test_options = default_test_options._replace(needs_fullstack=True)
Julien Boeuf9f218dd2015-04-23 10:24:02 -070083
Craig Tiller56c6b6a2016-01-20 08:27:37 -080084LOWCPU = 0.01
85
Julien Boeuf9f218dd2015-04-23 10:24:02 -070086# maps test names to options
Nicolas "Pixel" Nobleb8137b32015-04-24 01:44:28 +020087END2END_TESTS = {
Julien Boeufd7f768b2015-05-08 16:37:16 -070088 'bad_hostname': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -080089 'binary_metadata': default_test_options,
90 'call_creds': default_test_options._replace(secure=True),
Craig Tiller56c6b6a2016-01-20 08:27:37 -080091 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU),
92 'cancel_after_client_done': default_test_options._replace(cpu_cost=LOWCPU),
93 'cancel_after_invoke': default_test_options._replace(cpu_cost=LOWCPU),
94 'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU),
95 'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU),
96 'cancel_with_status': default_test_options._replace(cpu_cost=LOWCPU),
Craig Tiller17effab2015-08-04 08:19:36 -070097 'channel_connectivity': connectivity_test_options._replace(proxyable=False),
Craig Tiller26dab312015-12-07 14:43:47 -080098 'channel_ping': connectivity_test_options._replace(proxyable=False),
Craig Tiller1726e832015-11-03 12:45:11 -080099 'compressed_payload': default_test_options._replace(proxyable=False),
Craig Tiller6a275142015-12-02 11:03:09 -0800100 'default_host': default_test_options._replace(needs_fullstack=True,
101 needs_dns=True),
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700102 'disappearing_server': connectivity_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700103 'empty_batch': default_test_options,
104 'graceful_server_shutdown': default_test_options,
Craig Tiller6a275142015-12-02 11:03:09 -0800105 'hpack_size': default_test_options._replace(proxyable=False,
Craig Tiller56c6b6a2016-01-20 08:27:37 -0800106 traceable=False,
107 cpu_cost=2.0),
Craig Tiller1726e832015-11-03 12:45:11 -0800108 'high_initial_seqno': default_test_options,
Craig Tiller2d8b52b2015-05-26 17:06:55 -0700109 'invoke_large_request': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800110 'large_metadata': default_test_options,
Craig Tiller17effab2015-08-04 08:19:36 -0700111 'max_concurrent_streams': default_test_options._replace(proxyable=False),
Julien Boeufd7f768b2015-05-08 16:37:16 -0700112 'max_message_length': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800113 'metadata': default_test_options,
114 'negative_deadline': default_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700115 'no_op': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800116 'payload': default_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700117 'ping_pong_streaming': default_test_options,
118 'registered_call': default_test_options,
Craig Tiller17effab2015-08-04 08:19:36 -0700119 'request_with_flags': default_test_options._replace(proxyable=False),
Julien Boeufd7f768b2015-05-08 16:37:16 -0700120 'request_with_payload': default_test_options,
Craig Tiller7a290982015-05-19 12:49:54 -0700121 'server_finishes_request': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800122 'shutdown_finishes_calls': default_test_options,
123 'shutdown_finishes_tags': default_test_options,
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700124 'simple_delayed_request': connectivity_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700125 'simple_request': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800126 'trailing_metadata': default_test_options,
Nicolas "Pixel" Nobleb8137b32015-04-24 01:44:28 +0200127}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800128
129
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700130def compatible(f, t):
131 if END2END_TESTS[t].needs_fullstack:
132 if not END2END_FIXTURES[f].fullstack:
133 return False
Craig Tillera7957f52015-07-29 18:48:38 -0700134 if END2END_TESTS[t].needs_dns:
135 if not END2END_FIXTURES[f].dns_resolver:
136 return False
Craig Tiller17effab2015-08-04 08:19:36 -0700137 if not END2END_TESTS[t].proxyable:
138 if END2END_FIXTURES[f].includes_proxy:
139 return False
Craig Tiller8e159252015-11-11 03:32:43 +0000140 if not END2END_TESTS[t].traceable:
141 if END2END_FIXTURES[f].tracing:
142 return False
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700143 return True
144
145
Craig Tillerc85357e2015-08-07 07:33:04 -0700146def without(l, e):
147 l = l[:]
148 l.remove(e)
149 return l
150
151
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800152def main():
Craig Tillerf75fc122015-06-25 06:58:00 -0700153 sec_deps = [
154 'end2end_certs',
155 'grpc_test_util',
156 'grpc',
157 'gpr_test_util',
158 'gpr'
159 ]
160 unsec_deps = [
161 'grpc_test_util_unsecure',
162 'grpc_unsecure',
163 'gpr_test_util',
164 'gpr'
165 ]
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800166 json = {
167 '#': 'generated with test/end2end/gen_build_json.py',
168 'libs': [
169 {
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800170 'name': 'end2end_tests',
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800171 'build': 'private',
Craig Tiller59140fc2015-01-18 10:12:17 -0800172 'language': 'c',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800173 'secure': True,
174 'src': ['test/core/end2end/end2end_tests.c'] + [
175 'test/core/end2end/tests/%s.c' % t
176 for t in sorted(END2END_TESTS.keys())],
Craig Tillerf75fc122015-06-25 06:58:00 -0700177 'headers': ['test/core/end2end/tests/cancel_test_helpers.h',
178 'test/core/end2end/end2end_tests.h'],
Craig Tiller6a275142015-12-02 11:03:09 -0800179 'deps': sec_deps,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800180 'vs_proj_dir': 'test/end2end/tests',
181 }
Craig Tiller6a275142015-12-02 11:03:09 -0800182 ] + [
183 {
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800184 'name': 'end2end_nosec_tests',
Craig Tiller6a275142015-12-02 11:03:09 -0800185 'build': 'private',
186 'language': 'c',
187 'secure': False,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800188 'src': ['test/core/end2end/end2end_nosec_tests.c'] + [
189 'test/core/end2end/tests/%s.c' % t
190 for t in sorted(END2END_TESTS.keys())
191 if not END2END_TESTS[t].secure],
Craig Tiller6a275142015-12-02 11:03:09 -0800192 'headers': ['test/core/end2end/tests/cancel_test_helpers.h',
193 'test/core/end2end/end2end_tests.h'],
194 'deps': unsec_deps,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800195 'vs_proj_dir': 'test/end2end/tests',
196 }
Craig Tiller6a275142015-12-02 11:03:09 -0800197 ] + [
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800198 {
199 'name': 'end2end_certs',
200 'build': 'private',
Craig Tiller59140fc2015-01-18 10:12:17 -0800201 'language': 'c',
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800202 'src': [
chenw97fd9e52014-12-19 17:12:36 -0800203 "test/core/end2end/data/test_root_cert.c",
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800204 "test/core/end2end/data/server1_cert.c",
205 "test/core/end2end/data/server1_key.c"
Craig Tiller1ebb7c82015-08-31 15:53:36 -0700206 ],
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800207 'vs_proj_dir': 'test/end2end',
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800208 }
Craig Tiller6a275142015-12-02 11:03:09 -0800209 ],
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800210 'targets': [
211 {
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800212 'name': '%s_test' % f,
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800213 'build': 'test',
Craig Tiller59140fc2015-01-18 10:12:17 -0800214 'language': 'c',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800215 'run': False,
Craig Tiller769567e2015-12-22 15:36:52 -0800216 'src': ['test/core/end2end/fixtures/%s.c' % f],
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200217 'platforms': END2END_FIXTURES[f].platforms,
Craig Tiller6a275142015-12-02 11:03:09 -0800218 'ci_platforms': (END2END_FIXTURES[f].platforms
219 if END2END_FIXTURES[f].ci_mac else without(
220 END2END_FIXTURES[f].platforms, 'mac')),
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800221 'deps': [
Craig Tiller769567e2015-12-22 15:36:52 -0800222 'end2end_tests'
Craig Tiller6a275142015-12-02 11:03:09 -0800223 ] + sec_deps,
Craig Tiller769567e2015-12-22 15:36:52 -0800224 'vs_proj_dir': 'test/end2end/fixtures',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800225 }
226 for f in sorted(END2END_FIXTURES.keys())
227 ] + [
228 {
229 'name': '%s_nosec_test' % f,
230 'build': 'test',
231 'language': 'c',
232 'secure': 'no',
Craig Tiller769567e2015-12-22 15:36:52 -0800233 'src': ['test/core/end2end/fixtures/%s.c' % f],
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800234 'run': False,
235 'platforms': END2END_FIXTURES[f].platforms,
236 'ci_platforms': (END2END_FIXTURES[f].platforms
237 if END2END_FIXTURES[f].ci_mac else without(
238 END2END_FIXTURES[f].platforms, 'mac')),
239 'deps': [
Craig Tiller769567e2015-12-22 15:36:52 -0800240 'end2end_nosec_tests'
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800241 ] + unsec_deps,
Craig Tiller769567e2015-12-22 15:36:52 -0800242 'vs_proj_dir': 'test/end2end/fixtures',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800243 }
244 for f in sorted(END2END_FIXTURES.keys())
245 if not END2END_FIXTURES[f].secure
246 ],
247 'tests': [
248 {
249 'name': '%s_test' % f,
250 'args': [t],
251 'exclude_configs': [],
252 'platforms': END2END_FIXTURES[f].platforms,
253 'ci_platforms': (END2END_FIXTURES[f].platforms
254 if END2END_FIXTURES[f].ci_mac else without(
255 END2END_FIXTURES[f].platforms, 'mac')),
256 'flaky': False,
257 'language': 'c',
Craig Tiller56c6b6a2016-01-20 08:27:37 -0800258 'cpu_cost': END2END_TESTS[t].cpu_cost,
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800259 }
Craig Tiller6a275142015-12-02 11:03:09 -0800260 for f in sorted(END2END_FIXTURES.keys())
261 for t in sorted(END2END_TESTS.keys()) if compatible(f, t)
262 ] + [
Craig Tillerc8b357f2015-04-20 16:36:52 -0700263 {
Craig Tillerfc051c92016-01-19 08:39:37 -0800264 'name': '%s_nosec_test' % f,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800265 'args': [t],
266 'exclude_configs': [],
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200267 'platforms': END2END_FIXTURES[f].platforms,
Craig Tiller6a275142015-12-02 11:03:09 -0800268 'ci_platforms': (END2END_FIXTURES[f].platforms
269 if END2END_FIXTURES[f].ci_mac else without(
270 END2END_FIXTURES[f].platforms, 'mac')),
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800271 'flaky': False,
272 'language': 'c',
Craig Tiller56c6b6a2016-01-20 08:27:37 -0800273 'cpu_cost': END2END_TESTS[t].cpu_cost,
Craig Tillerc8b357f2015-04-20 16:36:52 -0700274 }
Craig Tiller6a275142015-12-02 11:03:09 -0800275 for f in sorted(END2END_FIXTURES.keys())
276 if not END2END_FIXTURES[f].secure
277 for t in sorted(END2END_TESTS.keys())
278 if compatible(f, t) and not END2END_TESTS[t].secure
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800279 ],
280 'core_end2end_tests': dict(
281 (t, END2END_TESTS[t].secure)
282 for t in END2END_TESTS.keys()
283 )
Craig Tiller6a275142015-12-02 11:03:09 -0800284 }
Craig Tiller1ebb7c82015-08-31 15:53:36 -0700285 print yaml.dump(json)
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800286
287
288if __name__ == '__main__':
289 main()