diff options
author | Craig Tiller <ctiller@google.com> | 2017-01-04 15:41:57 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-04 15:41:57 -0800 |
commit | 94c2647333252624d44ce45586a240968c53f511 (patch) | |
tree | 25e54bc50e1774976f5144a8a58e52d9e6e34e4e /test/core/end2end | |
parent | 19cc2db3bc36b18cf5f27646cf262a448f00def0 (diff) | |
parent | 293ef1572bde871a0d28462bfd15eb7c13f99499 (diff) |
Merge branch 'slice_with_exec_ctx' into metadata_filter
Diffstat (limited to 'test/core/end2end')
-rw-r--r-- | test/core/end2end/BUILD | 78 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/BUILD | 54 | ||||
-rwxr-xr-x | test/core/end2end/generate_tests.bzl | 191 |
3 files changed, 323 insertions, 0 deletions
diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD new file mode 100644 index 0000000000..681cea1de7 --- /dev/null +++ b/test/core/end2end/BUILD @@ -0,0 +1,78 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +load(":generate_tests.bzl", "grpc_end2end_tests") + +cc_library( + name = 'cq_verifier', + srcs = ['cq_verifier.c'], + hdrs = ['cq_verifier.h'], + deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'], + copts = ['-std=c99'], + visibility = ["//test:__subpackages__"], +) + +cc_library( + name = 'ssl_test_data', + visibility = ["//test:__subpackages__"], + hdrs = ['data/ssl_test_data.h'], + copts = ['-std=c99'], + srcs = [ + "data/client_certs.c", + "data/server1_cert.c", + "data/server1_key.c", + "data/test_root_cert.c", + ] +) + +cc_library( + name = 'fake_resolver', + hdrs = ['fake_resolver.h'], + srcs = ['fake_resolver.c'], + copts = ['-std=c99'], + deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'] +) + +cc_library( + name = 'http_proxy', + hdrs = ['fixtures/http_proxy.h'], + srcs = ['fixtures/http_proxy.c'], + copts = ['-std=c99'], + deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'] +) + +cc_library( + name = 'proxy', + hdrs = ['fixtures/proxy.h'], + srcs = ['fixtures/proxy.c'], + copts = ['-std=c99'], + deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'] +) + +grpc_end2end_tests() diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD new file mode 100644 index 0000000000..2adda560b4 --- /dev/null +++ b/test/core/end2end/fuzzers/BUILD @@ -0,0 +1,54 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") + +grpc_fuzzer( + name = "api_fuzzer", + srcs = ["api_fuzzer.c"], + deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util", "//test/core/end2end:ssl_test_data"], + corpus = "api_fuzzer_corpus", + copts = ["-std=c99"], +) + +grpc_fuzzer( + name = "client_fuzzer", + srcs = ["client_fuzzer.c"], + deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], + corpus = "client_fuzzer_corpus", + copts = ["-std=c99"], +) + +grpc_fuzzer( + name = "server_fuzzer", + srcs = ["server_fuzzer.c"], + deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], + corpus = "server_fuzzer_corpus", + copts = ["-std=c99"], +) diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl new file mode 100755 index 0000000000..31f330c6b9 --- /dev/null +++ b/test/core/end2end/generate_tests.bzl @@ -0,0 +1,191 @@ +#!/usr/bin/env python2.7 +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +"""Generates the appropriate build.json data for all the end2end tests.""" + + +def fixture_options(fullstack=True, includes_proxy=False, dns_resolver=True, + secure=True, tracing=False, + platforms=['windows', 'linux', 'mac', 'posix']): + return struct( + fullstack=fullstack, + includes_proxy=includes_proxy, + dns_resolver=dns_resolver, + secure=secure, + tracing=tracing, + #platforms=platforms + ) + + +# maps fixture name to whether it requires the security library +END2END_FIXTURES = { + 'h2_compress': fixture_options(), + 'h2_census': fixture_options(), + 'h2_load_reporting': fixture_options(), + 'h2_fakesec': fixture_options(), + 'h2_fd': fixture_options(dns_resolver=False, fullstack=False, + platforms=['linux', 'mac', 'posix']), + 'h2_full': fixture_options(), + 'h2_full+pipe': fixture_options(platforms=['linux']), + 'h2_full+trace': fixture_options(tracing=True), + 'h2_http_proxy': fixture_options(), + 'h2_oauth2': fixture_options(), + 'h2_proxy': fixture_options(includes_proxy=True), + 'h2_sockpair_1byte': fixture_options(fullstack=False, dns_resolver=False), + 'h2_sockpair': fixture_options(fullstack=False, dns_resolver=False), + 'h2_sockpair+trace': fixture_options(fullstack=False, dns_resolver=False, + tracing=True), + 'h2_ssl': fixture_options(secure=True), + 'h2_ssl_cert': fixture_options(secure=True), + 'h2_ssl_proxy': fixture_options(secure=True), + 'h2_uds': fixture_options(dns_resolver=False, + platforms=['linux', 'mac', 'posix']), +} + + +def test_options(needs_fullstack=False, needs_dns=False, proxyable=True, + secure=False, traceable=False): + return struct( + needs_fullstack=needs_fullstack, + needs_dns=needs_dns, + proxyable=proxyable, + secure=secure, + traceable=traceable + ) + + +# maps test names to options +END2END_TESTS = { + 'bad_hostname': test_options(), + 'binary_metadata': test_options(), + 'resource_quota_server': test_options(proxyable=False), + 'call_creds': test_options(secure=True), + 'cancel_after_accept': test_options(), + 'cancel_after_client_done': test_options(), + 'cancel_after_invoke': test_options(), + 'cancel_before_invoke': test_options(), + 'cancel_in_a_vacuum': test_options(), + 'cancel_with_status': test_options(), + 'compressed_payload': test_options(), + 'connectivity': test_options(needs_fullstack=True, proxyable=False), + 'default_host': test_options(needs_fullstack=True, needs_dns=True), + 'disappearing_server': test_options(needs_fullstack=True), + 'empty_batch': test_options(), + 'filter_causes_close': test_options(), + 'filter_call_init_fails': test_options(), + 'graceful_server_shutdown': test_options(), + 'hpack_size': test_options(proxyable=False, traceable=False), + 'high_initial_seqno': test_options(), + 'idempotent_request': test_options(), + 'invoke_large_request': test_options(), + 'large_metadata': test_options(), + 'max_concurrent_streams': test_options(proxyable=False), + 'max_message_length': test_options(), + 'negative_deadline': test_options(), + 'network_status_change': test_options(), + 'no_logging': test_options(traceable=False), + 'no_op': test_options(), + 'payload': test_options(), + 'load_reporting_hook': test_options(), + 'ping_pong_streaming': test_options(), + 'ping': test_options(proxyable=False), + 'registered_call': test_options(), + 'request_with_flags': test_options(proxyable=False), + 'request_with_payload': test_options(), + 'server_finishes_request': test_options(), + 'shutdown_finishes_calls': test_options(), + 'shutdown_finishes_tags': test_options(), + 'simple_cacheable_request': test_options(), + 'simple_delayed_request': test_options(needs_fullstack=True), + 'simple_metadata': test_options(), + 'simple_request': test_options(), + 'streaming_error_response': test_options(), + 'trailing_metadata': test_options(), + 'authority_not_supported': test_options(), + 'filter_latency': test_options(), +} + + +def compatible(fopt, topt): + if topt.needs_fullstack: + if not fopt.fullstack: + return False + if topt.needs_dns: + if not fopt.dns_resolver: + return False + if not topt.proxyable: + if fopt.includes_proxy: + return False + if not topt.traceable: + if fopt.tracing: + return False + return True + + +def grpc_end2end_tests(): + native.cc_library( + name = 'end2end_tests', + srcs = ['end2end_tests.c', 'end2end_test_utils.c'] + [ + 'tests/%s.c' % t + for t in sorted(END2END_TESTS.keys())], + hdrs = [ + 'tests/cancel_test_helpers.h', + 'end2end_tests.h' + ], + copts = ['-std=c99'], + deps = [ + ':cq_verifier', + ':ssl_test_data', + ':fake_resolver', + ':http_proxy', + ':proxy', + '//test/core/util:grpc_test_util', + '//:grpc', + '//test/core/util:gpr_test_util', + '//:gpr', + ] + ) + + for f, fopt in END2END_FIXTURES.items(): + native.cc_library( + name = '%s_test_lib' % f, + srcs = ['fixtures/%s.c' % f], + copts = ['-std=c99'], + deps = [':end2end_tests'] + ) + for t, topt in END2END_TESTS.items(): + #print(compatible(fopt, topt), f, t, fopt, topt) + if not compatible(fopt, topt): continue + native.cc_test( + name = '%s_test@%s' % (f, t), + args = [t], + deps = [':%s_test_lib' % f], + ) |