Skip to main content

nextest_runner/record/
mod.rs

1// Copyright (c) The nextest Contributors
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Recording infrastructure for nextest runs.
5//!
6//! This module provides functionality to record test runs to disk for later inspection
7//! and replay. The recording captures test events, outputs, and metadata in a structured
8//! archive format.
9//!
10//! # Architecture
11//!
12//! The recording system consists of:
13//!
14//! - [`RunStore`]: Manages the directory where recordings are stored, handling locking
15//!   and the list of recorded runs.
16//! - [`RunRecorder`]: Writes a single run's data to disk, including metadata and events.
17//! - [`RecordReader`]: Reads a recorded run from disk for replay or inspection.
18//! - [`records_state_dir`]: Returns the platform-specific state directory for recordings.
19//!
20//! # Archive format
21//!
22//! Each run is stored in a directory named by its UUID, containing:
23//!
24//! - `store.zip`: A zstd-compressed archive containing metadata and test outputs.
25//! - `run.log.zst`: A zstd-compressed JSON Lines file of test events.
26
27mod chrome_trace;
28pub mod dicts;
29mod display;
30mod format;
31mod portable;
32mod reader;
33mod recorder;
34pub mod replay;
35mod rerun;
36mod retention;
37mod run_id_index;
38mod session;
39mod state_dir;
40mod store;
41mod summary;
42#[cfg(test)]
43mod test_helpers;
44mod tree;
45
46pub use chrome_trace::{ChromeTraceGroupBy, ChromeTraceMessageFormat, convert_to_chrome_trace};
47pub use display::{
48    DisplayPrunePlan, DisplayPruneResult, DisplayRecordedRunInfo, DisplayRecordedRunInfoDetailed,
49    DisplayRunList, RunListAlignment, Styles,
50};
51pub use format::{
52    BUILD_SCOPE_JSON_PATH, BuildKind, CARGO_METADATA_JSON_PATH, OutputDict,
53    PORTABLE_MANIFEST_FILE_NAME, PortableRecordingFormatVersion,
54    PortableRecordingVersionIncompatibility, RECORD_OPTS_JSON_PATH, RERUN_INFO_JSON_PATH,
55    RUN_LOG_FILE_NAME, RecordedBuildScope, RerunInfo, RerunRootInfo, RerunTestSuiteInfo,
56    RunsJsonFormatVersion, RunsJsonWritePermission, STDERR_DICT_PATH, STDOUT_DICT_PATH,
57    STORE_FORMAT_VERSION, STORE_ZIP_FILE_NAME, StoreFormatMajorVersion, StoreFormatMinorVersion,
58    StoreFormatVersion, StoreVersionIncompatibility, TEST_LIST_JSON_PATH, TooOldRecordingGuidance,
59    has_zip_extension,
60};
61pub use portable::{
62    ExtractOuterFileResult, PortableRecording, PortableRecordingResult, PortableRecordingRunLog,
63    PortableRecordingWriter, PortableStoreReader,
64};
65pub use reader::{RecordReader, RunLogEventIter, StoreReader};
66pub use recorder::{RunRecorder, StoreSizes};
67pub use replay::{
68    LoadOutput, ReplayContext, ReplayConversionError, ReplayHeader, ReplayReporter,
69    ReplayReporterBuilder,
70};
71pub use rerun::ComputedRerunInfo;
72pub use retention::{PruneKind, PrunePlan, PruneResult, RecordRetentionPolicy};
73pub use run_id_index::{RunIdIndex, RunIdOrRecordingSelector, RunIdSelector, ShortestRunIdPrefix};
74pub use session::{
75    RecordFinalizeResult, RecordFinalizeWarning, RecordSession, RecordSessionConfig,
76    RecordSessionSetup,
77};
78pub use state_dir::{NEXTEST_STATE_DIR_ENV, encode_workspace_path, records_state_dir};
79pub use store::{
80    CompletedRunStats, ComponentSizes, ExclusiveLockedRunStore, NonReplayableReason,
81    RecordedRunInfo, RecordedRunStatus, RecordedSizes, ReplayabilityStatus, ResolveRunIdResult,
82    RunFilesExist, RunStore, RunStoreSnapshot, SharedLockedRunStore, SnapshotWithReplayability,
83    StoreRunFiles, StoreRunsDir, StressCompletedRunStats,
84};
85pub use summary::{
86    CoreEventKind, OutputEventKind, OutputFileName, RecordOpts, StressConditionSummary,
87    StressIndexSummary, TestEventKindSummary, TestEventSummary, ZipStoreOutput,
88    ZipStoreOutputDescription,
89};