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: FailureBehaviorBehavior after this case matches a failure.
Implementations§
Source§impl FailureCase
impl FailureCase
Sourcepub fn adapter(adapter: &'static str) -> Self
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.
Sourcepub fn backend_adapter(backends: Backends, adapter: &'static str) -> Self
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.
Sourcepub fn reasons(&self) -> &[FailureReason]
pub fn reasons(&self) -> &[FailureReason]
Return the reasons why this case should fail.
Sourcepub fn validation_error(self, msg: &'static str) -> Self
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.
Sourcepub fn panic(self, msg: &'static str) -> Self
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.
Sourcepub fn flaky(self) -> Self
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.
Sourcepub(crate) fn applies_to_adapter(
&self,
info: &AdapterInfo,
) -> Option<FailureApplicationReasons>
pub(crate) fn applies_to_adapter( &self, info: &AdapterInfo, ) -> Option<FailureApplicationReasons>
Test whether self applies to info.
If it does, return a FailureReasons whose set bits indicate
why. If it doesn’t, return None.
The caller is responsible for converting the string-valued
fields of info to lower case, to ensure case-insensitive
matching.
Sourcepub(crate) fn matches_failure(&self, failure: &FailureResult) -> bool
pub(crate) fn matches_failure(&self, failure: &FailureResult) -> bool
Returns true if the given failure “satisfies” this failure case.
Trait Implementations§
Source§impl Clone for FailureCase
impl Clone for FailureCase
Source§fn clone(&self) -> FailureCase
fn clone(&self) -> FailureCase
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more