Skip to content

feat: split gotestsum logs into per-test files#19575

Merged
ajsutton merged 4 commits intodevelopfrom
aj/feat/split-test-logs-per-test
Mar 18, 2026
Merged

feat: split gotestsum logs into per-test files#19575
ajsutton merged 4 commits intodevelopfrom
aj/feat/split-test-logs-per-test

Conversation

@ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Mar 17, 2026

Summary

Adds two scripts under ops/scripts/:

  • split-test-logs.sh — takes a gotestsum JSON log file and splits it into one .log file per test, organized as per-test/<package>/<TestName>.log next to the source JSON file.
  • gotestsum-split.sh — drop-in gotestsum wrapper that runs gotestsum, then calls split-test-logs.sh. Preserves gotestsum's exit code so splits happen even on test failure (when they're most useful). If --jsonfile isn't provided, adds one automatically (tmp/testlogs/log.json) so per-test logs are always generated.

All gotestsum invocations in justfiles and CI config now use the wrapper. The one exception is the xargs-based parallel sharding in kona action tests, which calls gotestsum directly (xargs invokes it multiple times appending to one jsonfile) then calls split-test-logs.sh once at the end.

Per-test logs land under tmp/testlogs/per-test/ which is already captured by existing CircleCI store_artifacts steps.

Also migrates rust/op-reth/crates/tests from plain go test to gotestsum via the wrapper for consistency.

Files touched

File Change
ops/scripts/split-test-logs.sh New — splits a JSON log file into per-test files
ops/scripts/gotestsum-split.sh New — gotestsum wrapper that auto-splits
justfile Use wrapper in _go-tests-ci-internal and go-tests-fraud-proofs-ci
op-e2e/justfile Use wrapper in _go_test variable
rust/kona/tests/justfile Use wrapper + direct split for xargs case
rust/op-reth/tests/justfile Use wrapper in test-e2e-sysgo
rust/op-reth/crates/tests/justfile Migrate to gotestsum via wrapper
.circleci/continue/main.yml Use wrapper for cannon tests

Test plan

  • Verify split-test-logs.sh correctly splits a gotestsum JSON file into per-test logs locally
  • Verify gotestsum-split.sh auto-adds --jsonfile when not provided
  • Verify CI jobs still pass (test results and artifacts captured)
  • Verify per-test logs appear in CircleCI artifacts under testlogs/per-test/
  • Verify the split runs on test failure (exit code preserved)

🤖 Generated with Claude Code

@ajsutton ajsutton force-pushed the aj/feat/split-test-logs-per-test branch from dc5f232 to 754ef3d Compare March 17, 2026 03:17
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.5%. Comparing base (ba64213) to head (0c1073e).
⚠️ Report is 16 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #19575     +/-   ##
==========================================
- Coverage     75.5%    75.5%   -0.1%     
==========================================
  Files          675      675             
  Lines        71562    71562             
==========================================
- Hits         54071    54059     -12     
- Misses       17347    17359     +12     
  Partials       144      144             
Flag Coverage Δ
cannon-go-tests-64 66.4% <ø> (ø)
contracts-bedrock-tests 80.2% <ø> (ø)
unit 75.5% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from aj/chore/migrate-op-reth-makefiles-to-just to develop March 17, 2026 03:29
Add two scripts under ops/scripts/:

- split-test-logs.sh: takes a gotestsum JSON log file and splits it into
  one log file per test, organized as per-test/<package>/<TestName>.log
  next to the source JSON file.

- gotestsum-split.sh: drop-in gotestsum wrapper that runs gotestsum,
  then calls split-test-logs.sh. Preserves gotestsum's exit code so
  splits happen even on test failure. If --jsonfile isn't provided, adds
  one automatically (tmp/testlogs/log.json) so per-test logs are always
  generated.

All gotestsum invocations in justfiles and CI config now use the wrapper.
The one exception is the xargs-based parallel sharding in kona action
tests, which calls gotestsum directly (since xargs invokes it multiple
times appending to one jsonfile) and then calls split-test-logs.sh once
at the end.

Per-test logs land under tmp/testlogs/per-test/ which is already
captured by existing CircleCI store_artifacts steps.

