Skip to content

Conversation

@spirali
Copy link
Contributor

@spirali spirali commented Apr 3, 2025

Refactor Snapshot and Generated Image Handling

This pull request changes how snapshots and currently generated images are handled in tests.

  1. It moves smoke_snapshots to snapshots/smoke and original snapshots to snapshots/lfs.

  2. Instead of generating images into the same directory as snapshots, it generates images into a separate directory current.

  3. In comparison tests, it generates CPU/GPU tests in separate directories.

Example (Snapshot Tests)

Original layout:

  • smoke_snapshots/xxx.png (reference)
  • smoke_snapshots/xxx.cpu.png (CPU generated)
  • smoke_snapshots/xxx.gpu.png (GPU generated)

New layout:

  • snapshots/smoke/xxx.png (reference)
  • current/cpu/smoke/xxx.png (CPU generated)
  • current/gpu/smoke/xxx.png (GPU generated)

Example (Comparison Tests)

Original layout:

  • comparison/xxx.cpu.png
  • comparison/xxx.gpu.png

New layout:

  • comparison/cpu/xxx.png
  • comparison/gpu/xxx.png

Why?

The important property of this change is that files to be compared have the same filenames in the same nested directory structure. This allows for simple directory-to-directory comparisons for all tests at once. For example, current/cpu vs snapshots, or comparison/cpu vs comparison/gpu.

This is a preparatory step for full Kompari integration. However, this layout allows immediate use of kompari-cli to generate diff reports.

Note: This PR lefts debug_outputs as it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this file is now unnecessary

SnapshotDirectory::Smoke => "smoke_snapshots",
SnapshotDirectory::Lfs => "snapshots",
SnapshotDirectory::Smoke => "smoke",
SnapshotDirectory::Lfs => "lfs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would like to have vello_tests/snapshots be LFS files by default, and then have vello_tests/snapshots/smoke for the smoke tests. This matches our existing LFS setup, so no config changes are needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this

@spirali spirali force-pushed the test_dirs branch 2 times, most recently from 945fc2b to 32da0ba Compare April 5, 2025 06:41
@DJMcNab
Copy link
Member

DJMcNab commented Apr 5, 2025

I'll review on Monday. Just a passing thought that the main we thing we need to be sure of is that a oversized.png never ends up in the snapshots directory.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, except for the one thing about oversized images. However, two things are in our favour there:

  1. The test will never succeed if it generates an oversized file.
  2. The snapshot sizes are still checked on CI

I think the quickest course of action to resolve is to just re-add *.oversized.png to the snapshots/gitignore.

Edit: Sorry my timeline for reviewing was slightly off

@spirali spirali added this pull request to the merge queue Apr 14, 2025
Merged via the queue into linebender:main with commit 36a3e49 Apr 14, 2025
17 checks passed
@spirali spirali deleted the test_dirs branch April 14, 2025 09:31
github-merge-queue bot pushed a commit that referenced this pull request May 21, 2025
This should have been changes in #892.

I'm not overly happy with the difference between `vello_tests/current`
and `vello_sparse_tests/diffs`, but that isn't for this PR to solve.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants