Skip to content

test: Check for device loss#9477

Open
andyleiserson wants to merge 1 commit intogfx-rs:trunkfrom
andyleiserson:jj-push-sxzq
Open

test: Check for device loss#9477
andyleiserson wants to merge 1 commit intogfx-rs:trunkfrom
andyleiserson:jj-push-sxzq

Conversation

@andyleiserson
Copy link
Copy Markdown
Contributor

This does two things:

  1. Installs a panicking device loss handler when running GPU tests.
  2. Allows expect-failure cases looking for an "unexpected" driver error to match even when internal_error_panic is off.

Normally, cargo xtask test runs with --all-features, enabling internal_error_panic, which always panics immediately on an unexpected driver error. To avoid confusion if running tests without that feature, also match such errors when the feature is disabled and they manifest as device loss.

Tests should fail anyways if the device is lost, because polling the device will return an error. But in expect-fail cases where the harness is looking for a particular failure behavior, not panicking immediately means the test may throw other errors that do not directly reflect the cause of the device loss. Panicking on device loss seems like a reasonable default behavior, even if in most cases it doesn't matter. Tests can set their own callback if they want different behavior.

Testing
Tested locally with expect-fail MoltenVK tests.

Squash or Rebase? Squash

Checklist

  • I self-reviewed and fully understand this PR.
  • WebGPU implementations built with wgpu may be affected behaviorally.
  • Validation and feature gates are in place to confine behavioral changes.
  • Tests demonstrate the validation and altered logic works.
  • CHANGELOG.md entries for the user-facing effects of this change are present.
  • The PR is minimal, and doesn't make sense to land as multiple PRs.
  • Commits are logically scoped and individually reviewable.
  • The PR description has enough context to understand the motivation and solution implemented.

This does two things:

1. Installs a panicking device loss handler when running GPU tests.
2. Allows expect-failure cases looking for an "unexpected" driver
   error to match even when `internal_error_panic` is off.

Normally, `cargo xtask test` runs with `--all-features`, enabling
`internal_error_panic`, which always panics immediately on an
unexpected driver error. To avoid confusion if running tests
without that feature, also match such errors when the feature is
disabled and they manifest as device loss.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant