blob: b9acdc1d4a72b12a8b5c87411c230911e9e98610 [file] [log] [blame]
Nathaniel Manistaae4fbcd2015-09-23 16:29:44 +00001#!/usr/bin/env python2.7
Craig Tiller6169d5f2016-03-31 07:46:18 -07002# Copyright 2015, 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',
Craig Tiller42ee4d82016-09-28 13:19:43 -070042 'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing exclude_configs large_writes')
Craig Tiller6a275142015-12-02 11:03:09 -080043default_unsecure_fixture_options = FixtureOptions(
Craig Tiller42ee4d82016-09-28 13:19:43 -070044 True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False, [], True)
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'])
Adam Michalik321b1fb2016-05-16 15:42:36 -070048fd_unsecure_fixture_options = default_unsecure_fixture_options._replace(
Adam Michalik46cc2ac2016-05-16 11:12:04 -070049 dns_resolver=False, fullstack=False, platforms=['linux', 'mac', 'posix'])
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +020050
Craig Tiller1ebb7c82015-08-31 15:53:36 -070051
Craig Tillerc8b357f2015-04-20 16:36:52 -070052# maps fixture name to whether it requires the security library
53END2END_FIXTURES = {
Craig Tiller1726e832015-11-03 12:45:11 -080054 'h2_compress': default_unsecure_fixture_options,
Craig Tillerc586f4e2015-12-10 10:26:05 -080055 'h2_census': default_unsecure_fixture_options,
David Garcia Quintas824363d2016-07-13 23:09:34 -070056 'h2_load_reporting': default_unsecure_fixture_options,
Craig Tiller1ebb7c82015-08-31 15:53:36 -070057 'h2_fakesec': default_secure_fixture_options._replace(ci_mac=False),
Mark D. Rothec393342016-10-03 13:14:56 -070058 'h2_fake_resolver': default_unsecure_fixture_options,
Adam Michalik321b1fb2016-05-16 15:42:36 -070059 'h2_fd': fd_unsecure_fixture_options,
Craig Tiller1ebb7c82015-08-31 15:53:36 -070060 'h2_full': default_unsecure_fixture_options,
Craig Tillerf218c8b2015-12-10 14:57:56 -080061 'h2_full+pipe': default_unsecure_fixture_options._replace(
62 platforms=['linux']),
Craig Tiller178edfa2016-02-17 20:54:46 -080063 'h2_full+trace': default_unsecure_fixture_options._replace(tracing=True),
Mark D. Rotha3ef6012016-07-25 11:16:07 -070064 'h2_http_proxy': default_unsecure_fixture_options._replace(ci_mac=False),
Craig Tiller1726e832015-11-03 12:45:11 -080065 'h2_oauth2': default_secure_fixture_options._replace(ci_mac=False),
Craig Tiller6a275142015-12-02 11:03:09 -080066 'h2_proxy': default_unsecure_fixture_options._replace(includes_proxy=True,
67 ci_mac=False),
68 'h2_sockpair_1byte': socketpair_unsecure_fixture_options._replace(
Craig Tiller42ee4d82016-09-28 13:19:43 -070069 ci_mac=False, exclude_configs=['msan'], large_writes=False),
Craig Tiller1726e832015-11-03 12:45:11 -080070 'h2_sockpair': socketpair_unsecure_fixture_options._replace(ci_mac=False),
Craig Tiller6a275142015-12-02 11:03:09 -080071 'h2_sockpair+trace': socketpair_unsecure_fixture_options._replace(
Craig Tiller42ee4d82016-09-28 13:19:43 -070072 ci_mac=False, tracing=True, large_writes=False),
Craig Tiller1ebb7c82015-08-31 15:53:36 -070073 'h2_ssl': default_secure_fixture_options,
Deepak Lukosedba4c5f2016-03-25 12:54:25 -070074 'h2_ssl_cert': default_secure_fixture_options,
Craig Tiller6a275142015-12-02 11:03:09 -080075 'h2_ssl_proxy': default_secure_fixture_options._replace(includes_proxy=True,
76 ci_mac=False),
Craig Tiller1726e832015-11-03 12:45:11 -080077 'h2_uds': uds_fixture_options,
Craig Tillerc8b357f2015-04-20 16:36:52 -070078}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080079
Craig Tiller6a275142015-12-02 11:03:09 -080080TestOptions = collections.namedtuple(
Adam Michalik46cc2ac2016-05-16 11:12:04 -070081 'TestOptions',
Craig Tiller42ee4d82016-09-28 13:19:43 -070082 'needs_fullstack needs_dns proxyable secure traceable cpu_cost large_writes')
83default_test_options = TestOptions(False, False, True, False, True, 1.0, False)
Craig Tiller17effab2015-08-04 08:19:36 -070084connectivity_test_options = default_test_options._replace(needs_fullstack=True)
Julien Boeuf9f218dd2015-04-23 10:24:02 -070085
Craig Tiller5f735a62016-01-20 09:31:15 -080086LOWCPU = 0.1
Craig Tiller56c6b6a2016-01-20 08:27:37 -080087
Julien Boeuf9f218dd2015-04-23 10:24:02 -070088# maps test names to options
Nicolas "Pixel" Nobleb8137b32015-04-24 01:44:28 +020089END2END_TESTS = {
Julien Boeufd7f768b2015-05-08 16:37:16 -070090 'bad_hostname': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -080091 'binary_metadata': default_test_options,
Craig Tiller20afa3d2016-10-17 14:52:14 -070092 'resource_quota_server': default_test_options._replace(large_writes=True,
Craig Tiller3798e602016-10-21 14:39:27 -070093 proxyable=False),
Craig Tiller1726e832015-11-03 12:45:11 -080094 'call_creds': default_test_options._replace(secure=True),
Craig Tiller56c6b6a2016-01-20 08:27:37 -080095 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU),
Craig Tillerb544c292016-06-17 16:58:00 -070096 'cancel_after_client_done': default_test_options,
Craig Tiller56c6b6a2016-01-20 08:27:37 -080097 'cancel_after_invoke': default_test_options._replace(cpu_cost=LOWCPU),
98 'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU),
99 'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU),
100 'cancel_with_status': default_test_options._replace(cpu_cost=LOWCPU),
Craig Tillerb544c292016-06-17 16:58:00 -0700101 'compressed_payload': default_test_options._replace(proxyable=False),
Adam Michalik46cc2ac2016-05-16 11:12:04 -0700102 'connectivity': connectivity_test_options._replace(proxyable=False,
103 cpu_cost=LOWCPU),
Craig Tiller6a275142015-12-02 11:03:09 -0800104 'default_host': default_test_options._replace(needs_fullstack=True,
105 needs_dns=True),
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700106 'disappearing_server': connectivity_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700107 'empty_batch': default_test_options,
Craig Tillera446ee22016-04-04 13:09:30 -0700108 'filter_causes_close': default_test_options,
Mark D. Roth5d11e432016-06-23 13:14:05 -0700109 'filter_call_init_fails': default_test_options,
Craig Tiller5f735a62016-01-20 09:31:15 -0800110 'graceful_server_shutdown': default_test_options._replace(cpu_cost=LOWCPU),
Craig Tiller6a275142015-12-02 11:03:09 -0800111 'hpack_size': default_test_options._replace(proxyable=False,
Craig Tiller5f735a62016-01-20 09:31:15 -0800112 traceable=False),
Craig Tiller1726e832015-11-03 12:45:11 -0800113 'high_initial_seqno': default_test_options,
Craig Tiller7885ea52016-03-10 06:53:29 -0800114 'idempotent_request': default_test_options,
Craig Tiller2d8b52b2015-05-26 17:06:55 -0700115 'invoke_large_request': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800116 'large_metadata': default_test_options,
Craig Tiller17effab2015-08-04 08:19:36 -0700117 'max_concurrent_streams': default_test_options._replace(proxyable=False),
Craig Tillerb544c292016-06-17 16:58:00 -0700118 'max_message_length': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800119 'negative_deadline': default_test_options,
Makarand Dharmapurikar0579cfc2016-06-20 15:45:24 -0700120 'network_status_change': default_test_options,
Yuchen Zeng916079d2016-08-30 15:52:09 -0700121 'no_logging': default_test_options._replace(traceable=False),
Julien Boeufd7f768b2015-05-08 16:37:16 -0700122 'no_op': default_test_options,
Craig Tillerb544c292016-06-17 16:58:00 -0700123 'payload': default_test_options,
David Garcia Quintas01c4d992016-07-07 20:11:27 -0700124 'load_reporting_hook': default_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700125 'ping_pong_streaming': default_test_options,
Craig Tiller732a8752016-02-22 15:59:19 -0800126 'ping': connectivity_test_options._replace(proxyable=False),
Julien Boeufd7f768b2015-05-08 16:37:16 -0700127 'registered_call': default_test_options,
Craig Tiller7cbfc3e2016-06-17 16:55:23 -0700128 'request_with_flags': default_test_options._replace(
129 proxyable=False, cpu_cost=LOWCPU),
Julien Boeufd7f768b2015-05-08 16:37:16 -0700130 'request_with_payload': default_test_options,
Craig Tiller7a290982015-05-19 12:49:54 -0700131 'server_finishes_request': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800132 'shutdown_finishes_calls': default_test_options,
133 'shutdown_finishes_tags': default_test_options,
Makarand Dharmapurikar015180a2016-08-29 12:32:53 -0700134 'simple_cacheable_request': default_test_options,
Craig Tillerb544c292016-06-17 16:58:00 -0700135 'simple_delayed_request': connectivity_test_options,
Craig Tiller732a8752016-02-22 15:59:19 -0800136 'simple_metadata': default_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700137 'simple_request': default_test_options,
Craig Tillerfa1f74e2016-06-20 11:11:44 -0700138 'streaming_error_response': default_test_options,
Craig Tiller1726e832015-11-03 12:45:11 -0800139 'trailing_metadata': default_test_options,
Nicolas "Pixel" Nobleb8137b32015-04-24 01:44:28 +0200140}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800141
142
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700143def compatible(f, t):
144 if END2END_TESTS[t].needs_fullstack:
145 if not END2END_FIXTURES[f].fullstack:
146 return False
Craig Tillera7957f52015-07-29 18:48:38 -0700147 if END2END_TESTS[t].needs_dns:
148 if not END2END_FIXTURES[f].dns_resolver:
149 return False
Craig Tiller17effab2015-08-04 08:19:36 -0700150 if not END2END_TESTS[t].proxyable:
151 if END2END_FIXTURES[f].includes_proxy:
152 return False
Craig Tiller8e159252015-11-11 03:32:43 +0000153 if not END2END_TESTS[t].traceable:
154 if END2END_FIXTURES[f].tracing:
155 return False
Craig Tiller42ee4d82016-09-28 13:19:43 -0700156 if END2END_TESTS[t].large_writes:
157 if not END2END_FIXTURES[f].large_writes:
158 return False
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700159 return True
160
161
Craig Tillerc85357e2015-08-07 07:33:04 -0700162def without(l, e):
163 l = l[:]
164 l.remove(e)
165 return l
166
167
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800168def main():
Craig Tillerf75fc122015-06-25 06:58:00 -0700169 sec_deps = [
Craig Tillerf75fc122015-06-25 06:58:00 -0700170 'grpc_test_util',
Craig Tillerda179ce2016-02-09 12:01:53 -0800171 'grpc',
172 'gpr_test_util',
173 'gpr'
Craig Tillerf75fc122015-06-25 06:58:00 -0700174 ]
175 unsec_deps = [
176 'grpc_test_util_unsecure',
Craig Tillerda179ce2016-02-09 12:01:53 -0800177 'grpc_unsecure',
178 'gpr_test_util',
179 'gpr'
Craig Tillerf75fc122015-06-25 06:58:00 -0700180 ]
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800181 json = {
182 '#': 'generated with test/end2end/gen_build_json.py',
183 'libs': [
184 {
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800185 'name': 'end2end_tests',
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800186 'build': 'private',
Craig Tiller59140fc2015-01-18 10:12:17 -0800187 'language': 'c',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800188 'secure': True,
189 'src': ['test/core/end2end/end2end_tests.c'] + [
190 'test/core/end2end/tests/%s.c' % t
191 for t in sorted(END2END_TESTS.keys())],
Craig Tillerf75fc122015-06-25 06:58:00 -0700192 'headers': ['test/core/end2end/tests/cancel_test_helpers.h',
193 'test/core/end2end/end2end_tests.h'],
Craig Tiller6a275142015-12-02 11:03:09 -0800194 'deps': sec_deps,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800195 'vs_proj_dir': 'test/end2end/tests',
196 }
Craig Tiller6a275142015-12-02 11:03:09 -0800197 ] + [
198 {
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800199 'name': 'end2end_nosec_tests',
Craig Tiller6a275142015-12-02 11:03:09 -0800200 'build': 'private',
201 'language': 'c',
202 'secure': False,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800203 'src': ['test/core/end2end/end2end_nosec_tests.c'] + [
204 'test/core/end2end/tests/%s.c' % t
205 for t in sorted(END2END_TESTS.keys())
206 if not END2END_TESTS[t].secure],
Craig Tiller6a275142015-12-02 11:03:09 -0800207 'headers': ['test/core/end2end/tests/cancel_test_helpers.h',
208 'test/core/end2end/end2end_tests.h'],
209 'deps': unsec_deps,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800210 'vs_proj_dir': 'test/end2end/tests',
211 }
Craig Tiller6a275142015-12-02 11:03:09 -0800212 ],
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800213 'targets': [
214 {
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800215 'name': '%s_test' % f,
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800216 'build': 'test',
Craig Tiller59140fc2015-01-18 10:12:17 -0800217 'language': 'c',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800218 'run': False,
Craig Tiller769567e2015-12-22 15:36:52 -0800219 'src': ['test/core/end2end/fixtures/%s.c' % f],
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200220 'platforms': END2END_FIXTURES[f].platforms,
Craig Tiller6a275142015-12-02 11:03:09 -0800221 'ci_platforms': (END2END_FIXTURES[f].platforms
222 if END2END_FIXTURES[f].ci_mac else without(
223 END2END_FIXTURES[f].platforms, 'mac')),
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800224 'deps': [
Craig Tiller769567e2015-12-22 15:36:52 -0800225 'end2end_tests'
Craig Tiller6a275142015-12-02 11:03:09 -0800226 ] + sec_deps,
Craig Tiller769567e2015-12-22 15:36:52 -0800227 'vs_proj_dir': 'test/end2end/fixtures',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800228 }
229 for f in sorted(END2END_FIXTURES.keys())
230 ] + [
231 {
232 'name': '%s_nosec_test' % f,
233 'build': 'test',
234 'language': 'c',
murgatroid99b61fd862016-08-29 13:51:17 -0700235 'secure': False,
Craig Tiller769567e2015-12-22 15:36:52 -0800236 'src': ['test/core/end2end/fixtures/%s.c' % f],
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800237 'run': False,
238 'platforms': END2END_FIXTURES[f].platforms,
239 'ci_platforms': (END2END_FIXTURES[f].platforms
240 if END2END_FIXTURES[f].ci_mac else without(
241 END2END_FIXTURES[f].platforms, 'mac')),
242 'deps': [
Craig Tiller769567e2015-12-22 15:36:52 -0800243 'end2end_nosec_tests'
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800244 ] + unsec_deps,
Craig Tiller769567e2015-12-22 15:36:52 -0800245 'vs_proj_dir': 'test/end2end/fixtures',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800246 }
247 for f in sorted(END2END_FIXTURES.keys())
248 if not END2END_FIXTURES[f].secure
249 ],
250 'tests': [
251 {
252 'name': '%s_test' % f,
253 'args': [t],
Craig Tiller2dc49682016-10-19 08:47:32 -0700254 'exclude_configs': END2END_FIXTURES[f].exclude_configs,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800255 'platforms': END2END_FIXTURES[f].platforms,
256 'ci_platforms': (END2END_FIXTURES[f].platforms
257 if END2END_FIXTURES[f].ci_mac else without(
258 END2END_FIXTURES[f].platforms, 'mac')),
259 'flaky': False,
260 'language': 'c',
Craig Tiller56c6b6a2016-01-20 08:27:37 -0800261 'cpu_cost': END2END_TESTS[t].cpu_cost,
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800262 }
Craig Tiller6a275142015-12-02 11:03:09 -0800263 for f in sorted(END2END_FIXTURES.keys())
264 for t in sorted(END2END_TESTS.keys()) if compatible(f, t)
265 ] + [
Craig Tillerc8b357f2015-04-20 16:36:52 -0700266 {
Craig Tillerfc051c92016-01-19 08:39:37 -0800267 'name': '%s_nosec_test' % f,
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800268 'args': [t],
Craig Tiller823fa1d2016-05-03 22:19:11 -0700269 'exclude_configs': END2END_FIXTURES[f].exclude_configs,
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200270 'platforms': END2END_FIXTURES[f].platforms,
Craig Tiller6a275142015-12-02 11:03:09 -0800271 'ci_platforms': (END2END_FIXTURES[f].platforms
272 if END2END_FIXTURES[f].ci_mac else without(
273 END2END_FIXTURES[f].platforms, 'mac')),
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800274 'flaky': False,
275 'language': 'c',
Craig Tiller56c6b6a2016-01-20 08:27:37 -0800276 'cpu_cost': END2END_TESTS[t].cpu_cost,
Craig Tillerc8b357f2015-04-20 16:36:52 -0700277 }
Craig Tiller6a275142015-12-02 11:03:09 -0800278 for f in sorted(END2END_FIXTURES.keys())
279 if not END2END_FIXTURES[f].secure
280 for t in sorted(END2END_TESTS.keys())
281 if compatible(f, t) and not END2END_TESTS[t].secure
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800282 ],
283 'core_end2end_tests': dict(
284 (t, END2END_TESTS[t].secure)
285 for t in END2END_TESTS.keys()
286 )
Craig Tiller6a275142015-12-02 11:03:09 -0800287 }
Craig Tiller1ebb7c82015-08-31 15:53:36 -0700288 print yaml.dump(json)
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800289
290
291if __name__ == '__main__':
292 main()