From dbc96f41f15fc30d4fc6198eb1c2dcb57547a160 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Mon, 15 Sep 2025 16:28:52 -0400 Subject: [PATCH] [libc++] Escape spaces in GoogleBenchmark microbenchmarks Otherwise we generate data that isn't valid according to the LNT format. --- libcxx/utils/parse-google-benchmark-results | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libcxx/utils/parse-google-benchmark-results b/libcxx/utils/parse-google-benchmark-results index 86d59bb522a4..f0bace81a005 100755 --- a/libcxx/utils/parse-google-benchmark-results +++ b/libcxx/utils/parse-google-benchmark-results @@ -41,7 +41,10 @@ def main(argv): benchmark = headers.index('Benchmark') time = headers.index(args.timing) for row in rows: - print(f'{row[benchmark].replace(".", "_")}.execution_time {row[time]}') + # LNT format uses '.' to separate the benchmark name from the metric, and ' ' + # to separate the benchmark name + metric from the numerical value. Escape both. + escaped = row[benchmark].replace(".", "_").replace(" ", "_") + print(f'{escaped}.execution_time {row[time]}') if __name__ == '__main__': main(sys.argv[1:])