Conversation
TestDirectory measured runtime, GC time and allocation per test file, then stored them in local arrays that were never read. The only way out was the progress table, where StringOfMemoryAmount rounds to three significant figures. `returnStats` returns them as a record instead of a bool; `statsFile` writes the same data as JSON. The file is written before `exitGAP` quits, so a package test run driven by gap-actions can collect it — there the exit code is otherwise the only channel out. Both default off, so existing callers are unaffected. Assisted-by: Claude Code (Opus 5)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6581 +/- ##
==========================================
- Coverage 79.01% 79.00% -0.02%
==========================================
Files 683 683
Lines 295340 295270 -70
Branches 8668 8666 -2
==========================================
- Hits 233369 233284 -85
- Misses 60156 60167 +11
- Partials 1815 1819 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| esc := function(str) | ||
| str := ReplacedString(str, "\\", "\\\\"); | ||
| str := ReplacedString(str, "\"", "\\\""); | ||
| return Concatenation("\"", ReplacedString(str, "\n", "\\n"), "\""); |
There was a problem hiding this comment.
So, my only thought is, do we want a not-complete JSON implementation here (this isn't enough escaping I don't think, technically?), would it be better to just return a dictionary, and then someone can use the JSON package if they want to write out JSON (or if we decide we really need json output in core, we could add that generically)
There was a problem hiding this comment.
I agree. We can manage that with CSV files as well.
Something that is structured is sufficient.
Adds two options to
TestDirectoryfor getting at the per-file numbers italready measures.
returnStats := truereturns a record with the totals and one entry pertest file (
name,shortName,failures,time,gcTime,mem) ratherthan a bool.
statsFile := "<path>"writes the same data as JSON, beforeexitGAPquits — which is what makes it usable from a package test run,where the exit code is otherwise the only thing that escapes the process.
Byte counts are exact, unlike the
StringOfMemoryAmountvalues in theprogress table.
Both options default off and the existing return value is unchanged.
Use case
A package suite driven by
gap-actions/run-pkg-testsmust quit GAP itself, so today the only thing escaping the process is the exit code.The progress table is printed, but line-wrapped and rounded to three significant figures (40.3GB), so parsing it back loses the byte count.
With
statsFilethe run drops a machine-readable file in the checkout:which a later workflow step can upload or render into the job summary:
The same file can be posted back to the pull request.
This makes per-file runtime and allocation trackable across commits — worthwhile for suites where single files run for minutes and allocate tens of GB.
Assisted-by: Claude Code (Opus 5)