From c1d177dc4ec951c02a430bc563fcadedf9cf014b Mon Sep 17 00:00:00 2001 From: Dave York Date: Fri, 10 Jan 2025 18:06:46 -0500 Subject: [PATCH] misc: suppress more GPU related warnings Closes Mesa/GLX related warnings shown when running Cypress #29521 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` 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 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. - [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? fix linting change word for CI Update cli/CHANGELOG.md Going with the suggesting. Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> fix linting update readme with another fixed issue --- cli/CHANGELOG.md | 9 ++++++++- cli/lib/exec/spawn.js | 28 +++++++++++++++++++++++++++- cli/test/lib/exec/spawn_spec.js | 14 +++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 7443b288e350..f3b965a0bdf9 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -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(''))`). 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). @@ -60,6 +60,13 @@ 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` + + Addresses [#29521](https://github.com/cypress-io/cypress/issues/29521) and [#29554](https://github.com/cypress-io/cypress/issues/29554). + **Dependency Updates:** diff --git a/cli/lib/exec/spawn.js b/cli/lib/exec/spawn.js index 2affe11bf6c4..66fd9b97c4f4 100644 --- a/cli/lib/exec/spawn.js +++ b/cli/lib/exec/spawn.js @@ -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) => { diff --git a/cli/test/lib/exec/spawn_spec.js b/cli/test/lib/exec/spawn_spec.js index f6756cfe2c08..17f552cc90cc 100644 --- a/cli/test/lib/exec/spawn_spec.js +++ b/cli/test/lib/exec/spawn_spec.js @@ -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. @@ -112,6 +112,18 @@ 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', () => { + expect(spawn.isGarbageLineWarning('error: XDG_RUNTIME_DIR is invalid or not set')).to.be.true + }) + + it('returns true for MESA ZINK errors', () => { + expect(spawn.isGarbageLineWarning('MESA: error: ZINK: failed to choose pdev')).to.be.true + }) + + it('returns true for GLX driver errors', () => { + expect(spawn.isGarbageLineWarning('glx: failed to create drisw screen')).to.be.true + }) }) context('.start', function () {