diff options
Diffstat (limited to 'templates/tools/run_tests/generated')
3 files changed, 109 insertions, 0 deletions
diff --git a/templates/tools/run_tests/generated/configs.json.template b/templates/tools/run_tests/generated/configs.json.template new file mode 100644 index 0000000000..5c82dfb347 --- /dev/null +++ b/templates/tools/run_tests/generated/configs.json.template @@ -0,0 +1,17 @@ +%YAML 1.2 +--- | + <% + import json + out_configs = [] + for name, args in configs.iteritems(): + config_args={} + config_args['config'] = name + if args.get('valgrind', None) is not None: + config_args['tool_prefix'] = ['valgrind'] + args.valgrind.split(' ') + if args.get('timeout_multiplier', 1) != 1: + config_args['timeout_multiplier'] = args.timeout_multiplier + if args.get('test_environ', None) is not None: + config_args['environ'] = args.test_environ + out_configs.append(config_args) + %>\ + ${json.dumps(out_configs, sort_keys=True, indent=2)} diff --git a/templates/tools/run_tests/generated/sources_and_headers.json.template b/templates/tools/run_tests/generated/sources_and_headers.json.template new file mode 100644 index 0000000000..1c5c9747d6 --- /dev/null +++ b/templates/tools/run_tests/generated/sources_and_headers.json.template @@ -0,0 +1,72 @@ +%YAML 1.2 +--- | + <%! + import json + import os + + def proto_headers(src): + out = [] + for f in src: + name, ext = os.path.splitext(f) + if ext == '.proto': + out.extend(fmt % name for fmt in ['%s.grpc.pb.h', '%s.pb.h']) + return out + + def all_targets(targets, libs, filegroups): + for tgt in targets: + yield ('target', tgt) + for tgt in libs: + yield ('lib', tgt) + for tgt in filegroups: + yield ('filegroup', tgt) + + def no_protos_filter(src): + return os.path.splitext(src)[1] != '.proto' + + def no_third_party_filter(src): + return not src.startswith('third_party/') + + def filter_srcs(srcs, filters): + out = [] + for s in srcs: + filter_passes = (f(s) for f in filters) + if all(filter_passes): + out.append(s) + return out + %> + + ${json.dumps([{"name": tgt.name, + "type": typ, + "is_filegroup": False, + "language": tgt.language, + "third_party": tgt.boringssl or tgt.zlib, + "src": sorted( + filter_srcs(tgt.own_src, (no_protos_filter, no_third_party_filter)) + + filter_srcs(tgt.own_public_headers, (no_protos_filter, no_third_party_filter)) + + filter_srcs(tgt.own_headers, (no_third_party_filter,))), + "headers": sorted( + tgt.own_public_headers + + tgt.own_headers + + proto_headers(tgt.own_src)), + "deps": sorted(tgt.get('deps', []) + + tgt.get('uses', []) + + tgt.get('filegroups', []))} + for typ, tgt in all_targets(targets, libs, [])] + + [{"name": tgt.name, + "type": typ, + "is_filegroup": True, + "language": tgt.language, + "third_party": tgt.boringssl or tgt.zlib, + "src": sorted( + filter_srcs(tgt.own_src, (no_protos_filter, no_third_party_filter)) + + filter_srcs(tgt.own_public_headers, (no_protos_filter, no_third_party_filter)) + + filter_srcs(tgt.own_headers, (no_third_party_filter,))), + "headers": sorted( + tgt.own_public_headers + + tgt.own_headers + + proto_headers(tgt.own_src)), + "deps": sorted(tgt.get('deps', []) + + tgt.get('uses', []) + + tgt.get('filegroups', []))} + for typ, tgt in all_targets([], [], filegroups)], + sort_keys=True, indent=2)} diff --git a/templates/tools/run_tests/generated/tests.json.template b/templates/tools/run_tests/generated/tests.json.template new file mode 100644 index 0000000000..1e21465dd2 --- /dev/null +++ b/templates/tools/run_tests/generated/tests.json.template @@ -0,0 +1,20 @@ +%YAML 1.2 +--- | + <%! + import json + %> + + ${json.dumps([{"name": tgt.name, + "language": tgt.language, + "platforms": tgt.platforms, + "ci_platforms": tgt.ci_platforms, + "gtest": tgt.gtest, + "exclude_configs": tgt.get("exclude_configs", []), + "exclude_iomgrs": tgt.get("exclude_iomgrs", []), + "args": [], + "flaky": tgt.flaky, + "cpu_cost": tgt.get("cpu_cost", 1.0)} + for tgt in targets + if tgt.get('run', True) and tgt.build == 'test'] + + tests, + sort_keys=True, indent=2)} |