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 17 """Generates the appropriate build.json data for all the bad_client tests.""" 18 19 20 import collections 21 import yaml 22 23 TestOptions = collections.namedtuple('TestOptions', 'flaky cpu_cost') 24 default_test_options = TestOptions(False, 1.0) 25 26 # maps test names to options 27 BAD_CLIENT_TESTS = { 28 'badreq': default_test_options, 29 'connection_prefix': default_test_options._replace(cpu_cost=0.2), 30 'duplicate_header': default_test_options, 31 'headers': default_test_options._replace(cpu_cost=0.2), 32 'initial_settings_frame': default_test_options._replace(cpu_cost=0.2), 33 'head_of_line_blocking': default_test_options, 34 'large_metadata': default_test_options, 35 'server_registered_method': default_test_options, 36 'simple_request': default_test_options, 37 'window_overflow': default_test_options, 38 'unknown_frame': default_test_options, 39 } 40 41 def main(): 42 json = { 43 '#': 'generated with test/bad_client/gen_build_json.py', 44 'libs': [ 45 { 46 'name': 'bad_client_test', 47 'build': 'private', 48 'language': 'c', 49 'src': [ 50 'test/core/bad_client/bad_client.cc' 51 ], 52 'headers': [ 53 'test/core/bad_client/bad_client.h' 54 ], 55 'vs_proj_dir': 'test/bad_client', 56 'deps': [ 57 'grpc_test_util_unsecure', 58 'grpc_unsecure', 59 'gpr_test_util', 60 'gpr' 61 ] 62 }], 63 'targets': [ 64 { 65 'name': '%s_bad_client_test' % t, 66 'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost, 67 'build': 'test', 68 'language': 'c', 69 'secure': 'no', 70 'src': ['test/core/bad_client/tests/%s.cc' % t], 71 'vs_proj_dir': 'test', 72 'exclude_iomgrs': ['uv'], 73 'deps': [ 74 'bad_client_test', 75 'grpc_test_util_unsecure', 76 'grpc_unsecure', 77 'gpr_test_util', 78 'gpr' 79 ] 80 } 81 for t in sorted(BAD_CLIENT_TESTS.keys())]} 82 print yaml.dump(json) 83 84 85 if __name__ == '__main__': 86 main() 87