Files
OrcaSlicer/tests
Hanif Koh a54b0493ce Keep the Sweep Out of the Write Helper and Honour a Read-Only Target
Sweeping the target's directory from inside write_file_atomically() made
every settings export into a user's folder delete their own numbered
files that matched the older config temporary form, and cost a directory
walk per save. The helper writes its target and nothing else; the user
preset scan, the bundle metadata reads and AppConfig::load() sweep the
directories the application owns, once, while they hold the lock.

Replacing a file needs only a writable directory, so a preset or config
the user made read-only was overwritten where the in-place write used to
fail; such a target is refused before anything is written. The CLI's
load_if_exists() takes no lock and creates no lock file, since the CLI
never saves. The lock guard holds the slot mutex through a unique_lock,
so an exception during construction cannot leave the slot locked for
good, and it counts its entry last so a throw leaves the slot as found;
the cool-down after a failed open is set where the failure is seen.

The cloud agent's sync state and secret fallback file and the 3DPrinterOS
session file wrote through a fixed ".tmp" name with a non-Unicode stream;
they call the helper. The vendor cache failure test makes the cache
read-only, which the helper refuses on every platform, and the utility
tests carry the PascalCase tag the test rules ask for.
2026-09-24 19:40:26 +08:00
..
2025-12-08 22:42:11 +08:00

OrcaSlicer tests

Building, running and writing tests is documented on the wiki, under How to Test.

Two files here rather than there, because coding agents only read what is in the repository:

  • AGENTS.md is the same guidance in short form, and is what an agent working under tests/ picks up.
  • CATCH2.md is the Catch2 reference, including the mistakes that break a test at runtime.