scripts: Tried to handle -d/--diff results consistently

With this, we apply the same result modifiers (exprs/defines/hot/etc) to
both the input results and -d/--diff results. So if both start with the
same format, diffing/hotifying/etc should work as expected.

This is really the only way I can seen -d/--diff results working with
result modifiers in a way that makes sense.

The downside of this is that you can't save results with some complex
operation applied, and then diff while applying the same operation,
since most of the newer operations (hotify) are _not_ idempotent.

Fortunately the two alternatives are not unreasonable:

1. Save results _without_ the operation applied, since the operation
   will be applied to both the input and diff results.

   This is a bit asymmetric, but should work.

2. Apply the operation to the input and then pipe to csv.py for diffing.

This used to "just work" when we did _not_ apply operations to output
csv/json, but this was really just equivalent to 1..

I think the moral of the story is you can solve any problem with enough
chained csv.py calls.
This commit is contained in:
Christopher Haster
2025-03-01 01:54:31 -06:00
parent 2f20f53e90
commit 051bf66f9a
9 changed files with 118 additions and 44 deletions

View File

@@ -801,10 +801,13 @@ def table(Result, results, diff_results=None, *,
# figure out a good label
if labels is not None:
label = ','.join(str(getattr(r, k)
if getattr(r, k) is not None
else '')
for k in labels)
label = next(
','.join(str(getattr(r_, k)
if getattr(r_, k) is not None
else '')
for k in labels)
for r_ in [r, diff_r]
if r_ is not None)
else:
label = name