pub struct TestState {Show 13 fields
pub caps: u32,
pub vars: HashMap<String, String>,
pub exported: HashSet<String>,
pub cwd: PathBuf,
pub stdout: Vec<u8>,
pub stderr: Vec<u8>,
pub files: HashMap<PathBuf, Vec<u8>>,
pub sandbox_root: Option<PathBuf>,
pub allow_exec: Vec<CommandPattern>,
pub exec_log: Vec<ExecRecord>,
pub set_log: Vec<(String, String)>,
pub export_log: Vec<(String, String)>,
pub write_log: Vec<(PathBuf, usize)>,
}Expand description
In-memory state behind every TestCtx host import. The runner constructs this from CLI flags or a scenario file, then reads it back after the guest call to format results / evaluate expectations.
Note: the in-memory write paths intentionally skip the validation
that the production host’s VarTable::set (and similar) performs
(readonly-var rejection, integer-attribute checks, etc.). Test
scenarios verifying those guard paths must run against the real
shell, not this harness.
Fields§
§caps: u32Granted capability bitmask. Same shape as HostContext.capabilities.
vars: HashMap<String, String>§exported: HashSet<String>§cwd: PathBuf§stdout: Vec<u8>§stderr: Vec<u8>§files: HashMap<PathBuf, Vec<u8>>Virtual filesystem contents (when sandbox_root is None).
sandbox_root: Option<PathBuf>If set, files:* host imports operate on the real FS scoped to
this canonicalised root. Otherwise they operate on files.
allow_exec: Vec<CommandPattern>commands:exec allowlist. Empty = all denied (PatternNotAllowed).
exec_log: Vec<ExecRecord>§set_log: Vec<(String, String)>(key, value) pairs the plugin wrote via variables::set during the current step. Reset by the scenario runner between steps.
export_log: Vec<(String, String)>§write_log: Vec<(PathBuf, usize)>(path, bytes-written) for each files::{write,append}-file call.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestState
impl RefUnwindSafe for TestState
impl Send for TestState
impl Sync for TestState
impl Unpin for TestState
impl UnsafeUnpin for TestState
impl UnwindSafe for TestState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more