Skip to content

xtask with Kompari#1019

Merged
spirali merged 6 commits intolinebender:mainfrom
spirali:kompari-xtask
Jun 19, 2025
Merged

xtask with Kompari#1019
spirali merged 6 commits intolinebender:mainfrom
spirali:kompari-xtask

Conversation

@spirali
Copy link
Contributor

@spirali spirali commented May 21, 2025

This PR adds xtask similar to linebender/parley#272 for Parley.
Because Vello has two types of tests: snapshots and comparisons (cpu vs. gpu),
xtask is divided to two subcommands:

cargo xtask snapshots ...
cargo xtask comparisons ...

The first one offers all Kompari's functionality (report, review, size-check, dead-snapshots detection).
The second one offers only report as others do not make sense.

Btw1: Current size check output:

image

Btw2: Current dead snapshots report (This may be broken as some tests are skipped on my machine)

/home/ada/projects/vello/vello_tests/current/big_bitmap.png
/home/ada/projects/vello/vello_tests/current/big_bitmap_apple.png
/home/ada/projects/vello/vello_tests/current/big_colr.png
/home/ada/projects/vello/vello_tests/current/bitmap_undef.png
/home/ada/projects/vello/vello_tests/current/blurred_rounded_rect.png
/home/ada/projects/vello/vello_tests/current/colr_undef.png
/home/ada/projects/vello/vello_tests/current/deep_blend.png
/home/ada/projects/vello/vello_tests/current/fill_types.png
/home/ada/projects/vello/vello_tests/current/funky_paths.png
/home/ada/projects/vello/vello_tests/current/gradient_extend.png
/home/ada/projects/vello/vello_tests/current/image_extend_modes_bilinear.png
/home/ada/projects/vello/vello_tests/current/image_extend_modes_nearest_neighbor.png
/home/ada/projects/vello/vello_tests/current/image_sampling.png
/home/ada/projects/vello/vello_tests/current/integer_translation.png
/home/ada/projects/vello/vello_tests/current/little_bitmap.png
/home/ada/projects/vello/vello_tests/current/little_colr.png
/home/ada/projects/vello/vello_tests/current/longpathdash_butt.png
/home/ada/projects/vello/vello_tests/current/many_clips.png
/home/ada/projects/vello/vello_tests/current/non_integer_translation.png
/home/ada/projects/vello/vello_tests/current/rounded_rectangle_watertight.png
/home/ada/projects/vello/vello_tests/current/scaled_hinted.png
/home/ada/projects/vello/vello_tests/current/simple_hinted.png
/home/ada/projects/vello/vello_tests/current/smoke/data_image_roundtrip.png
/home/ada/projects/vello/vello_tests/current/smoke/filled_circle.png
/home/ada/projects/vello/vello_tests/current/smoke/filled_square.png
/home/ada/projects/vello/vello_tests/current/smoke/two_emoji.png
/home/ada/projects/vello/vello_tests/current/splash.png
/home/ada/projects/vello/vello_tests/current/stroke_styles.png
/home/ada/projects/vello/vello_tests/current/stroke_styles_non_uniform.png
/home/ada/projects/vello/vello_tests/current/stroke_styles_skew.png
/home/ada/projects/vello/vello_tests/current/tricky_strokes.png

Copy link
Contributor

@ajakubowicz-canva ajakubowicz-canva left a comment

Choose a reason for hiding this comment

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

I am so excited for this. I need a bit of help before I can review this as I unfortunately was not able to locally test this.

It would be really awesome if this workflow could be referenced in the vello_tests README somewhere, and if appropriate in the vello_sparse_tests package. I was naively trying to change and break some tests but I couldn't figure out how to preview a diff.

My attempt:

  • Change a test within vello_tests.
  • Run cargo test
  • Run cargo xtask snapshots review
  • I probably messed up because I couldn't get a diff.

I also tried to change a test within vello_sparse_tests. I got:

---- basic::full_cover_1_cpu_f32 stdout ----

thread 'basic::full_cover_1_cpu_f32' panicked at sparse_strips/vello_sparse_tests/tests/util.rs:285:9:
test didnt match reference image
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- basic::full_cover_1_cpu_u8 stdout ----

