icedwright_trace/lib.rs
1//! The icedwright trace format.
2//!
3//! A trace is a `.iwtrace` zip holding every step a test took:
4//!
5//! ```text
6//! meta.json format, test, crate, versions, windows, theme, scale, failure, frames dropped
7//! steps.jsonl one Step per line
8//! blobs/<hash>.yaml semantic trees, each stored once
9//! blobs/<hash>.png frames, each stored once
10//! source/<file> the test source files steps point at
11//! attachments/<name> files the test attached, such as a failure screenshot
12//! real.json real-clock timings, which comparisons skip
13//! ```
14//!
15//! [`TraceWriter`] takes plain values and writes the same bytes for the same steps on every
16//! run: instants are offsets from boot, ids are renumbered in order of first appearance, and
17//! the archive has fixed timestamps, member order and compression settings. When a trace would
18//! pass its size cap, frames are dropped in a fixed order; trees and steps never are.
19//! [`TraceReader`] reads it back, and [`compare`] finds where two traces first differ.
20
21#![forbid(unsafe_code)]
22#![deny(missing_docs)]
23
24mod archive;
25mod blob;
26mod budget;
27mod compare;
28mod config;
29mod error;
30mod ids;
31mod meta;
32mod normalise;
33mod reader;
34mod step;
35mod writer;
36
37pub use blob::{BadBlobHash, BlobHash, BlobRef, Media, Png, Yaml};
38pub use compare::{Difference, StepChange, StepDifference, compare};
39pub use config::{ByteSize, FramePolicy, TraceConfig, TraceMode};
40pub use error::TraceError;
41pub use ids::{
42 RawId, RawSubscriptionId, RawTaskId, RawWidgetId, RawWindowId, StepIndex, SubscriptionOrdinal,
43 TaskOrdinal, WidgetOrdinal, WindowOrdinal,
44};
45pub use meta::{FORMAT, TraceMeta, WindowMeta};
46pub use normalise::BootInstant;
47pub use reader::TraceReader;
48pub use step::{
49 Attempt, CanonicalSelector, Captured, LogLine, RealSpan, RealTiming, RealTimings, SelectorText,
50 SourceLocation, Step, StepKind, StepOutcome, TraceEvent, TraceMessage, TraceOrigin, TraceTask,
51 TraceTaskChange,
52};
53pub use writer::{StepBuilder, TraceStart, TraceWriter, WriteSummary, check_attachment_name};
54
55#[cfg(test)]
56mod tests;