-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Guide
abduznik edited this page Jul 15, 2026
·
8 revisions
Step-by-step walkthrough for testing libsavesync, based on the spec's suggested first test plan.
Implement Layers 1, 3, 4, 5 fully; implement Layer 2 with SV_MODE_DEFAULT only (no identity resolution, no manifest).
- Register a plain text file as a fake "save" using
sv_register()withSV_MODE_DEFAULT - Call
sv_save()— verify a new magazine entry is created - Call
sv_list_entries()— confirm entry count is 1 - Call
sv_read_entry()— verify metadata fields are populated correctly
- Call
sv_save()again without modifying the file - Verify dedup skipped — no new entry created (hash matches most recent)
- Modify the file content
- Call
sv_save()— verify a new entry is created (hash differs)
- Call
sv_save()withopts.force = trueon unchanged content - Verify a new entry is created despite identical hash
- Call
sv_pull_select()targeting an older entry - Verify atomic replace worked — file content matches the selected entry
- Verify the pull was conflict-checked (live file had changed)
- Push retention count low (e.g. 2) via
sv_update_register() - Call
sv_save()to trigger eviction - Confirm oldest entry was evicted and
evicted_idsin result is populated - Verify correct number of entries remain
Repeat Phase 1 with different save shapes:
-
SAVE_SHAPE_DIRECTORY— create a fake directory with multiple files - Multi-file container — validate shape handling before any real emulator format
Only after Phases 1-2 are solid:
- Implement one real
SV_MODE_STRATEGYcase (e.g. RetroArch single-file.srm) - Use Freegosy's existing logic as reference for path templates and identity methods
- Verify identity resolution works against real save files
- Implement a trivial "copy to another local folder" reference transport
- Test
sv_push_external()andsv_pull_external()with this transport - Verify the two-step model: pull_external → pull
This order validates the hardest-to-get-right parts first:
- Atomicity (temp file + rename)
- Conflict handling (report vs override)
- Retention (FIFO eviction)
- ABI shape (opaque structs, zero-default fields)
...all against zero-risk fake data, deferring emulator-specific complexity to last.
See also: Architecture-Overview | Layer-4-Local-Save-and-Pull | Layer-5-Retention-and-Rotation
libsavesync Wiki