1#![deny(missing_docs)]
2#[doc(hidden)]
8pub extern crate inventory;
9
10pub mod codegen;
11pub mod error;
12pub mod event;
13pub mod recording;
14pub mod registry;
15pub mod snapshot;
16pub mod types;
17pub mod verification;
18
19pub use codegen::{CodegenOptions, generate_test, generate_test_default};
20pub use error::VictauriError;
21pub use event::{AppEvent, EventLog, InteractionKind, IpcCall, IpcResult};
22pub use recording::{EventRecorder, RecordedEvent, RecordedSession, StateCheckpoint};
23pub use registry::{
24 CommandArg, CommandInfo, CommandInfoFactory, CommandRegistry, ScoredCommand,
25 auto_discovered_commands,
26};
27pub use snapshot::{DomElement, DomSnapshot, WindowState};
28pub use types::{Divergence, DivergenceSeverity, MemoryDelta, RefHandle, VerificationResult};
29pub use verification::{
30 AssertionCondition, AssertionResult, GhostCommand, GhostCommandReport, GhostSource,
31 IpcIntegrityReport, SemanticAssertion, check_ipc_integrity, detect_ghost_commands,
32 evaluate_assertion, verify_state,
33};
34
35pub fn acquire_lock<'a, T>(
40 mutex: &'a std::sync::Mutex<T>,
41 context: &str,
42) -> std::sync::MutexGuard<'a, T> {
43 mutex.lock().unwrap_or_else(|poisoned| {
44 tracing::error!("{context}: mutex was poisoned, recovering");
45 poisoned.into_inner()
46 })
47}
48
49pub fn acquire_read<'a, T>(
51 lock: &'a std::sync::RwLock<T>,
52 context: &str,
53) -> std::sync::RwLockReadGuard<'a, T> {
54 lock.read().unwrap_or_else(|poisoned| {
55 tracing::error!("{context}: RwLock was poisoned, recovering with read guard");
56 poisoned.into_inner()
57 })
58}
59
60pub fn acquire_write<'a, T>(
62 lock: &'a std::sync::RwLock<T>,
63 context: &str,
64) -> std::sync::RwLockWriteGuard<'a, T> {
65 lock.write().unwrap_or_else(|poisoned| {
66 tracing::error!("{context}: RwLock was poisoned, recovering with write guard");
67 poisoned.into_inner()
68 })
69}