mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-02 18:13:39 +00:00
Integration: keep the ATN contract tests, drop the extra workflow (#7561)
The contract tests no longer compiled on main (AtnItem::dictionary is now Vec<u8>, so it is compared with b"Future event"), sat outside main's tests/it layout, and the new atn.yml added six legs (two macOS) to every PR against ci.yml's policy. Move the tests into tests/it so the existing CI runs them, drop atn.yml and docs/atn-testing.md, keep main's ci.yml and fuzz target, and note the committed fixtures in ATTRIBUTION.md. Co-authored-by: denstu473 <63150090+denstu473@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
//! Fuzz the `.atn` actions parser: any input must return `Ok` or `Err`, never panic, and
|
||||
//! anything that parses must survive writing, reparsing and stable canonical writing.
|
||||
//! anything that parses must survive a write and parse back equal.
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
#[path = "../../tests/common/atn_roundtrip.rs"]
|
||||
mod atn_roundtrip;
|
||||
use photocraft_psd::atn;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
atn_roundtrip::check(data);
|
||||
if let Ok(f) = atn::parse(data) {
|
||||
let bytes = atn::write(&f).expect("a parsed set is writable");
|
||||
let again = atn::parse(&bytes).expect("a written set parses");
|
||||
assert_eq!(again.actions, f.actions);
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ oracles.
|
||||
| `descriptors.atn` | 859 | Every descriptor value variant and every reference form currently represented by the parser | `6c76502822c1f36c8060a71adb227c4540663518785bbab1b70951dac0ef58ad` |
|
||||
| `float-bits.atn` | 428 | NaN payload, negative zero, infinities, and floats inside lists, objects and arrays | `0aa6278a569c777f249b305e889896132c2a87e44a24cb1a55d1d3fc0928fd0c` |
|
||||
|
||||
`tests/atn_contract.rs` checks the independently encoded bytes and expected public structures.
|
||||
The ATN fuzz job copies the same files into its seed corpus. A fixture change should explain
|
||||
`tests/it/atn_contract.rs` checks the independently encoded bytes and expected public structures.
|
||||
A fixture change should explain
|
||||
the changed wire fields and update this table; do not regenerate expectations merely to make a
|
||||
failing parser pass.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Portable public-API contract, executed natively in debug and release by ATN CI.
|
||||
//! Public-API contract for the `.atn` parser, against independently encoded wire fixtures.
|
||||
use photocraft_psd::PsdError;
|
||||
use photocraft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use photocraft_psd::descriptor::{Class, Descriptor, Id, MAX_DEPTH, ObjectArray, ReferenceItem, UnicodeString, Value};
|
||||
@@ -7,10 +7,10 @@ use photocraft_psd::descriptor::{Class, Descriptor, Id, MAX_DEPTH, ObjectArray,
|
||||
mod atn_roundtrip;
|
||||
|
||||
const FIXTURES: &[(&str, &[u8])] = &[
|
||||
("empty", include_bytes!("fixtures/atn/empty.atn")),
|
||||
("metadata", include_bytes!("fixtures/atn/metadata.atn")),
|
||||
("descriptors", include_bytes!("fixtures/atn/descriptors.atn")),
|
||||
("float bits", include_bytes!("fixtures/atn/float-bits.atn")),
|
||||
("empty", include_bytes!("../fixtures/atn/empty.atn")),
|
||||
("metadata", include_bytes!("../fixtures/atn/metadata.atn")),
|
||||
("descriptors", include_bytes!("../fixtures/atn/descriptors.atn")),
|
||||
("float bits", include_bytes!("../fixtures/atn/float-bits.atn")),
|
||||
];
|
||||
|
||||
fn file_with(desc: Descriptor) -> AtnFile {
|
||||
@@ -55,7 +55,7 @@ fn unicode_metadata_unknown_events_and_dialog_flags_are_preserved() {
|
||||
let future = &action.items[1];
|
||||
assert_eq!(future.event, AtnEvent::Name("syntheticFutureEvent".into()));
|
||||
assert_eq!((future.expanded, future.enabled, future.with_dialog, future.dialog_options), (false, false, true, 255));
|
||||
assert_eq!(future.dictionary, "Future event");
|
||||
assert_eq!(future.dictionary, b"Future event");
|
||||
assert!(future.descriptor.is_none());
|
||||
assert_eq!(file.actions[1].name, UnicodeString::new_nul("Empty"));
|
||||
assert!(file.actions[1].items.is_empty());
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//! Shared invariant for the parser contract suite and the actual cargo-fuzz target.
|
||||
//! Shared round-trip invariant for the `.atn` parser contract suite.
|
||||
use photocraft_psd::atn::{self, AtnFile};
|
||||
use photocraft_psd::descriptor::{Descriptor, Value};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! The crate's integration tests, linked into one test binary.
|
||||
|
||||
mod atn_contract;
|
||||
mod builder;
|
||||
mod corpus;
|
||||
mod corpus_atn;
|
||||
|
||||
Reference in New Issue
Block a user