Struct simics_test::TestEnv

source ·
pub struct TestEnv {
    pub(crate) test_base: PathBuf,
    pub(crate) test_dir: PathBuf,
    pub(crate) project_dir: PathBuf,
    pub(crate) simics_home_dir: PathBuf,
}
Expand description

A test environment, which is a directory that consists of a simics directory with a set of installed packages and a project directory, where test scripts and resources can be placed.

Fields§

§test_base: PathBuf

The base of the test environment, e.g. the CARGO_TARGET_TMPDIR directory

§test_dir: PathBuf

The subdirectory in the test environment for this test

§project_dir: PathBuf

The project subdirectory in the test environment for this test

§simics_home_dir: PathBuf

The simics home subdirectory in the test environment for this test

Implementations§

source§

impl TestEnv

source

pub fn default_simics_base_dir<P>(simics_home_dir: P) -> Result<PathBuf>
where P: AsRef<Path>,

Return a reference to the test base directory

source

pub fn simics_base_dir<S, P>(version: S, simics_home_dir: P) -> Result<PathBuf>
where P: AsRef<Path>, S: AsRef<str>,

Return a reference to the base directory specified by a version

source§

impl TestEnv

source

pub fn install_files<P>( project_dir: P, files: &Vec<(String, Vec<u8>)>, ) -> Result<()>
where P: AsRef<Path>,

Install a set of files into a project directory, with the files specified as relative paths inside the project directory and their raw contents

source

pub fn install_directories<P>( project_dir: P, directories: &Vec<PathBuf>, ) -> Result<()>
where P: AsRef<Path>,

Install a set of existing directories into a project, where each directory will be copied recursively into the project

source

pub(crate) fn build(spec: &TestEnvSpec) -> Result<Self>

source

pub fn cleanup(&mut self) -> Result<(), CommandExtError>

Clean up the test environment

source

pub fn cleanup_if_env(&mut self) -> Result<(), CommandExtError>

Clean up the test environment if the SIMICS_TEST_CLEANUP_EACH environment variable is set

source

pub fn test<S>(&mut self, script: S) -> Result<Output, CommandExtError>
where S: AsRef<str>,

Run a test in the environment in the form of a Simics script. To fail the test, either exit Simics with an error or check the output result.

source

pub fn test_python<S>(&mut self, script: S) -> Result<Output, CommandExtError>
where S: AsRef<str>,

Run a test in the environment in the form of a Simics script. To fail the test, either exit Simics with an error or check the output result.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more