Skip to content

Commit

Permalink
misc: suppress more GPU related warnings
Browse files Browse the repository at this point in the history
Closes Mesa/GLX related warnings shown when running Cypress #29521

### Additional details

The primary Cypress process can emit benign warnings related to Mesa/GLX when running in certain Linux environments or containers. These warnings are related to graphics drivers and X11 display settings, but are not necessary for Cypress to execute correctly. This PR suppresses these warnings from stdout, similar to other benign Electron warnings:

- `error: XDG_RUNTIME_DIR is invalid or not set in the environment.`
- `MESA: error: ZINK: failed to choose pdev`
- `glx: failed to create drisw screen`

### Steps to test

1. Execute Cypress tests in run mode on a Linux machine or container with minimal graphics drivers installed
2. Execute Cypress tests in run mode in a Docker container using a basic Linux image (e.g. ubuntu:latest)
3. Verify the suppressed warnings no longer appear in the terminal output

### How has the user experience changed?

Users will no longer see benign graphics-related warnings in their terminal output when running Cypress in Linux environments with minimal graphics support. This reduces noise in the terminal output while not affecting any actual test functionality.

### PR Tasks

- [x] Have tests been added/updated?
- [NA] Has a PR for user-facing changes been opened in cypress-documentation?
- [NA] Have API changes been updated in the type definitions?
  • Loading branch information
