Skip to content

Switch to GDUnit#939

Merged
CedNaru merged 12 commits into
masterfrom
rework/unit_tests
Jun 22, 2026
Merged

Switch to GDUnit#939
CedNaru merged 12 commits into
masterfrom
rework/unit_tests

Conversation

@CedNaru

@CedNaru CedNaru commented Jun 21, 2026

Copy link
Copy Markdown
Member

No description provided.

@CedNaru
CedNaru requested a review from piiertho June 21, 2026 13:42
@CedNaru
CedNaru force-pushed the rework/unit_tests branch 4 times, most recently from cf4e99e to d1805f3 Compare June 22, 2026 12:17
CedNaru and others added 11 commits June 22, 2026 17:09
CI runs Godot without a display, so DisplayServer reports "headless"
and GdUnit aborts with exit code 103 (RETURN_ERROR_HEADLESS_NOT_SUPPORTED).
Pass GdUnit's --ignoreHeadlessMode flag so the test runner proceeds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Running tests from the exported build was broken two ways:

1. Export crash: with export_filter=all_resources the exporter loads
   gdUnit's @tool editor scenes (e.g. GdUnitInspector.tscn) and the editor
   then SIGSEGVs/SIGABRTs on shutdown (gdUnit #1151 / Godot cold-cache
   teardown bug). Fixed by excluding addons/gdUnit4/*.tscn from the three
   test export presets - this keeps every gdUnit .gd script (so preloads
   still compile) but stops the @tool scenes from being instantiated.

2. Editor-coupled runner: GdUnitCmdTool pulls in editor-only code
   (GdUnitCommandHandler -> EditorInterface) and hangs/fails inside an
   exported game. gdUnit's supported approach (issues #969/#973, discussion
   #650) is a minimal runner extending the decoupled GdUnitTestSessionRunner.

Adds test_runner/ (outside the addon so version upgrades don't clobber it):
ExportTestRunner.gd (discovers + runs tests, disposes gdUnit singletons in
quit() to avoid the same teardown crash), ExportTestMain.gd (SceneTree entry
point), and README.md explaining the rationale. runExportedGDTests now uses
this runner; runGDTests keeps GdUnitCmdTool for the editor run.

Verified locally: cold export exits cleanly and the exported run executes
all suites and passes with a clean shutdown.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The minimal export runner only returned an exit code. Attach
GdUnitConsoleTestReporter for per-test PASS/FAIL console output and point
report_base_path at <exported-executable-dir>/reports so the default session
hooks write results.xml (JUnit) + HTML reports into harness/tests/export/reports
- the directory the CI workflow uploads as the gdunit_reports_* artifact.

Verified locally: exported run prints per-test results, writes a JUnit XML
report (tests=111, failures=0) and HTML report, and exits 0 with clean shutdown.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@CedNaru
CedNaru force-pushed the rework/unit_tests branch from d1805f3 to f67b721 Compare June 22, 2026 15:46
Follow-up to the earlier export-test work, fixing the per-OS failures CI
surfaced:

- tests_macos: terminate the previously broken exclude_filter string (an
  unterminated quote made Godot swallow export_path -> "preset.5.options
  nonexistent"), and keep export_path as ./export/tests.dmg. The macOS workflow
  mounts that .dmg (hdiutil attach tests.dmg) and copies the .app out, so the
  export must produce a .dmg (an earlier attempt to switch to .app broke that
  workflow step).

- Windows: prepareHostExportTemplates ensured BOTH the debug and release host
  templates unconditionally, but each export job only downloads the template
  for its own target (debug for "dev tests", release for "release tests"),
  causing "Could not find Windows <target> export template". ensure now skips a
  template that isn't present instead of failing the prepare step; the export
  only needs the template matching its target.

- Linux: run the test executable under `stdbuf -oL -eL` so its stdout/stderr is
  line-buffered. Godot block-buffers when piped, so on a 30-min timeout the
  buffered tail (where the exported run actually stalls) was lost, leaving the
  log truncated at "Starting JVM ...". This surfaces the real progress/stall
  point in CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@CedNaru
CedNaru force-pushed the rework/unit_tests branch from f67b721 to c45009f Compare June 22, 2026 18:27
@CedNaru
CedNaru merged commit eee7f71 into master Jun 22, 2026
61 checks passed
@CedNaru
CedNaru deleted the rework/unit_tests branch June 22, 2026 19:42
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.

1 participant