blob: 524fb2a35f6be23ad6e517547937cedf409076e3 [file] [log] [blame]
Nicolas "Pixel" Noblea727fe22015-04-01 20:48:26 -07001#!/usr/bin/env python
Craig Tillerc2c79212015-02-16 12:00:01 -08002# Copyright 2015, Google Inc.
3# 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
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080035import simplejson
Julien Boeufd7f768b2015-05-08 16:37:16 -070036import collections
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080037
Craig Tillerc8b357f2015-04-20 16:36:52 -070038
Craig Tiller17effab2015-08-04 08:19:36 -070039FixtureOptions = collections.namedtuple('FixtureOptions', 'fullstack includes_proxy dns_resolver secure platforms')
Craig Tillerd50993d2015-08-05 08:04:36 -070040default_unsecure_fixture_options = FixtureOptions(True, False, True, False, ['windows', 'linux', 'mac', 'posix'])
Craig Tiller17effab2015-08-04 08:19:36 -070041socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False)
42default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True)
Craig Tillerd50993d2015-08-05 08:04:36 -070043uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix'])
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +020044
Craig Tillerc8b357f2015-04-20 16:36:52 -070045# maps fixture name to whether it requires the security library
46END2END_FIXTURES = {
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +020047 'chttp2_fake_security': default_secure_fixture_options,
48 'chttp2_fullstack': default_unsecure_fixture_options,
Craig Tiller17effab2015-08-04 08:19:36 -070049 'chttp2_fullstack_compression': default_unsecure_fixture_options,
50 'chttp2_fullstack_uds_posix': uds_fixture_options,
Craig Tillerd50993d2015-08-05 08:04:36 -070051 'chttp2_fullstack_uds_posix_with_poll': uds_fixture_options._replace(platforms=['linux']),
52 'chttp2_fullstack_with_poll': default_unsecure_fixture_options._replace(platforms=['linux']),
Craig Tiller17effab2015-08-04 08:19:36 -070053 'chttp2_fullstack_with_proxy': default_unsecure_fixture_options._replace(includes_proxy=True),
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +020054 'chttp2_simple_ssl_fullstack': default_secure_fixture_options,
Craig Tillerd50993d2015-08-05 08:04:36 -070055 'chttp2_simple_ssl_fullstack_with_poll': default_secure_fixture_options._replace(platforms=['linux']),
Craig Tiller17effab2015-08-04 08:19:36 -070056 'chttp2_simple_ssl_fullstack_with_proxy': default_secure_fixture_options._replace(includes_proxy=True),
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +020057 'chttp2_simple_ssl_with_oauth2_fullstack': default_secure_fixture_options,
Craig Tiller17effab2015-08-04 08:19:36 -070058 #'chttp2_simple_ssl_with_oauth2_fullstack_with_proxy': default_secure_fixture_options._replace(includes_proxy=True),
Craig Tiller9d25e942015-07-20 10:31:12 -070059 'chttp2_socket_pair': socketpair_unsecure_fixture_options,
Craig Tiller17effab2015-08-04 08:19:36 -070060 'chttp2_socket_pair_one_byte_at_a_time': socketpair_unsecure_fixture_options,
Craig Tiller1ada6ad2015-07-16 16:19:14 -070061 'chttp2_socket_pair_with_grpc_trace': socketpair_unsecure_fixture_options,
Craig Tillerc8b357f2015-04-20 16:36:52 -070062}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080063
Craig Tiller17effab2015-08-04 08:19:36 -070064TestOptions = collections.namedtuple('TestOptions', 'needs_fullstack needs_dns proxyable flaky secure')
65default_test_options = TestOptions(False, False, True, False, False)
66connectivity_test_options = default_test_options._replace(needs_fullstack=True)
Julien Boeuf9f218dd2015-04-23 10:24:02 -070067
68# maps test names to options
Nicolas "Pixel" Nobleb8137b32015-04-24 01:44:28 +020069END2END_TESTS = {
Julien Boeufd7f768b2015-05-08 16:37:16 -070070 'bad_hostname': default_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -070071 'cancel_after_accept_and_writes_closed': default_test_options,
Craig Tiller9d25e942015-07-20 10:31:12 -070072 'cancel_after_accept': default_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -070073 'cancel_after_invoke': default_test_options,
74 'cancel_before_invoke': default_test_options,
75 'cancel_in_a_vacuum': default_test_options,
76 'census_simple_request': default_test_options,
Craig Tiller17effab2015-08-04 08:19:36 -070077 'channel_connectivity': connectivity_test_options._replace(proxyable=False),
78 'default_host': default_test_options._replace(needs_fullstack=True, needs_dns=True),
Craig Tiller1ada6ad2015-07-16 16:19:14 -070079 'disappearing_server': connectivity_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -070080 'early_server_shutdown_finishes_inflight_calls': default_test_options,
81 'early_server_shutdown_finishes_tags': default_test_options,
82 'empty_batch': default_test_options,
83 'graceful_server_shutdown': default_test_options,
Craig Tiller2d8b52b2015-05-26 17:06:55 -070084 'invoke_large_request': default_test_options,
Craig Tiller17effab2015-08-04 08:19:36 -070085 'max_concurrent_streams': default_test_options._replace(proxyable=False),
Julien Boeufd7f768b2015-05-08 16:37:16 -070086 'max_message_length': default_test_options,
87 'no_op': default_test_options,
88 'ping_pong_streaming': default_test_options,
89 'registered_call': default_test_options,
90 'request_response_with_binary_metadata_and_payload': default_test_options,
91 'request_response_with_metadata_and_payload': default_test_options,
Craig Tiller17effab2015-08-04 08:19:36 -070092 'request_response_with_payload_and_call_creds': default_test_options._replace(secure=True),
Julien Boeufd7f768b2015-05-08 16:37:16 -070093 'request_response_with_payload': default_test_options,
Craig Tiller9d25e942015-07-20 10:31:12 -070094 'request_response_with_trailing_metadata_and_payload': default_test_options,
Craig Tiller17effab2015-08-04 08:19:36 -070095 'request_with_compressed_payload': default_test_options._replace(proxyable=False),
96 'request_with_flags': default_test_options._replace(proxyable=False),
Julien Boeufd7f768b2015-05-08 16:37:16 -070097 'request_with_large_metadata': default_test_options,
98 'request_with_payload': default_test_options,
Craig Tiller7a290982015-05-19 12:49:54 -070099 'server_finishes_request': default_test_options,
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700100 'simple_delayed_request': connectivity_test_options,
Julien Boeufd7f768b2015-05-08 16:37:16 -0700101 'simple_request': default_test_options,
102 'simple_request_with_high_initial_sequence_number': default_test_options,
Nicolas "Pixel" Nobleb8137b32015-04-24 01:44:28 +0200103}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800104
105
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700106def compatible(f, t):
107 if END2END_TESTS[t].needs_fullstack:
108 if not END2END_FIXTURES[f].fullstack:
109 return False
Craig Tillera7957f52015-07-29 18:48:38 -0700110 if END2END_TESTS[t].needs_dns:
111 if not END2END_FIXTURES[f].dns_resolver:
112 return False
Craig Tiller17effab2015-08-04 08:19:36 -0700113 if not END2END_TESTS[t].proxyable:
114 if END2END_FIXTURES[f].includes_proxy:
115 return False
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700116 return True
117
118
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800119def main():
Craig Tillerf75fc122015-06-25 06:58:00 -0700120 sec_deps = [
121 'end2end_certs',
122 'grpc_test_util',
123 'grpc',
124 'gpr_test_util',
125 'gpr'
126 ]
127 unsec_deps = [
128 'grpc_test_util_unsecure',
129 'grpc_unsecure',
130 'gpr_test_util',
131 'gpr'
132 ]
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800133 json = {
134 '#': 'generated with test/end2end/gen_build_json.py',
135 'libs': [
136 {
137 'name': 'end2end_fixture_%s' % f,
138 'build': 'private',
Craig Tiller59140fc2015-01-18 10:12:17 -0800139 'language': 'c',
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200140 'secure': 'check' if END2END_FIXTURES[f].secure else 'no',
Nicolas Noble2e363932015-05-04 14:54:33 -0700141 'src': ['test/core/end2end/fixtures/%s.c' % f],
Craig Tillerd50993d2015-08-05 08:04:36 -0700142 'platforms': [ 'linux', 'mac', 'posix' ] if f.endswith('_posix') else END2END_FIXTURES[f].platforms,
Craig Tillerf75fc122015-06-25 06:58:00 -0700143 'deps': sec_deps if END2END_FIXTURES[f].secure else unsec_deps,
144 'headers': ['test/core/end2end/end2end_tests.h'],
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800145 }
Craig Tillerc8b357f2015-04-20 16:36:52 -0700146 for f in sorted(END2END_FIXTURES.keys())] + [
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800147 {
148 'name': 'end2end_test_%s' % t,
149 'build': 'private',
Craig Tiller59140fc2015-01-18 10:12:17 -0800150 'language': 'c',
Julien Boeuf9f218dd2015-04-23 10:24:02 -0700151 'secure': 'check' if END2END_TESTS[t].secure else 'no',
Craig Tiller48537912015-01-16 09:57:49 -0800152 'src': ['test/core/end2end/tests/%s.c' % t],
Craig Tillerf75fc122015-06-25 06:58:00 -0700153 'headers': ['test/core/end2end/tests/cancel_test_helpers.h',
154 'test/core/end2end/end2end_tests.h'],
155 'deps': sec_deps if END2END_TESTS[t].secure else unsec_deps
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800156 }
Nicolas "Pixel" Nobleb8137b32015-04-24 01:44:28 +0200157 for t in sorted(END2END_TESTS.keys())] + [
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800158 {
159 'name': 'end2end_certs',
160 'build': 'private',
Craig Tiller59140fc2015-01-18 10:12:17 -0800161 'language': 'c',
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800162 'src': [
chenw97fd9e52014-12-19 17:12:36 -0800163 "test/core/end2end/data/test_root_cert.c",
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800164 "test/core/end2end/data/server1_cert.c",
165 "test/core/end2end/data/server1_key.c"
166 ]
167 }
168 ],
169 'targets': [
170 {
171 'name': '%s_%s_test' % (f, t),
172 'build': 'test',
Craig Tiller59140fc2015-01-18 10:12:17 -0800173 'language': 'c',
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800174 'src': [],
Julien Boeuf9f218dd2015-04-23 10:24:02 -0700175 'flaky': END2END_TESTS[t].flaky,
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200176 'platforms': END2END_FIXTURES[f].platforms,
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800177 'deps': [
178 'end2end_fixture_%s' % f,
Craig Tillerf75fc122015-06-25 06:58:00 -0700179 'end2end_test_%s' % t] + sec_deps
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800180 }
Craig Tillerc8b357f2015-04-20 16:36:52 -0700181 for f in sorted(END2END_FIXTURES.keys())
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700182 for t in sorted(END2END_TESTS.keys())
183 if compatible(f, t)] + [
Craig Tillerc8b357f2015-04-20 16:36:52 -0700184 {
185 'name': '%s_%s_unsecure_test' % (f, t),
186 'build': 'test',
187 'language': 'c',
Nicolas "Pixel" Noble99738f62015-04-23 01:31:24 +0200188 'secure': 'no',
Craig Tillerc8b357f2015-04-20 16:36:52 -0700189 'src': [],
Craig Tillera7957f52015-07-29 18:48:38 -0700190 'flaky': END2END_TESTS[t].flaky,
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200191 'platforms': END2END_FIXTURES[f].platforms,
Craig Tillerc8b357f2015-04-20 16:36:52 -0700192 'deps': [
193 'end2end_fixture_%s' % f,
Craig Tillerf75fc122015-06-25 06:58:00 -0700194 'end2end_test_%s' % t] + unsec_deps
Craig Tillerc8b357f2015-04-20 16:36:52 -0700195 }
Nicolas "Pixel" Noble18938cd2015-05-09 08:35:42 +0200196 for f in sorted(END2END_FIXTURES.keys()) if not END2END_FIXTURES[f].secure
Craig Tiller1ada6ad2015-07-16 16:19:14 -0700197 for t in sorted(END2END_TESTS.keys()) if compatible(f, t) and not END2END_TESTS[t].secure]}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800198 print simplejson.dumps(json, sort_keys=True, indent=2 * ' ')
199
200
201if __name__ == '__main__':
202 main()