PhotoCraft: An open-source, photo editor written by scratch in pure Rust
AF.3: put the Affinity fuzz targets and corpus back in CI
callmeBallocha8d7c6ef3fd8
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 31b8d8566..5baf73fb1 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -206,6 +206,8 @@ jobs:- { crate: codecs, name: decode_tiff }- { crate: codecs, name: decode_exr }- { crate: codecs, name: decode_heif }+ - { crate: affinity, name: preview }+ - { crate: affinity, name: import_preview, args: "--features io" }- { crate: format, name: load }steps:- uses: actions/checkout@v4@@ -217,7 +219,7 @@ jobs:run: cargo install cargo-fuzz --locked- name: Fuzzworking-directory: crates/${{ matrix.target.crate }}- run: cargo fuzz run ${{ matrix.target.name }} -- -max_total_time=${{ inputs.fuzz_seconds }}+ run: cargo fuzz run ${{ matrix.target.name }} ${{ matrix.target.args }} -- -max_total_time=${{ inputs.fuzz_seconds }}- name: Upload crash artifactsif: failure()uses: actions/upload-artifact@v4diff --git a/crates/affinity/README.md b/crates/affinity/README.mdindex 1929709e6..4b05a99dc 100644--- a/crates/affinity/README.md+++ b/crates/affinity/README.md@@ -114,11 +114,9 @@ The same reader is shared, as an independent copy, with VectorCraft's `vectorcra(CC0), at pinned commits, each checked against `xtask/affinity-corpus.sha256`. `tests/real_files.rs`parses them; `photocraft-io`'s `tests/affinity_corpus.rs` imports and flattens each one andcompares it with the thumbnail Affinity saved in it (mean difference 0–4.6 of 255, with a- ceiling per file). This corpus is opt-in on its own: `corpus --all` and CI don't fetch it, so- run `cargo xtask corpus --affinity`, then- `cargo test -p photocraft-io --release --features corpus-affinity --test affinity_corpus`.+ ceiling per file).* `fuzz/` has `cargo-fuzz` targets for the whole reader (`preview`), the object stream (`stream`)- and the I/O import (`import_preview`), run locally (they aren't in CI's fuzz matrix):+ and the I/O import (`import_preview`); CI's fuzz job runs `preview` and `import_preview`:```shcd crates/affinity/fuzzdiff --git a/crates/io/Cargo.toml b/crates/io/Cargo.tomlindex 66e4df6fb..763297d10 100644--- a/crates/io/Cargo.toml+++ b/crates/io/Cargo.toml@@ -12,9 +12,6 @@ workspace = true[features]# Real-file corpus tests (opt-in; `cargo xtask test-corpus`). Fail when the corpus is missing.corpus = []-# The Affinity corpus test (opt-in on its own: `cargo xtask corpus --affinity` fetches its files,-# which `--all` and CI leave out until they move to photocraft-corpus).-corpus-affinity = []# HEIC/HEIF decode (forwarded to photocraft-codecs; see its `heif` feature).heif = ["photocraft-codecs/heif"]diff --git a/crates/io/tests/affinity_corpus.rs b/crates/io/tests/affinity_corpus.rsindex cb541ba4c..e4cb2921b 100644--- a/crates/io/tests/affinity_corpus.rs+++ b/crates/io/tests/affinity_corpus.rs@@ -3,9 +3,7 @@//! Affinity rendered when saving it. Each file's mean difference from that thumbnail (0–255 per//! channel, both flattened on white, at the smaller of the two sizes) must stay under its ceiling,//! set just above the difference measured when the importer landed.-//!-//! Opt-in on its own (`--features corpus-affinity`): `corpus --all` and CI don't fetch these files.-#![cfg(feature = "corpus-affinity")]+#![cfg(feature = "corpus")]#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]use std::path::PathBuf;diff --git a/docs/development.md b/docs/development.mdindex c448daf99..519d1c9d5 100644--- a/docs/development.md+++ b/docs/development.md@@ -355,7 +355,7 @@ against committed **sha256 manifests**. All pins are in one place:| `corpus/psd-tools/` | the complete psd-tools test set (309 files) | psd-tools upstream (MIT) | `xtask/psd-tools-corpus.sha256` || `corpus/heif/` | 9 small HEIC/HEIF files (checkerboards, RGB strips, a grid-tiled photo with EXIF/XMP, each with Apple's decode as `.ref.png`; a 10-bit RGBA file with its source PNG), for the `heif` feature | heic-rs (MIT OR Apache-2.0) and pillow-heif (BSD-3-Clause) upstreams | `xtask/heif-corpus.sha256` || `corpus/exr/` | the 5 deep OpenEXR test images (scanline deep data with half colour and u32 ID channels; 2.3 MB), checked against the ID manifests of their upstream sidecars | OpenEXR upstream at v3.5.2 (BSD-3-Clause) | `xtask/exr-corpus.sha256` |-| `corpus/affinity/` | 21 public Affinity documents (four Affinity 3 `.af` files, `.afdesign` vector art, layer/shape/raster test files, a template with artboards), each holding Affinity's own render as its thumbnail | vector-art (CC0), AFDesignLoad, Jac21/Branding and AssetStoreTemplate (MIT) upstreams. Opt-in: fetched only by `corpus --affinity` (not `--all`, not CI) and tested with `--features corpus-affinity` | `xtask/affinity-corpus.sha256` |+| `corpus/affinity/` | 21 public Affinity documents (four Affinity 3 `.af` files, `.afdesign` vector art, layer/shape/raster test files, a template with artboards), each holding Affinity's own render as its thumbnail | vector-art (CC0), AFDesignLoad, Jac21/Branding and AssetStoreTemplate (MIT) upstreams | `xtask/affinity-corpus.sha256` || `corpus/pngsuite/` | PngSuite | schaik.com release archive (public domain) | (fixed archive) |```shdiff --git a/xtask/src/corpus.rs b/xtask/src/corpus.rsindex ec0cfacd6..6bae7a395 100644--- a/xtask/src/corpus.rs+++ b/xtask/src/corpus.rs@@ -116,7 +116,7 @@ fn list() {corpus/exr/ [{}] the deep OpenEXR test images (BSD-3-Clause), openexr@{}manifest xtask/exr-corpus.sha256. Fetch: --exrcorpus/affinity/ [{}] 21 public Affinity 1–3 documents (CC0, MIT): vector-art, AFDesignLoad,- Jac21/Branding, AssetStoreTemplate; manifest xtask/affinity-corpus.sha256. Fetch: --affinity (not --all)+ Jac21/Branding, AssetStoreTemplate; manifest xtask/affinity-corpus.sha256. Fetch: --affinitycorpus/pngsuite/ [{}] PngSuite (public domain), {PNGSUITE_URL}. Fetch: --pngsuitecorpus/tiff/, corpus/raw/ optional, copied in by handdiff --git a/xtask/src/corpus_pins.rs b/xtask/src/corpus_pins.rsindex 393ff6183..8e12c6919 100644--- a/xtask/src/corpus_pins.rs+++ b/xtask/src/corpus_pins.rs@@ -225,6 +225,5 @@ pub const AFFINITY: PinnedCorpus = PinnedCorpus {},};-/// Every pinned corpus `--all` fetches (and CI downloads), in fetch order. [`AFFINITY`] is-/// fetched only on request (`--affinity`) until its files move to photocraft-corpus.-pub const ALL: &[&PinnedCorpus] = &[&PSD_MIXED, &PSD_TOOLS, &PHOTOSHOP, &HEIF, &EXR];+/// Every pinned corpus, in fetch order.+pub const ALL: &[&PinnedCorpus] = &[&PSD_MIXED, &PSD_TOOLS, &PHOTOSHOP, &HEIF, &EXR, &AFFINITY];