Files
likang 678058c940
CI / Select checks (push) Has been cancelled
CI / Format and repository checks (push) Has been cancelled
CI / Compile RISC-V (manual) (push) Has been cancelled
Docker / image (push) Has been cancelled
Generated files / Regenerate and commit (push) Has been cancelled
Kernel rig / Select the rig areas (push) Has been cancelled
Lists / Design format changes merge cleanly (push) Has been cancelled
Lists / Lists are sorted one item per line (push) Has been cancelled
Packaging lint / lint (push) Has been cancelled
Pages / build (push) Has been cancelled
CI / Dependency advisories (push) Has been cancelled
CI / Quick compile (push) Has been cancelled
CI / Native Linux Clippy (push) Has been cancelled
CI / Build tests (push) Has been cancelled
CI / Native Linux tests (push) Has been cancelled
CI / GPU path tests (1/4) (push) Has been cancelled
CI / GPU path tests (2/4) (push) Has been cancelled
CI / GPU path tests (3/4) (push) Has been cancelled
CI / GPU path tests (4/4) (push) Has been cancelled
CI / Action matrix (1/16) (push) Has been cancelled
CI / Action matrix (10/16) (push) Has been cancelled
CI / Action matrix (11/16) (push) Has been cancelled
CI / Action matrix (12/16) (push) Has been cancelled
CI / Action matrix (13/16) (push) Has been cancelled
CI / Action matrix (14/16) (push) Has been cancelled
CI / Action matrix (15/16) (push) Has been cancelled
CI / Action matrix (16/16) (push) Has been cancelled
CI / Action matrix (2/16) (push) Has been cancelled
CI / Action matrix (3/16) (push) Has been cancelled
CI / Action matrix (4/16) (push) Has been cancelled
CI / Action matrix (5/16) (push) Has been cancelled
CI / Action matrix (6/16) (push) Has been cancelled
CI / Action matrix (7/16) (push) Has been cancelled
CI / Action matrix (8/16) (push) Has been cancelled
CI / Action matrix (9/16) (push) Has been cancelled
CI / Action matrix determinism (push) Has been cancelled
CI / Property tests (many cases) (push) Has been cancelled
CI / Doc tests (push) Has been cancelled
CI / Reference tests (push) Has been cancelled
CI / Windows D3D12 FXC shaders (push) Has been cancelled
CI / Windows app startup (push) Has been cancelled
CI / ci (push) Has been cancelled
CI / Compile WebAssembly (push) Has been cancelled
CI / Nightly alert (push) Has been cancelled
Kernel rig / Build the CLI (push) Has been cancelled
Kernel rig / Kernel rig (${{ matrix.shard }}) (push) Has been cancelled
Kernel rig / kernel-rig (push) Has been cancelled
Pages / deploy (push) Has been cancelled
优化skill
2026-11-16 11:32:34 +08:00

3.5 KiB

name, description
name description
makecad-tests Use when writing, placing or running tests in makeCAD: a regression test for a bug, an engine test for a command, a UI scenario, a reference (oracle) test, goldens, or when CI fails a test you did not touch.

Where tests go and how to run them

The long form is docs/book/src/dev/testing.md.

Placement

  • A regression test goes into its area's existing test file (booleans, blends, shell, STEP, naming, ...), never a new file named after the bug (#3226).
  • Engine tests sit next to the code or in *_tests.rs files, measured against a value you can derive.
  • UI scenarios are JSON in crates/ui-egui/tests/scenarios/*.json. Put {"pending": "why"} in a scenario that records a bug before it is fixed, and remove it in the fixing PR.
  • Reference tests are tests/oracle/<case>/recipe.json with an expected.json beside it, run by cargo xtask oracle, expected values in closed form (tools/oracle-analytic/) or from FreeCAD as a separate program (tools/freecad-oracle/). A known failure names its issue ("known_failure": "#123"). Never change an expected value to match makeCAD's output, and never take one from a commercial CAD product.
  • Crash fixes: a regression test from the report's design.sc and replay.json (skills/makecad-crash-safety/SKILL.md).

Unit test or rig case

  • Unit tests assert the code's logic: which edges a chain picks, name resolution, history labels, refusal wording, hostile input, parsing and saving (a_corner_round_wider_than_its_faces_overflows_and_takes_the_corners_other_edges: per-edge radii, which no command takes).
  • The rig asserts geometry (exact volumes, shapes, seams, refusals) with a hand-derived answer. A test doing both keeps only its logic. tests/kernel-cases/ only shrinks: kernel cases go to solidcore (CONTRIBUTING.md "Tests"); command, UI and product-rule cases stay here.

A failing test needs its fix

A failing test cannot merge without its fix (it turns main red): include it, or list the test and cause in tests/KNOWN_FAILING_TESTS (cargo xtask known-failing); the fix drops the line.

Running

  • cargo xtask test builds with the ci profile and runs every test binary at once; arguments after -- go to each binary (cargo xtask test -- shell). It builds several times faster than --release; a test failing only in a debug build: say so in the PR.
  • SOLIDCRAFT_TEST_JOBS=N bounds concurrent commands. cargo xtask ci is the gate before a commit (fmt, lints, clippy -D warnings, tests, wasm).
  • Tests run in their own processes: no shared state, no wall-clock timing.

Goldens, matrices and skipped tests

  • The kernel's reference is the ladder (tests/kernel-cases/ladder/, cargo xtask kernel-cases --ladder, docs/kernel-ladder.md).
  • Kernel PRs run kernel-rig.yml (areas by PATHS against KNOWN_FAILING, the ladder against its golden). In the same PR a fix drops its line, a pin bump's new failure adds one, a changed ladder result is re-recorded (--record "why"), a new command gets an EXEMPT line (tests/kernel-cases/README.md).
  • Maintainers' PRs run native, GPU and reference tests on affected packages; others wait for approved-for-ci. release-gate.yml runs all before develop replaces main.
  • The action matrix is a ratchet: bless a newly passing action (cargo xtask action-matrix --bless, docs/action-matrix.md).
  • PRs skip a few heavy tests, run in the merge queue, nightly and on main. Check them after merging (.config/nextest.toml).
  • Mutation testing: docs/mutation-testing.md.