Struct wgpu_test::FailureCase

source ·
pub struct FailureCase {
    pub backends: Option<Backends>,
    pub vendor: Option<u32>,
    pub adapter: Option<&'static str>,
    pub driver: Option<&'static str>,
    pub reasons: Vec<FailureReason>,
    pub behavior: FailureBehavior,
}
Expand description

Conditions under which a test should fail or be skipped.

By passing a FailureCase to TestParameters::expect_fail, you can mark a test as expected to fail under the indicated conditions. By passing it to TestParameters::skip, you can request that the test be skipped altogether.

If a field is None, then that field does not restrict matches. For example:

FailureCase {
    backends: Some(wgpu::Backends::DX12),
    vendor: None,
    adapter: Some("RTX"),
    driver: None,
    reasons: vec![FailureReason::validation_error().with_message("Some error substring")],
    behavior: FailureBehavior::AssertFailure,
}

This applies to all cards with "RTX' in their name on either Direct3D backend, no matter the vendor ID or driver name.

The strings given here need only appear as a substring in the corresponding AdapterInfo fields. The comparison is case-insensitive.

The default value of FailureCase applies to any test case. That is, there are no criteria to constrain the match.

Fields§

§backends: Option<Backends>

Backends expected to fail, or None for any backend.

If this is None, or if the test is using one of the backends in backends, then this FailureCase applies.

§vendor: Option<u32>

Vendor expected to fail, or None for any vendor.

If Some, this must match AdapterInfo::device, which is usually the PCI device id. Otherwise, this FailureCase applies regardless of vendor.

§adapter: Option<&'static str>

Name of adapter expected to fail, or None for any adapter name.

If this is Some(s) and s is a substring of AdapterInfo::name, then this FailureCase applies. If this is None, the adapter name isn’t considered.

§driver: Option<&'static str>

Name of driver expected to fail, or None for any driver name.

If this is Some(s) and s is a substring of AdapterInfo::driver, then this FailureCase applies. If this is None, the driver name isn’t considered.

§reasons: Vec<FailureReason>

Reason why the test is expected to fail.

If this does not match, the failure will not match this case.

If no reasons are pushed, will match any failure.

§behavior: FailureBehavior

Behavior after this case matches a failure.

Implementations§

source§

impl FailureCase

source

pub fn new() -> Self

Create a new failure case.

source

pub fn always() -> Self

This case applies to all tests.

source

pub fn never() -> Self

This case applies to no tests.

source

pub fn backend(backends: Backends) -> Self

Tests running on any of the given backends.

source

pub fn adapter(adapter: &'static str) -> Self

Tests running on adapter.

For this case to apply, the adapter string must appear as a substring of the adapter’s AdapterInfo::name. The comparison is case-insensitive.

source

pub fn backend_adapter(backends: Backends, adapter: &'static str) -> Self

Tests running on backend and adapter.

For this case to apply, the test must be using an adapter for one of the given backend bits, and adapter string must appear as a substring of the adapter’s AdapterInfo::name. The string comparison is case-insensitive.

source

pub fn webgl2() -> Self

Tests running under WebGL.

source

pub fn molten_vk() -> Self

Tests running on the MoltenVK Vulkan driver on macOS.

source

pub fn reasons(&self) -> &[FailureReason]

Return the reasons why this case should fail.

source

pub fn validation_error(self, msg: &'static str) -> Self

Matches this failure case against the given validation error substring.

Substrings are matched case-insensitively.

If multiple reasons are pushed, will match any of them.

source

pub fn panic(self, msg: &'static str) -> Self

Matches this failure case against the given panic substring.

Substrings are matched case-insensitively.

If multiple reasons are pushed, will match any of them.

source

pub fn flaky(self) -> Self

Test is flaky with the given configuration. Do not assert failure.

Use this very sparyingly, and match as tightly as you can, including giving a specific failure message.

Trait Implementations§

source§

impl Clone for FailureCase

source§

fn clone(&self) -> FailureCase

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for FailureCase

source§

fn default() -> FailureCase

Returns the “default value” for a type. Read more

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,