From 625bbfaeb5b64013022f86be358a20fc9727ea67 Mon Sep 17 00:00:00 2001 From: Ada Bohm Date: Wed, 21 May 2025 18:55:32 +0200 Subject: [PATCH 1/6] xtask with Kompari --- .cargo/config.toml | 1 + Cargo.lock | 533 +++++++++++++++++++++++++++++++++++- Cargo.toml | 1 + vello_tests/src/snapshot.rs | 9 + xtask/Cargo.toml | 19 ++ xtask/README.md | 18 ++ xtask/src/main.rs | 108 ++++++++ 7 files changed, 687 insertions(+), 2 deletions(-) create mode 100644 xtask/Cargo.toml create mode 100644 xtask/README.md create mode 100644 xtask/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index d787df211..bc3896139 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -6,3 +6,4 @@ run_wasm = "run --release --package run_wasm --" # Other crates use the alias run-wasm, even though crate names should use `_`s not `-`s # Allow this to be used run-wasm = "run_wasm" +xtask = "run --release --package xtask --" diff --git a/Cargo.lock b/Cargo.lock index 2eb0de4ec..8f9656c60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,15 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli 0.31.1", +] + [[package]] name = "adler2" version = "2.0.0" @@ -79,6 +88,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_log-sys" version = "0.3.2" @@ -215,6 +230,75 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "axum" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5" +dependencies = [ + "axum-core", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + [[package]] name = "base64" version = "0.22.1" @@ -389,6 +473,20 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + [[package]] name = "ciborium" version = "0.2.2" @@ -463,7 +561,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" dependencies = [ "termcolor", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -501,6 +599,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "console" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "unicode-width 0.2.0", + "windows-sys 0.59.0", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -730,6 +841,12 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + [[package]] name = "env_filter" version = "0.1.3" @@ -844,6 +961,12 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foldhash" version = "0.1.5" @@ -942,6 +1065,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + [[package]] name = "fsevent-sys" version = "4.1.0" @@ -957,6 +1089,15 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + [[package]] name = "futures-core" version = "0.3.31" @@ -974,6 +1115,24 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "gethostname" version = "0.4.3" @@ -1009,6 +1168,12 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + [[package]] name = "gl_generator" version = "0.14.0" @@ -1177,6 +1342,120 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9f1e950e0d9d1d3c47184416723cf29c0d1f93bd8cccf37e4beb6b44f31710" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_locid" version = "1.5.0" @@ -1240,6 +1519,19 @@ dependencies = [ "serde", ] +[[package]] +name = "indicatif" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width 0.2.0", + "web-time", +] + [[package]] name = "inotify" version = "0.11.0" @@ -1375,6 +1667,49 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" +[[package]] +name = "kompari" +version = "0.1.0" +source = "git+https://github.com/linebender/kompari.git?rev=4b851413e1b17307064aa48c50e59d7e29656543#4b851413e1b17307064aa48c50e59d7e29656543" +dependencies = [ + "image", + "log", + "oxipng", + "rayon", + "thiserror 2.0.12", + "walkdir", +] + +[[package]] +name = "kompari-html" +version = "0.1.0" +source = "git+https://github.com/linebender/kompari.git?rev=4b851413e1b17307064aa48c50e59d7e29656543#4b851413e1b17307064aa48c50e59d7e29656543" +dependencies = [ + "axum", + "base64", + "chrono", + "imagesize", + "kompari", + "maud", + "rayon", + "serde", + "tokio", +] + +[[package]] +name = "kompari-tasks" +version = "0.1.0" +source = "git+https://github.com/linebender/kompari.git?rev=4b851413e1b17307064aa48c50e59d7e29656543#4b851413e1b17307064aa48c50e59d7e29656543" +dependencies = [ + "clap", + "humansize", + "indicatif", + "kompari", + "kompari-html", + "rayon", + "termcolor", +] + [[package]] name = "kqueue" version = "1.1.1" @@ -1519,6 +1854,34 @@ dependencies = [ "libc", ] +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "maud" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8156733e27020ea5c684db5beac5d1d611e1272ab17901a49466294b84fc217e" +dependencies = [ + "itoa", + "maud_macros", +] + +[[package]] +name = "maud_macros" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7261b00f3952f617899bc012e3dbd56e4f0110a038175929fa5d18e5a19913ca" +dependencies = [ + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn", +] + [[package]] name = "memchr" version = "2.7.4" @@ -1549,6 +1912,12 @@ dependencies = [ "paste", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "minicov" version = "0.3.7" @@ -1727,6 +2096,12 @@ dependencies = [ "syn", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "nv-flip" version = "0.1.2" @@ -1995,6 +2370,15 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" @@ -2051,12 +2435,14 @@ checksum = "26c613f0f566526a647c7473f6a8556dbce22c91b13485ee4b4ec7ab648e4973" dependencies = [ "bitvec", "crossbeam-channel", + "filetime", "indexmap 2.9.0", "libdeflater", "log", "rayon", "rgb", "rustc-hash 2.1.1", + "zopfli", ] [[package]] @@ -2151,6 +2537,12 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.32" @@ -2239,6 +2631,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", +] + [[package]] name = "profiling" version = "1.0.16" @@ -2634,6 +3038,28 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fab13f937fa393d08645bf3a84bdfe86e296747b506ada67bb15f10f218b2a" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -2749,6 +3175,16 @@ dependencies = [ "serde", ] +[[package]] +name = "socket2" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "spirv" version = "0.3.0+sdk-1.3.268.0" @@ -2851,6 +3287,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + [[package]] name = "tap" version = "1.0.1" @@ -2988,6 +3430,32 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" +dependencies = [ + "backtrace", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "toml_datetime" version = "0.6.9" @@ -3005,6 +3473,34 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.41" @@ -3127,6 +3623,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.2.6" @@ -3386,7 +3888,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6481311b98508f4bc2d0abbfa5d42172e7a54b4b24d8f15e28b0dc650be0c59f" dependencies = [ "anyhow", - "gimli", + "gimli 0.26.2", "id-arena", "leb128", "log", @@ -3942,6 +4444,12 @@ dependencies = [ "syn", ] +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + [[package]] name = "windows-result" version = "0.2.0" @@ -4415,6 +4923,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" +[[package]] +name = "xtask" +version = "0.0.0" +dependencies = [ + "clap", + "kompari", + "kompari-tasks", +] + [[package]] name = "yazi" version = "0.2.1" @@ -4447,6 +4964,18 @@ dependencies = [ "syn", ] +[[package]] +name = "zopfli" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfc5ee405f504cd4984ecc6f14d02d55cfda60fa4b689434ef4102aae150cd7" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + [[package]] name = "zune-core" version = "0.4.12" diff --git a/Cargo.toml b/Cargo.toml index c2f2bc9e5..b43823fed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "vello_encoding", "vello_shaders", "vello_tests", + "xtask", "examples/headless", "examples/run_wasm", diff --git a/vello_tests/src/snapshot.rs b/vello_tests/src/snapshot.rs index c90940f5c..cfb6cebfa 100644 --- a/vello_tests/src/snapshot.rs +++ b/vello_tests/src/snapshot.rs @@ -187,6 +187,15 @@ pub fn snapshot_test_image( .join(¶ms.name) .with_extension("png"); + if env::var("VELLO_TEST_GENERATE_ALL").is_ok() { + write_png_to_file( + params, + &update_path, + &raw_rendered, + Some(directory.max_size_in_bytes()), + )?; + } + let expected_data = match image::open(&reference_path) { Ok(contents) => { let size = std::fs::metadata(&reference_path).map(|it| it.len())?; diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml new file mode 100644 index 000000000..840a9a188 --- /dev/null +++ b/xtask/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "xtask" +publish = false +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +description = "Dev tooling for Parley" +keywords = ["testing"] +categories = ["testing", "graphics"] + + +[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"] } + +[lints] +workspace = true diff --git a/xtask/README.md b/xtask/README.md new file mode 100644 index 000000000..f11f0e89e --- /dev/null +++ b/xtask/README.md @@ -0,0 +1,18 @@ +# Xtask dev utilities + +This package provides the following commands: + +## Snapshots + +```bash +cargo xtask snaphosts report # Creates report for snapshots +cargo xtask shapshots review # Interactive test blessing snapshots +cargo xtask shapshots dead-snaphosts # Detects dead snapshots +cargo xtask shapshots size-check # Size check for snapshots +``` + +## Comparisons + +```bash +cargo xtask comparisons report # Creates report for comparisons +``` diff --git a/xtask/src/main.rs b/xtask/src/main.rs new file mode 100644 index 000000000..8afea1466 --- /dev/null +++ b/xtask/src/main.rs @@ -0,0 +1,108 @@ +// Copyright 2025 the Parley Authors +// SPDX-License-Identifier: Apache-2.0 OR MIT + +//! Xtask utilities for Vello, currently only integrates Kompari + +use clap::Parser; +use kompari::DirDiffConfig; +use kompari_tasks::args::{Command as KompariCommand, ReportArgs}; +use kompari_tasks::{Actions, Args, Task}; +use std::path::Path; +use std::process::Command; + +struct ActionsImpl(); + +#[derive(Parser, Debug)] +#[command(version, about, long_about = None)] +/// Top-level command line parser for xtask +pub struct Cli { + /// Command + #[clap(subcommand)] + pub command: CliCommand, +} + +#[derive(Parser, Debug)] +/// Top-level xtask command +pub enum CliCommand { + /// Commands related to snapshots (current vs. reference) + Snapshots(Args), + /// Commands related to comparisons (cpu vs. gpu) + Comparisons(ComparisonsArgs), +} + +#[derive(Parser, Debug)] +/// CLI parser for comparisons +pub struct ComparisonsArgs { + /// Command + #[clap(subcommand)] + pub command: ComparisonsCommand, +} + +#[derive(Parser, Debug)] +/// Command for comparisons, +/// because only report command makes, we do not reuse `kompari_tasks::Args` +pub enum ComparisonsCommand { + /// Create report with differences between cpu/gpu versions + Report(ReportArgs), +} + +impl Actions for ActionsImpl { + fn generate_all_tests(&self) -> kompari::Result<()> { + let cargo = std::env::var("CARGO").unwrap(); + Command::new(&cargo) + .arg("test") + .env("VELLO_TEST_GENERATE_ALL", "1") + .status()?; + Ok(()) + } +} + +fn snapshots_command(args: Args) -> kompari::Result<()> { + let tests_path = Path::new(env!("CARGO_MANIFEST_DIR")) + .parent() + .unwrap() + .join("vello_tests"); + + let snapshots_path = tests_path.join("snapshots"); + let current_path = tests_path.join("current"); + + let mut diff_config = DirDiffConfig::new(snapshots_path, current_path); + diff_config.set_ignore_right_missing(true); + let actions = ActionsImpl(); + let mut task = Task::new(diff_config, Box::new(actions)); + task.run(&args)?; + Ok(()) +} + +fn comparisons_command(args: ComparisonsArgs) -> kompari::Result<()> { + let tests_path = Path::new(env!("CARGO_MANIFEST_DIR")) + .parent() + .unwrap() + .join("vello_tests") + .join("comparisons"); + + let cpu_path = tests_path.join("cpu"); + let gpu_path = tests_path.join("gpu"); + + let diff_config = DirDiffConfig::new(cpu_path, gpu_path); + let actions = ActionsImpl(); + let mut task = Task::new(diff_config, Box::new(actions)); + task.report_config().set_left_title("cpu"); + task.report_config().set_right_title("gpu"); + match args.command { + ComparisonsCommand::Report(args) => { + task.run(&Args { + command: KompariCommand::Report(args), + })?; + } + } + Ok(()) +} + +fn main() -> kompari::Result<()> { + let args = Cli::parse(); + match args.command { + CliCommand::Snapshots(args) => snapshots_command(args), + CliCommand::Comparisons(args) => comparisons_command(args), + } +} From 6cc08196f4db14a5486db9c298f700206d6f4e89 Mon Sep 17 00:00:00 2001 From: Ada Bohm Date: Sat, 24 May 2025 10:10:35 +0200 Subject: [PATCH 2/6] Code review fixes --- xtask/Cargo.toml | 2 +- xtask/src/main.rs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 840a9a188..7b3cdaf07 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -5,7 +5,7 @@ edition.workspace = true rust-version.workspace = true license.workspace = true repository.workspace = true -description = "Dev tooling for Parley" +description = "Dev tooling for Vello" keywords = ["testing"] categories = ["testing", "graphics"] diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 8afea1466..4072aeb99 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -25,7 +25,9 @@ pub struct Cli { /// Top-level xtask command pub enum CliCommand { /// Commands related to snapshots (current vs. reference) - Snapshots(Args), + SnapshotsCpu(Args), + /// Commands related to snapshots (current vs. reference) + SnapshotsGpu(Args), /// Commands related to comparisons (cpu vs. gpu) Comparisons(ComparisonsArgs), } @@ -40,7 +42,7 @@ pub struct ComparisonsArgs { #[derive(Parser, Debug)] /// Command for comparisons, -/// because only report command makes, we do not reuse `kompari_tasks::Args` +/// in comparisons there is no ground truth images, so no other command then "report" makes sense. pub enum ComparisonsCommand { /// Create report with differences between cpu/gpu versions Report(ReportArgs), @@ -57,14 +59,14 @@ impl Actions for ActionsImpl { } } -fn snapshots_command(args: Args) -> kompari::Result<()> { +fn snapshots_command(dir: &str, args: Args) -> kompari::Result<()> { let tests_path = Path::new(env!("CARGO_MANIFEST_DIR")) .parent() .unwrap() .join("vello_tests"); let snapshots_path = tests_path.join("snapshots"); - let current_path = tests_path.join("current"); + let current_path = tests_path.join("current").join(dir); let mut diff_config = DirDiffConfig::new(snapshots_path, current_path); diff_config.set_ignore_right_missing(true); @@ -82,7 +84,9 @@ fn comparisons_command(args: ComparisonsArgs) -> kompari::Result<()> { .join("comparisons"); let cpu_path = tests_path.join("cpu"); + std::fs::create_dir_all(&cpu_path)?; let gpu_path = tests_path.join("gpu"); + std::fs::create_dir_all(&gpu_path)?; let diff_config = DirDiffConfig::new(cpu_path, gpu_path); let actions = ActionsImpl(); @@ -102,7 +106,8 @@ fn comparisons_command(args: ComparisonsArgs) -> kompari::Result<()> { fn main() -> kompari::Result<()> { let args = Cli::parse(); match args.command { - CliCommand::Snapshots(args) => snapshots_command(args), + CliCommand::SnapshotsCpu(args) => snapshots_command("cpu", args), + CliCommand::SnapshotsGpu(args) => snapshots_command("gpu", args), CliCommand::Comparisons(args) => comparisons_command(args), } } From 143ce36968f296828e8c87e94133c7bb0ccbc123 Mon Sep 17 00:00:00 2001 From: Ada Bohm Date: Sat, 24 May 2025 10:14:28 +0200 Subject: [PATCH 3/6] Docs updated --- xtask/README.md | 15 +++++++++++---- xtask/src/main.rs | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/xtask/README.md b/xtask/README.md index f11f0e89e..ad4b89e4d 100644 --- a/xtask/README.md +++ b/xtask/README.md @@ -5,12 +5,19 @@ This package provides the following commands: ## Snapshots ```bash -cargo xtask snaphosts report # Creates report for snapshots -cargo xtask shapshots review # Interactive test blessing snapshots -cargo xtask shapshots dead-snaphosts # Detects dead snapshots -cargo xtask shapshots size-check # Size check for snapshots +cargo xtask snaphosts-cpu report # Creates report for snapshots +cargo xtask shapshots-cpu review # Interactive test blessing snapshots +cargo xtask shapshots-cpu dead-snaphosts # Detects dead snapshots +cargo xtask shapshots-cpu size-check # Size check for snapshots ``` +The same works for `snapshots-gpu` + +```bash +cargo xtask snaphosts-gpu ... +``` + + ## Comparisons ```bash diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 4072aeb99..42c16b48f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,4 +1,4 @@ -// Copyright 2025 the Parley Authors +// Copyright 2024 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT //! Xtask utilities for Vello, currently only integrates Kompari From 08610349ed9d17a38170aee14e6c112e01819d2c Mon Sep 17 00:00:00 2001 From: Ada Bohm Date: Thu, 12 Jun 2025 17:52:02 +0200 Subject: [PATCH 4/6] Code review fixes --- xtask/Cargo.toml | 2 +- xtask/src/main.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 7b3cdaf07..8f2b48319 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -13,7 +13,7 @@ categories = ["testing", "graphics"] [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"] } +clap = { workspace = true, features = ["derive"] } [lints] workspace = true diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 42c16b48f..42828af6e 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -16,7 +16,8 @@ struct ActionsImpl(); #[command(version, about, long_about = None)] /// Top-level command line parser for xtask pub struct Cli { - /// Command + /// The possible commands in this CLI. + /// This enables (future) global flags to be added to this struct #[clap(subcommand)] pub command: CliCommand, } @@ -52,7 +53,8 @@ impl Actions for ActionsImpl { fn generate_all_tests(&self) -> kompari::Result<()> { let cargo = std::env::var("CARGO").unwrap(); Command::new(&cargo) - .arg("test") + .arg("nextest") + .arg("run") .env("VELLO_TEST_GENERATE_ALL", "1") .status()?; Ok(()) From ed9a4a48715140a6f6bcf33217dbb5fccc5cef0d Mon Sep 17 00:00:00 2001 From: Ada Bohm Date: Thu, 19 Jun 2025 16:46:14 +0200 Subject: [PATCH 5/6] Fixex typos --- xtask/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xtask/README.md b/xtask/README.md index ad4b89e4d..33cb190ac 100644 --- a/xtask/README.md +++ b/xtask/README.md @@ -6,9 +6,9 @@ This package provides the following commands: ```bash cargo xtask snaphosts-cpu report # Creates report for snapshots -cargo xtask shapshots-cpu review # Interactive test blessing snapshots -cargo xtask shapshots-cpu dead-snaphosts # Detects dead snapshots -cargo xtask shapshots-cpu size-check # Size check for snapshots +cargo xtask snapshots-cpu review # Interactive test blessing snapshots +cargo xtask snapshots-cpu dead-snaphosts # Detects dead snapshots +cargo xtask snapshots-cpu size-check # Size check for snapshots ``` The same works for `snapshots-gpu` From badb6ddfd427c9736eabd85e4b2d383a6c156110 Mon Sep 17 00:00:00 2001 From: Ada Bohm Date: Thu, 19 Jun 2025 16:55:30 +0200 Subject: [PATCH 6/6] Fixed wasm ci for xtask --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04f612b9b..e44fd0f91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ env: FEATURES_DEPENDING_ON_STD: "std,default,png,pico_svg,multithreading" # List of packages that can not target Wasm. # `vello_tests` uses `nv-flip`, which doesn't support Wasm. - NO_WASM_PKGS: "--exclude vello_tests" + NO_WASM_PKGS: "--exclude vello_tests --exclude xtask" # The files stored in LFS the tests need to access, in JSON format LFS_FILES: '["vello_tests/snapshots/*.png", "sparse_strips/vello_sparse_tests/snapshots/*.png"]'