2.1 KiB
2.1 KiB
UI & Output Tests
When updating UI test files (tests/ui-* or zerocopy-derive/tests/ui-*) or
functionality which could affect compiler error output or derive output, run:
./tools/update-expected-test-output.sh.
Note: We maintain separate UI tests for different toolchains (ui-msrv,
ui-stable, ui-nightly) because compiler output varies. The script handles
this automatically.
Symlink Pattern
To share test code across toolchains while allowing for different error output, we use a symlink pattern:
- Canonical Source: The
ui-nightlydirectory holds the actual source files (.rs). - Symlinks: The
ui-stableandui-msrvdirectories contain symlinks to the.rsfiles inui-nightly.- Example:
tests/ui-stable/foo.rs->../ui-nightly/foo.rs
- Example:
- Unique Output: Each directory contains its own
.stderrfiles.
Workflow Rules
- Adding a Test:
- Create the
.rsfile inui-nightly. - Create relative symlinks in
ui-stableandui-msrvpointing to the new file inui-nightly. - Run
./tools/update-expected-test-output.shto generate the.stderrfiles.
- Create the
- Modifying a Test:
- Edit the
.rsfile inui-nightly. - Run
./tools/update-expected-test-output.shto update the.stderrfiles.
- Edit the
- Removing a Test:
- Delete the
.rsfile fromui-nightly. - Delete the symlinks from
ui-stableandui-msrv. - Delete the corresponding
.stderrfiles from all three directories.
- Delete the
NEVER edit .stderr files directly. Only update them via the script or the
commands it runs. If a .stderr file is causing a test failure and updating it
via tooling does not fix the failure, that indicates a bug.