Also migrates rust/op-reth/crates/tests from plain `go test` to
gotestsum via the wrapper for consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ajsutton ajsutton force-pushed the aj/feat/split-test-logs-per-test branch from 754ef3d to 76a171f Compare March 17, 2026 04:29
ajsutton and others added 3 commits March 17, 2026 04:37
split-test-logs.sh now exits non-zero when the JSON file is missing or
python3 is unavailable. gotestsum-split.sh propagates split failures
(preferring the split exit code over gotestsum's if both fail).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SOURCE is rust/kona/tests, so the repo root is ../../../ not ../../.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
store_artifacts doesn't support glob patterns — `testlogs*.tar.gz` was
treated as a literal filename, so no artifacts were ever captured for
parallel go-tests jobs. Use a consistent `testlogs.tar.gz` name since
the node index is already in the filenames inside the tarball.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ajsutton ajsutton marked this pull request as ready for review March 17, 2026 06:57
@ajsutton ajsutton requested a review from a team as a code owner March 17, 2026 06:57
@teddyknox teddyknox self-requested a review March 17, 2026 12:24
@ajsutton ajsutton added this pull request to the merge queue Mar 17, 2026
Merged via the queue into develop with commit aaf6369 Mar 18, 2026
280 checks passed
@ajsutton ajsutton deleted the aj/feat/split-test-logs-per-test branch March 18, 2026 00:04
ClaytonNorthey92 pushed a commit to hemilabs/optimism that referenced this pull request Mar 19, 2026
* feat: split gotestsum JSON logs into per-test files

Add two scripts under ops/scripts/:

- split-test-logs.sh: takes a gotestsum JSON log file and splits it into
  one log file per test, organized as per-test/<package>/<TestName>.log
  next to the source JSON file.

- gotestsum-split.sh: drop-in gotestsum wrapper that runs gotestsum,
  then calls split-test-logs.sh. Preserves gotestsum's exit code so
  splits happen even on test failure. If --jsonfile isn't provided, adds
  one automatically (tmp/testlogs/log.json) so per-test logs are always
  generated.

All gotestsum invocations in justfiles and CI config now use the wrapper.
The one exception is the xargs-based parallel sharding in kona action
tests, which calls gotestsum directly (since xargs invokes it multiple
times appending to one jsonfile) and then calls split-test-logs.sh once
at the end.

Per-test logs land under tmp/testlogs/per-test/ which is already
captured by existing CircleCI store_artifacts steps.

Also migrates rust/op-reth/crates/tests from plain `go test` to
gotestsum via the wrapper for consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: fail on split-test-logs.sh errors instead of silently ignoring

split-test-logs.sh now exits non-zero when the JSON file is missing or
python3 is unavailable. gotestsum-split.sh propagates split failures
(preferring the split exit code over gotestsum's if both fail).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: correct script paths in kona tests justfile

SOURCE is rust/kona/tests, so the repo root is ../../../ not ../../.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): use literal path for store_artifacts in go-tests job

store_artifacts doesn't support glob patterns — `testlogs*.tar.gz` was
treated as a literal filename, so no artifacts were ever captured for
parallel go-tests jobs. Use a consistent `testlogs.tar.gz` name since
the node index is already in the filenames inside the tarball.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ClaytonNorthey92 pushed a commit to hemilabs/optimism that referenced this pull request Mar 23, 2026
* feat: split gotestsum JSON logs into per-test files

Add two scripts under ops/scripts/:

- split-test-logs.sh: takes a gotestsum JSON log file and splits it into
  one log file per test, organized as per-test/<package>/<TestName>.log
  next to the source JSON file.

- gotestsum-split.sh: drop-in gotestsum wrapper that runs gotestsum,
  then calls split-test-logs.sh. Preserves gotestsum's exit code so
  splits happen even on test failure. If --jsonfile isn't provided, adds
  one automatically (tmp/testlogs/log.json) so per-test logs are always
  generated.

All gotestsum invocations in justfiles and CI config now use the wrapper.
The one exception is the xargs-based parallel sharding in kona action
tests, which calls gotestsum directly (since xargs invokes it multiple
times appending to one jsonfile) and then calls split-test-logs.sh once
at the end.

Per-test logs land under tmp/testlogs/per-test/ which is already
captured by existing CircleCI store_artifacts steps.

Also migrates rust/op-reth/crates/tests from plain `go test` to
gotestsum via the wrapper for consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: fail on split-test-logs.sh errors instead of silently ignoring

split-test-logs.sh now exits non-zero when the JSON file is missing or
python3 is unavailable. gotestsum-split.sh propagates split failures
(preferring the split exit code over gotestsum's if both fail).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: correct script paths in kona tests justfile

SOURCE is rust/kona/tests, so the repo root is ../../../ not ../../.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): use literal path for store_artifacts in go-tests job

store_artifacts doesn't support glob patterns — `testlogs*.tar.gz` was
treated as a literal filename, so no artifacts were ever captured for
parallel go-tests jobs. Use a consistent `testlogs.tar.gz` name since
the node index is already in the filenames inside the tarball.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants