From f4202cefbb08198081b7ee52e0a87efd5d35e703 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 31 Aug 2022 14:19:47 -0700 Subject: [PATCH] [experiments] Make output more diffable/readable (#30807) * [experiments] Make output more diffable/readable * Automated change: Fix sanity tests * buildifier sized indentations Co-authored-by: ctiller --- bazel/experiments.bzl | 10 +++++++++- tools/codegen/core/gen_experiments.py | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bazel/experiments.bzl b/bazel/experiments.bzl index e77ee6a1aad..64c82eb81ce 100644 --- a/bazel/experiments.bzl +++ b/bazel/experiments.bzl @@ -15,4 +15,12 @@ # Automatically generated by tools/codegen/core/gen_experiments.py """Dictionary of tags to experiments so we know when to test different experiments.""" -EXPERIMENTS = {"endpoint_test": ["tcp_frame_size_tuning"], "core_end2end_test": ["tcp_frame_size_tuning"]} + +EXPERIMENTS = { + "core_end2end_test": [ + "tcp_frame_size_tuning", + ], + "endpoint_test": [ + "tcp_frame_size_tuning", + ], +} diff --git a/tools/codegen/core/gen_experiments.py b/tools/codegen/core/gen_experiments.py index e2edb4c6316..6203ef9a2fe 100755 --- a/tools/codegen/core/gen_experiments.py +++ b/tools/codegen/core/gen_experiments.py @@ -91,7 +91,10 @@ def snake_to_pascal(s): def put_banner(files, banner, prefix): for f in files: for line in banner: - print('%s %s' % (prefix, line), file=f) + if not line: + print(prefix, file=f) + else: + print('%s %s' % (prefix, line), file=f) print(file=f) @@ -215,4 +218,11 @@ with open('bazel/experiments.bzl', 'w') as B: "\"\"\"Dictionary of tags to experiments so we know when to test different experiments.\"\"\"", file=B) - print("EXPERIMENTS=%r" % dict(tags_to_experiments), file=B) + print(file=B) + print("EXPERIMENTS = {", file=B) + for tag, experiments in sorted(tags_to_experiments.items()): + print(" \"%s\": [" % tag, file=B) + for experiment in sorted(experiments): + print(" \"%s\"," % experiment, file=B) + print(" ],", file=B) + print("}", file=B)