1# Copyright 2016 gRPC authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""Create tests for each fuzzer""" 15 16import copy 17import glob 18 19 20def mako_plugin(dictionary): 21 targets = dictionary['targets'] 22 tests = dictionary['tests'] 23 for tgt in targets: 24 if tgt['build'] == 'fuzzer': 25 new_target = copy.deepcopy(tgt) 26 new_target['build'] = 'test' 27 new_target['name'] += '_one_entry' 28 new_target['run'] = False 29 new_target['src'].append( 30 'test/core/util/one_corpus_entry_fuzzer.cc') 31 new_target['own_src'].append( 32 'test/core/util/one_corpus_entry_fuzzer.cc') 33 targets.append(new_target) 34 for corpus in new_target['corpus_dirs']: 35 for fn in sorted(glob.glob('%s/*' % corpus)): 36 tests.append({ 37 'name': new_target['name'], 38 'args': [fn], 39 'exclude_iomgrs': ['uv'], 40 'exclude_configs': ['tsan'], 41 'uses_polling': False, 42 'platforms': ['mac', 'linux'], 43 'ci_platforms': ['linux'], 44 'flaky': False, 45 'language': 'c', 46 'cpu_cost': 0.1, 47 }) 48