Nicolas "Pixel" Noble | a727fe2 | 2015-04-01 20:48:26 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
Craig Tiller | c2c7921 | 2015-02-16 12:00:01 -0800 | [diff] [blame] | 2 | # 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 | |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 31 | |
| 32 | """Generates the appropriate build.json data for all the end2end tests.""" |
| 33 | |
| 34 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 35 | import simplejson |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 36 | import collections |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 37 | |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 38 | |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 39 | FixtureOptions = collections.namedtuple('FixtureOptions', 'fullstack includes_proxy dns_resolver secure platforms') |
Craig Tiller | d50993d | 2015-08-05 08:04:36 -0700 | [diff] [blame^] | 40 | default_unsecure_fixture_options = FixtureOptions(True, False, True, False, ['windows', 'linux', 'mac', 'posix']) |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 41 | socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False) |
| 42 | default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True) |
Craig Tiller | d50993d | 2015-08-05 08:04:36 -0700 | [diff] [blame^] | 43 | uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix']) |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 44 | |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 45 | # maps fixture name to whether it requires the security library |
| 46 | END2END_FIXTURES = { |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 47 | 'chttp2_fake_security': default_secure_fixture_options, |
| 48 | 'chttp2_fullstack': default_unsecure_fixture_options, |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 49 | 'chttp2_fullstack_compression': default_unsecure_fixture_options, |
| 50 | 'chttp2_fullstack_uds_posix': uds_fixture_options, |
Craig Tiller | d50993d | 2015-08-05 08:04:36 -0700 | [diff] [blame^] | 51 | '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 Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 53 | 'chttp2_fullstack_with_proxy': default_unsecure_fixture_options._replace(includes_proxy=True), |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 54 | 'chttp2_simple_ssl_fullstack': default_secure_fixture_options, |
Craig Tiller | d50993d | 2015-08-05 08:04:36 -0700 | [diff] [blame^] | 55 | 'chttp2_simple_ssl_fullstack_with_poll': default_secure_fixture_options._replace(platforms=['linux']), |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 56 | 'chttp2_simple_ssl_fullstack_with_proxy': default_secure_fixture_options._replace(includes_proxy=True), |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 57 | 'chttp2_simple_ssl_with_oauth2_fullstack': default_secure_fixture_options, |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 58 | #'chttp2_simple_ssl_with_oauth2_fullstack_with_proxy': default_secure_fixture_options._replace(includes_proxy=True), |
Craig Tiller | 9d25e94 | 2015-07-20 10:31:12 -0700 | [diff] [blame] | 59 | 'chttp2_socket_pair': socketpair_unsecure_fixture_options, |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 60 | 'chttp2_socket_pair_one_byte_at_a_time': socketpair_unsecure_fixture_options, |
Craig Tiller | 1ada6ad | 2015-07-16 16:19:14 -0700 | [diff] [blame] | 61 | 'chttp2_socket_pair_with_grpc_trace': socketpair_unsecure_fixture_options, |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 62 | } |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 63 | |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 64 | TestOptions = collections.namedtuple('TestOptions', 'needs_fullstack needs_dns proxyable flaky secure') |
| 65 | default_test_options = TestOptions(False, False, True, False, False) |
| 66 | connectivity_test_options = default_test_options._replace(needs_fullstack=True) |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 67 | |
| 68 | # maps test names to options |
Nicolas "Pixel" Noble | b8137b3 | 2015-04-24 01:44:28 +0200 | [diff] [blame] | 69 | END2END_TESTS = { |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 70 | 'bad_hostname': default_test_options, |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 71 | 'cancel_after_accept_and_writes_closed': default_test_options, |
Craig Tiller | 9d25e94 | 2015-07-20 10:31:12 -0700 | [diff] [blame] | 72 | 'cancel_after_accept': default_test_options, |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 73 | '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 Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 77 | 'channel_connectivity': connectivity_test_options._replace(proxyable=False), |
| 78 | 'default_host': default_test_options._replace(needs_fullstack=True, needs_dns=True), |
Craig Tiller | 1ada6ad | 2015-07-16 16:19:14 -0700 | [diff] [blame] | 79 | 'disappearing_server': connectivity_test_options, |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 80 | '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 Tiller | 2d8b52b | 2015-05-26 17:06:55 -0700 | [diff] [blame] | 84 | 'invoke_large_request': default_test_options, |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 85 | 'max_concurrent_streams': default_test_options._replace(proxyable=False), |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 86 | '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 Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 92 | 'request_response_with_payload_and_call_creds': default_test_options._replace(secure=True), |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 93 | 'request_response_with_payload': default_test_options, |
Craig Tiller | 9d25e94 | 2015-07-20 10:31:12 -0700 | [diff] [blame] | 94 | 'request_response_with_trailing_metadata_and_payload': default_test_options, |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 95 | 'request_with_compressed_payload': default_test_options._replace(proxyable=False), |
| 96 | 'request_with_flags': default_test_options._replace(proxyable=False), |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 97 | 'request_with_large_metadata': default_test_options, |
| 98 | 'request_with_payload': default_test_options, |
Craig Tiller | 7a29098 | 2015-05-19 12:49:54 -0700 | [diff] [blame] | 99 | 'server_finishes_request': default_test_options, |
Craig Tiller | 1ada6ad | 2015-07-16 16:19:14 -0700 | [diff] [blame] | 100 | 'simple_delayed_request': connectivity_test_options, |
Julien Boeuf | d7f768b | 2015-05-08 16:37:16 -0700 | [diff] [blame] | 101 | 'simple_request': default_test_options, |
| 102 | 'simple_request_with_high_initial_sequence_number': default_test_options, |
Nicolas "Pixel" Noble | b8137b3 | 2015-04-24 01:44:28 +0200 | [diff] [blame] | 103 | } |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 104 | |
| 105 | |
Craig Tiller | 1ada6ad | 2015-07-16 16:19:14 -0700 | [diff] [blame] | 106 | def compatible(f, t): |
| 107 | if END2END_TESTS[t].needs_fullstack: |
| 108 | if not END2END_FIXTURES[f].fullstack: |
| 109 | return False |
Craig Tiller | a7957f5 | 2015-07-29 18:48:38 -0700 | [diff] [blame] | 110 | if END2END_TESTS[t].needs_dns: |
| 111 | if not END2END_FIXTURES[f].dns_resolver: |
| 112 | return False |
Craig Tiller | 17effab | 2015-08-04 08:19:36 -0700 | [diff] [blame] | 113 | if not END2END_TESTS[t].proxyable: |
| 114 | if END2END_FIXTURES[f].includes_proxy: |
| 115 | return False |
Craig Tiller | 1ada6ad | 2015-07-16 16:19:14 -0700 | [diff] [blame] | 116 | return True |
| 117 | |
| 118 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 119 | def main(): |
Craig Tiller | f75fc12 | 2015-06-25 06:58:00 -0700 | [diff] [blame] | 120 | 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 Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 133 | json = { |
| 134 | '#': 'generated with test/end2end/gen_build_json.py', |
| 135 | 'libs': [ |
| 136 | { |
| 137 | 'name': 'end2end_fixture_%s' % f, |
| 138 | 'build': 'private', |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 139 | 'language': 'c', |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 140 | 'secure': 'check' if END2END_FIXTURES[f].secure else 'no', |
Nicolas Noble | 2e36393 | 2015-05-04 14:54:33 -0700 | [diff] [blame] | 141 | 'src': ['test/core/end2end/fixtures/%s.c' % f], |
Craig Tiller | d50993d | 2015-08-05 08:04:36 -0700 | [diff] [blame^] | 142 | 'platforms': [ 'linux', 'mac', 'posix' ] if f.endswith('_posix') else END2END_FIXTURES[f].platforms, |
Craig Tiller | f75fc12 | 2015-06-25 06:58:00 -0700 | [diff] [blame] | 143 | 'deps': sec_deps if END2END_FIXTURES[f].secure else unsec_deps, |
| 144 | 'headers': ['test/core/end2end/end2end_tests.h'], |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 145 | } |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 146 | for f in sorted(END2END_FIXTURES.keys())] + [ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 147 | { |
| 148 | 'name': 'end2end_test_%s' % t, |
| 149 | 'build': 'private', |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 150 | 'language': 'c', |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 151 | 'secure': 'check' if END2END_TESTS[t].secure else 'no', |
Craig Tiller | 4853791 | 2015-01-16 09:57:49 -0800 | [diff] [blame] | 152 | 'src': ['test/core/end2end/tests/%s.c' % t], |
Craig Tiller | f75fc12 | 2015-06-25 06:58:00 -0700 | [diff] [blame] | 153 | '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 Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 156 | } |
Nicolas "Pixel" Noble | b8137b3 | 2015-04-24 01:44:28 +0200 | [diff] [blame] | 157 | for t in sorted(END2END_TESTS.keys())] + [ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 158 | { |
| 159 | 'name': 'end2end_certs', |
| 160 | 'build': 'private', |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 161 | 'language': 'c', |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 162 | 'src': [ |
chenw | 97fd9e5 | 2014-12-19 17:12:36 -0800 | [diff] [blame] | 163 | "test/core/end2end/data/test_root_cert.c", |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 164 | "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 Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 173 | 'language': 'c', |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 174 | 'src': [], |
Julien Boeuf | 9f218dd | 2015-04-23 10:24:02 -0700 | [diff] [blame] | 175 | 'flaky': END2END_TESTS[t].flaky, |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 176 | 'platforms': END2END_FIXTURES[f].platforms, |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 177 | 'deps': [ |
| 178 | 'end2end_fixture_%s' % f, |
Craig Tiller | f75fc12 | 2015-06-25 06:58:00 -0700 | [diff] [blame] | 179 | 'end2end_test_%s' % t] + sec_deps |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 180 | } |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 181 | for f in sorted(END2END_FIXTURES.keys()) |
Craig Tiller | 1ada6ad | 2015-07-16 16:19:14 -0700 | [diff] [blame] | 182 | for t in sorted(END2END_TESTS.keys()) |
| 183 | if compatible(f, t)] + [ |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 184 | { |
| 185 | 'name': '%s_%s_unsecure_test' % (f, t), |
| 186 | 'build': 'test', |
| 187 | 'language': 'c', |
Nicolas "Pixel" Noble | 99738f6 | 2015-04-23 01:31:24 +0200 | [diff] [blame] | 188 | 'secure': 'no', |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 189 | 'src': [], |
Craig Tiller | a7957f5 | 2015-07-29 18:48:38 -0700 | [diff] [blame] | 190 | 'flaky': END2END_TESTS[t].flaky, |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 191 | 'platforms': END2END_FIXTURES[f].platforms, |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 192 | 'deps': [ |
| 193 | 'end2end_fixture_%s' % f, |
Craig Tiller | f75fc12 | 2015-06-25 06:58:00 -0700 | [diff] [blame] | 194 | 'end2end_test_%s' % t] + unsec_deps |
Craig Tiller | c8b357f | 2015-04-20 16:36:52 -0700 | [diff] [blame] | 195 | } |
Nicolas "Pixel" Noble | 18938cd | 2015-05-09 08:35:42 +0200 | [diff] [blame] | 196 | for f in sorted(END2END_FIXTURES.keys()) if not END2END_FIXTURES[f].secure |
Craig Tiller | 1ada6ad | 2015-07-16 16:19:14 -0700 | [diff] [blame] | 197 | for t in sorted(END2END_TESTS.keys()) if compatible(f, t) and not END2END_TESTS[t].secure]} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 198 | print simplejson.dumps(json, sort_keys=True, indent=2 * ' ') |
| 199 | |
| 200 | |
| 201 | if __name__ == '__main__': |
| 202 | main() |