Skip to content

Commit c404e63

Browse files
cliffhallclaude
andcommitted
chore(memory): TEMPORARY per-test durations for the Windows diagnostic (#5570)
Diagnostic only, dropped before the PR opens. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
1 parent 4ec6947 commit c404e63

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

‎.github/workflows/typescript.yml‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ jobs:
178178
run: npm test
179179

180180
# TEMPORARY diagnostic for #5570, removed before the PR opens: memory's suite
181-
# run repeatedly on five Windows runners, with a long test timeout so a slow
181+
# run repeatedly on eight Windows runners, with a long test timeout so a slow
182182
# test finishes and reports where its time went.
183183
diag-5570:
184184
timeout-minutes: 25
185185
strategy:
186186
fail-fast: false
187187
matrix:
188-
shard: [1, 2, 3, 4, 5]
188+
shard: [1, 2, 3, 4, 5, 6, 7, 8]
189189
name: Diag 5570 memory Windows (${{ matrix.shard }})
190190
runs-on: windows-latest
191191
steps:
@@ -207,9 +207,8 @@ jobs:
207207
run: |
208208
for i in $(seq 1 80); do
209209
echo "{\"iteration\":$i,\"at\":\"$(date -u +%H:%M:%S)\"}" >> "$DIAG_FILE"
210-
npx vitest run --testTimeout=60000 > "$RUNNER_TEMP/out-$i.txt" 2>&1 || echo "ITERATION $i FAILED"
211-
grep -E "Duration|Tests " "$RUNNER_TEMP/out-$i.txt" | tr '\n' ' '; echo
212-
grep -E "[0-9]{4,} *ms" "$RUNNER_TEMP/out-$i.txt" || true
210+
npx vitest run --testTimeout=60000 --reporter=json --outputFile="$RUNNER_TEMP/r.json" > /dev/null 2>&1 || echo "ITERATION $i FAILED"
211+
node diag-report.mjs "$i" "$RUNNER_TEMP/r.json"
213212
done
214213
echo "=== DIAG JSONL ==="
215214
cat "$DIAG_FILE"

‎src/memory/diag-report.mjs‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// TEMPORARY diagnostic for #5570 (removed before the PR opens): one line per
2+
// iteration from vitest's JSON report, naming every test of 1 s or more and,
3+
// for a slow iteration, each file's duration.
4+
import { readFileSync } from "node:fs";
5+
6+
const [, , iteration, file] = process.argv;
7+
const report = JSON.parse(readFileSync(file, "utf8"));
8+
const files = report.testResults.map((result) => ({
9+
name: result.name.replace(/^.*__tests__./, ""),
10+
ms: Math.round(result.endTime - result.startTime),
11+
tests: result.assertionResults.map((test) => ({
12+
name: test.fullName,
13+
ms: Math.round(test.duration ?? 0),
14+
})),
15+
}));
16+
const total = files.reduce((sum, entry) => sum + entry.ms, 0);
17+
const tests = files.flatMap((entry) => entry.tests);
18+
const out = {
19+
it: Number(iteration),
20+
at: new Date().toISOString().slice(11, 19),
21+
ok: report.success,
22+
total,
23+
maxTest: Math.max(...tests.map((test) => test.ms)),
24+
slow: tests.filter((test) => test.ms >= 1000),
25+
};
26+
if (total > 9000) {
27+
out.files = Object.fromEntries(files.map((entry) => [entry.name, entry.ms]));
28+
out.top = tests.sort((a, b) => b.ms - a.ms).slice(0, 12);
29+
}
30+
console.log("ITER " + JSON.stringify(out));

0 commit comments

Comments
 (0)