thread 'basic::full_cover_1_cpu_u8' panicked at sparse_strips/vello_sparse_tests/tests/util.rs:285:9:
test didnt match reference image

---- basic::full_cover_1_hybrid stdout ----

thread 'basic::full_cover_1_hybrid' panicked at sparse_strips/vello_sparse_tests/tests/util.rs:285:9:
test didnt match reference image

These also didn't show up in Kompari. So excited for this!

@spirali
Copy link
Contributor Author

spirali commented May 24, 2025

Hi, thanks for feedback. I have fix it and slightly change the PR, so in the current version there are now snapshots-cpu and snapshots-gpu subcommand.

If you broke a Vello test and then run tests and then run cargo xtask snapshots-cpu review you should see something like this:
image

I was not aware of separate tests in sparse strips, so they are not included in this PR. I will look at it in the following work.

@ajakubowicz-canva
Copy link
Contributor

ajakubowicz-canva commented May 29, 2025

Would you be able to fix the clippy error in CI: cargo clippy --locked --target wasm32-unknown-unknown -- -D warnings on xtask and get CI passing? Thank you!

I think you'll need to add the "exclude xtask" as you did in the parley PR: https://github.com/linebender/parley/pull/272/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR158

@spirali spirali force-pushed the kompari-xtask branch 2 times, most recently from fa454ef to 3df6d92 Compare May 30, 2025 17:33
@spirali
Copy link
Contributor Author

spirali commented May 30, 2025

Would you be able to fix the clippy error in CI: cargo clippy --locked --target wasm32-unknown-unknown -- -D warnings on xtask and get CI passing? Thank you!

I think you'll need to add the "exclude xtask" as you did in the parley PR: https://github.com/linebender/parley/pull/272/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR158

Fixed. Sorry for delay.

Copy link
Contributor

@ajakubowicz-canva ajakubowicz-canva left a comment

Choose a reason for hiding this comment

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

This LGTM!

I'm a new maintainer to the repository and this PR mainly adds functionality for vello tests. I'm more familiar with vello_hybrid; so going to ask if someone else can take a look and provide final LGTM. Maybe @tomcur who looked at linebender/parley#272

I played around with the commands and also changed some values in vello to break things. The xtask commands work nice!

@@ -0,0 +1,113 @@
// Copyright 2024 the Vello Authors
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: year is 2025

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.

Looks really good. A few details I'd like to see changed, but looking forward to seeing this land

xtask/Cargo.toml Outdated
[dependencies]
kompari = { git = "https://github.com/linebender/kompari.git", rev = "4b851413e1b17307064aa48c50e59d7e29656543" }
kompari-tasks = { git = "https://github.com/linebender/kompari.git", rev = "4b851413e1b17307064aa48c50e59d7e29656543" }
clap = { version = "4", features = ["derive"] }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
clap = { version = "4", features = ["derive"] }
clap = { workspace = true, features = ["derive"] }

#[command(version, about, long_about = None)]
/// Top-level command line parser for xtask
pub struct Cli {
/// Command
Copy link
Member

Choose a reason for hiding this comment

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

These should have more descriptive comments, or nothing at all.

Suggested change
/// Command
/// The possible commands in this CLI.
/// This enables (future) global flags to be added to this struct

Comment on lines 54 to 55
Command::new(&cargo)
.arg("test")
Copy link
Member

Choose a reason for hiding this comment

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

We probably should make this use nextest. That makes this testing portable (in particular, openGL implementations run into segfaults if too many instances are opened at once).

Ideally, we'd have good instructions about install nextest (we shouldn't do it ourselves) printed, but cargo does that itself:

error: no such command: `nonexistant`

help: view all installed commands with `cargo --list`
help: find a package to install `nonexistant` with `cargo search cargo-nonexistant`

@spirali spirali added this pull request to the merge queue Jun 19, 2025
Merged via the queue into linebender:main with commit 0551526 Jun 19, 2025
17 checks passed
@spirali spirali deleted the kompari-xtask branch June 19, 2025 22:20
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.

3 participants