Skip to content

[test do not merge] snapshot golden tests#1446

Draft
ludfjig wants to merge 2 commits into
hyperlight-dev:mainfrom
ludfjig:snapshot-golden-tests
Draft

[test do not merge] snapshot golden tests#1446
ludfjig wants to merge 2 commits into
hyperlight-dev:mainfrom
ludfjig:snapshot-golden-tests

Conversation

@ludfjig

@ludfjig ludfjig commented May 8, 2026

Copy link
Copy Markdown
Contributor

This PR adds tests to help notice breaking changes in the guest<->host ABI. This matters because any change there breaks every snapshot already persisted to disk (bad!).

  • persist a set of snapshots to GHCR, and on each PR pull them and run tests against them. Note that these snapshots are not expected to be regenerated often. I'm using GHCR instead of checking in raw binaries into repo to not clutter git repo (there might be a lot of them eventually), and also to exercise the "OCI-ness" of the snapshot format.
  • add compile-time tripwires that pin every value defining the format (SNAPSHOT_ABI_VERSION, the media-type strings, the OCI layout version, HyperlightPEB field offsets and size, and the OutBAction ports), helping develpers catch changes that would be breaking
  • add some additional regular tests for loading snapshots
  • make sure snapshots taken on AMD are usable on Intel, and vice versa
  • define and outline the development process for breaking snapshot compatibility (and regenerating new golden snapshtos)

When a change to the format is intentional, the author bumps the version and applies the regen-goldens label. A workflow then regenerates the goldens against the branch and pushes the new set to GHCR.

See docs/snapshot-versioning.md for details.

@ludfjig ludfjig added regen-goldens Regenerate snapshot golden fixtures and removed regen-goldens Regenerate snapshot golden fixtures labels May 8, 2026
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch 2 times, most recently from db6f7fb to b5a0b52 Compare June 8, 2026 23:34
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch 5 times, most recently from e8bcea9 to 0115ba2 Compare June 24, 2026 19:22
@ludfjig ludfjig added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Jun 24, 2026
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch 4 times, most recently from cc3dfd6 to 6ec0bbf Compare June 25, 2026 18:46
A guest exception handler runs on the IST1 stack. If the handler writes
a copy-on-write page, the first write faults. The page fault also uses
IST1, so the CPU resets RSP to the top of IST1 and writes the fault
frame over the live handler frame. The handler returns to a bad address
and the guest aborts.

The test exception handler increments a counter that starts on a
copy-on-write page. Write the counter once in install_handler so its
page copies into scratch before the handler runs. The handler then
increments a writable page and does not fault.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch from 6ec0bbf to 22a0cff Compare June 25, 2026 19:02
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch from 22a0cff to 0658445 Compare June 25, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. regen-goldens Regenerate snapshot golden fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant