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