From be118ab93dec2ff3eeea874cc127485327d61478 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 21 Aug 2025 11:55:01 -0500 Subject: [PATCH] scripts: Fixed -s/-S sorting of .csv/.json outputs I'm not sure if this was ever implemented, or broken during a refactor, but we were ignoring -s/-S flags when writing .csv/.json output with -o/-O. Curious, because the functionality _was_ implemented in fold, just unused. All this required was passing -s/-S to fold correctly. Note we _don't_ sort diff_results, because these are never written to .csv/.json output. At some point this behavior may have been a bit more questionable, since we use to allow mixing -o/-O and table rendering. But now that -o/-O is considered an exclusive operation, ignoring -s/-S doesn't really make sense. --- Why did this come up? Well imagine my frustration when: 1. In tikz/pgfplots, \addplot table only really works with sorted data 2. csv.py has a -s/-S flag for sorting! 3. -s/-S doesn't work! --- scripts/code.py | 3 ++- scripts/cov.py | 3 ++- scripts/csv.py | 1 + scripts/ctx.py | 1 + scripts/data.py | 3 ++- scripts/perf.py | 1 + scripts/perfbd.py | 1 + scripts/stack.py | 1 + scripts/structs.py | 1 + 9 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/code.py b/scripts/code.py index aa94ee8f..f9d3e520 100755 --- a/scripts/code.py +++ b/scripts/code.py @@ -1090,7 +1090,8 @@ def main(obj_paths, *, # fold results = fold(CodeResult, results, by=by, - defines=defines) + defines=defines, + sort=sort) # find previous results? diff_results = None diff --git a/scripts/cov.py b/scripts/cov.py index b7bfcced..4cb300f8 100755 --- a/scripts/cov.py +++ b/scripts/cov.py @@ -1050,7 +1050,8 @@ def main(gcda_paths, *, # fold results = fold(CovResult, results, by=by, - defines=defines) + defines=defines, + sort=sort) # find previous results? diff_results = None diff --git a/scripts/csv.py b/scripts/csv.py index a987ee76..c3a7b27f 100755 --- a/scripts/csv.py +++ b/scripts/csv.py @@ -2438,6 +2438,7 @@ def main(csv_paths, *, # fold results = fold(Result, results, by=by, + sort=sort, depth=depth) # hotify? diff --git a/scripts/ctx.py b/scripts/ctx.py index fbf12a36..05ea31b0 100755 --- a/scripts/ctx.py +++ b/scripts/ctx.py @@ -1370,6 +1370,7 @@ def main(obj_paths, *, results = fold(CtxResult, results, by=by, defines=defines, + sort=sort, depth=depth) # hotify? diff --git a/scripts/data.py b/scripts/data.py index 15100d08..c27a8c73 100755 --- a/scripts/data.py +++ b/scripts/data.py @@ -1090,7 +1090,8 @@ def main(obj_paths, *, # fold results = fold(DataResult, results, by=by, - defines=defines) + defines=defines, + sort=sort) # find previous results? diff_results = None diff --git a/scripts/perf.py b/scripts/perf.py index 651f755c..ca193d1d 100755 --- a/scripts/perf.py +++ b/scripts/perf.py @@ -1588,6 +1588,7 @@ def main_(perf_paths, *, results = fold(PerfResult, results, by=by, defines=defines, + sort=sort, depth=depth) # hotify? diff --git a/scripts/perfbd.py b/scripts/perfbd.py index 664d851b..77d5fbc1 100755 --- a/scripts/perfbd.py +++ b/scripts/perfbd.py @@ -1584,6 +1584,7 @@ def main_(paths, *, results = fold(PerfBdResult, results, by=by, defines=defines, + sort=sort, depth=depth) # hotify? diff --git a/scripts/stack.py b/scripts/stack.py index 32e9ca0b..1351cb92 100755 --- a/scripts/stack.py +++ b/scripts/stack.py @@ -1108,6 +1108,7 @@ def main(ci_paths, results = fold(StackResult, results, by=by, defines=defines, + sort=sort, depth=depth) # hotify? diff --git a/scripts/structs.py b/scripts/structs.py index 0075c4f2..6fb03b50 100755 --- a/scripts/structs.py +++ b/scripts/structs.py @@ -1259,6 +1259,7 @@ def main(obj_paths, *, results = fold(StructResult, results, by=by, defines=defines, + sort=sort, depth=depth) # hotify?