1#!/usr/bin/env python2.7 2# Copyright 2015 gRPC authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16"""Generates the appropriate build.json data for all the bad_client tests.""" 17 18load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test") 19 20def test_options(): 21 return struct() 22 23# maps test names to options 24BAD_CLIENT_TESTS = { 25 "badreq": test_options(), 26 "bad_streaming_id": test_options(), 27 "connection_prefix": test_options(), 28 "duplicate_header": test_options(), 29 "headers": test_options(), 30 "initial_settings_frame": test_options(), 31 "head_of_line_blocking": test_options(), 32 "out_of_bounds": test_options(), 33 "server_registered_method": test_options(), 34 "simple_request": test_options(), 35 "window_overflow": test_options(), 36 "unknown_frame": test_options(), 37} 38 39# buildifier: disable=unnamed-macro 40def grpc_bad_client_tests(): 41 grpc_cc_library( 42 name = "bad_client_test", 43 srcs = ["bad_client.cc"], 44 hdrs = ["bad_client.h"], 45 language = "C++", 46 testonly = 1, 47 deps = [ 48 "//test/core/util:grpc_test_util", 49 "//:grpc", 50 "//:gpr", 51 "//test/core/end2end:cq_verifier", 52 "//:grpc_http_filters", 53 ], 54 ) 55 for t, topt in BAD_CLIENT_TESTS.items(): 56 grpc_cc_test( 57 name = "%s_bad_client_test" % t, 58 srcs = ["tests/%s.cc" % t], 59 deps = [":bad_client_test"], 60 tags = ["bad_client_test"], 61 external_deps = [ 62 "gtest", 63 ], 64 ) 65