d4v3y0rk committed Jan 10, 2025
1 parent 107d3ed commit 2688cbd
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
7 changes: 6 additions & 1 deletion cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _Released 1/7/2024 (PENDING)_
- The `cy.origin()` command must now be used when navigating between subdomains. Because this is a fairly disruptive change for users who frequently navigate between subdomains, a new configuration option is being introduced. `injectDocumentDomain` can be set to `true` in order to re-enable the injection of `document.domain` by Cypress. This configuration option is marked as deprecated and you will receive a warning when Cypress is launched with this option set to `true`. It will be removed in Cypress 15. Addressed in [#30770](/~https://github.com/cypress-io/cypress/pull/30770). Addresses [#25806](/~https://github.com/cypress-io/cypress/issues/25806), [#25987](/~https://github.com/cypress-io/cypress/issues/25987), [#27528](/~https://github.com/cypress-io/cypress/issues/27528), [#29445](/~https://github.com/cypress-io/cypress/issues/29445), [#29590](/~https://github.com/cypress-io/cypress/issues/29590) and [#30571](/~https://github.com/cypress-io/cypress/issues/30571).
- It is no longer possible to make a `fetch` or `XMLHttpRequest` request from the `about:blank` page in Electron (i.e. `cy.window().then((win) => win.fetch('<some-url>'))`). You must use `cy.request` instead or perform some form of initial navigation via `cy.visit()`. Addressed in [#29547](/~https://github.com/cypress-io/cypress/pull/30394).
- The `experimentalJustInTimeCompile` configuration option for component testing has been replaced with a `justInTimeCompile` option that is `true` by default. This option will only compile resources directly related to your spec, compiling them 'just-in-time' before spec execution. This should result in improved memory management and performance for component tests in `cypress open` and `cypress run` modes, in particular for large component testing suites. `justInTimeCompile` is now only supported for [`webpack`](https://www.npmjs.com/package/webpack). Addresses [#30234](/~https://github.com/cypress-io/cypress/issues/30234). Addressed in [#30402](/~https://github.com/cypress-io/cypress/pull/30402).
- Cypress Component Testing no longer supports:
- Cypress Component Testing no longer supports:
- `create-react-app`. Addresses [#30028](/~https://github.com/cypress-io/cypress/issues/30028).
- `@vue/cli-service`. Addresses [#30481](/~https://github.com/cypress-io/cypress/issues/30481).
- `Angular` versions 13, 14, 15, and 16. The minimum supported version is now `17.2.0` in order to fully support Angular [signals](https://angular.dev/guide/signals). Addresses [#29582](/~https://github.com/cypress-io/cypress/issues/29582). Addressed in [#30539](/~https://github.com/cypress-io/cypress/pull/30539).
Expand Down Expand Up @@ -60,6 +60,11 @@ in this [GitHub issue](/~https://github.com/cypress-io/cypress/issues/30447). Addr

- Removed some component testing API stubs that were removed in [Cypress v11.0.0](https://docs.cypress.io/app/references/migration-guide#Component-Testing-Updates). Addressed in [#30696](/~https://github.com/cypress-io/cypress/pull/30696). Addresses [#30623](/~https://github.com/cypress-io/cypress/issues/30623).
- Updated to use Cypress design system browser icons. Addressed in [#30790](/~https://github.com/cypress-io/cypress/pull/30790).
- Fixed an issue where benign Mesa/GLX related warnings were being shown in the terminal output when running Cypress in certain Linux environments or containers. The following warnings are now suppressed:
- `error: XDG_RUNTIME_DIR is invalid or not set in the environment.`
- `MESA: error: ZINK: failed to choose pdev`
- `glx: failed to create drisw screen`
Fixes [#29521](/~https://github.com/cypress-io/cypress/issues/29521)

**Dependency Updates:**

Expand Down
28 changes: 27 additions & 1 deletion cli/lib/exec/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,33 @@ const isDebugScenario4 = /^\[[^\]]+debug_utils\.cc[^\]]+\] Hit debug scenario: 4
*/
const isEGLDriverMessage = /^\[[^\]]+gl_display\.cc[^\]]+\] EGL Driver message \(Error\) eglQueryDeviceAttribEXT: Bad attribute\./

const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe, isDbusWarning, isCertVerifyProcBuiltin, isHostVulkanDriverWarning, isContainerVulkanDriverWarning, isContainerVulkanStack, isDebugScenario4, isEGLDriverMessage]
/**
* Mesa/GLX related warnings that occur in certain Linux environments without proper GPU support
* or when running in containers. These are benign warnings that don't affect functionality.
* Samples:
* error: XDG_RUNTIME_DIR is invalid or not set in the environment.
* MESA: error: ZINK: failed to choose pdev
* glx: failed to create drisw screen
*/
const isXdgRuntimeError = /^error: XDG_RUNTIME_DIR is invalid or not set/
const isMesaZinkError = /^MESA: error: ZINK: failed to choose pdev/
const isGlxDriverError = /^glx: failed to create drisw screen/

const GARBAGE_WARNINGS = [
isXlibOrLibudevRe,
isHighSierraWarningRe,
isRenderWorkerRe,
isDbusWarning,
isCertVerifyProcBuiltin,
isHostVulkanDriverWarning,
isContainerVulkanDriverWarning,
isContainerVulkanStack,
isDebugScenario4,
isEGLDriverMessage,
isXdgRuntimeError,
isMesaZinkError,
isGlxDriverError
]

const isGarbageLineWarning = (str) => {
return _.some(GARBAGE_WARNINGS, (re) => {
Expand Down
17 changes: 16 additions & 1 deletion cli/test/lib/exec/spawn_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('lib/exec/spawn', function () {
at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:344)
at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:521)
[78887:1023/114920.074882:ERROR:debug_utils.cc(14)] Hit debug scenario: 4
[18489:0822/130231.159571:ERROR:gl_display.cc(497)] EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute.
Expand All @@ -112,6 +112,21 @@ describe('lib/exec/spawn', function () {
expect(spawn.isGarbageLineWarning(line), `expected line to be garbage: ${line}`).to.be.true
})
})

it('returns true for XDG runtime dir warnings', () => {
const str = 'error: XDG_RUNTIME_DIR is invalid or not set'
expect(spawn.isGarbageLineWarning(str)).to.be.true
})

it('returns true for MESA ZINK errors', () => {
const str = 'MESA: error: ZINK: failed to choose pdev'
expect(spawn.isGarbageLineWarning(str)).to.be.true
})

it('returns true for GLX driver errors', () => {
const str = 'glx: failed to create drisw screen'
expect(spawn.isGarbageLineWarning(str)).to.be.true
})
})

context('.start', function () {
Expand Down

0 comments on commit 2688cbd

Please sign in to comment.