Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#56022 closed defect (bug) (fixed)

Enable coverage mode for xDebug in local Docker environment

Reported by: desrosj's profile desrosj Owned by: desrosj's profile desrosj
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

Recently, the version of xDebug included in the PHP 7.2-7.4 Docker containers was changed from 2.x to 3.x.

One of the changes in xDebug 3.0 was a shift from enabling features to switching xDebug into modes (see the 2.x to 3.0 upgrade documentation). By default, xDebug is in develop mode. However, in order to generate code coverage reports the coverage mode needs to be active.

The code coverage reporting workflow currently runs on PHP 7.4, and was affected by this change. The Code Coverage workflow has not been able to generate a coverage report since then.

Change History (8)

This ticket was mentioned in PR #2832 on WordPress/wordpress-develop by desrosj.


2 years ago
#1

This enables the coverage mode for xDebug in the local Docker environment in addition to the default mode of develop by passing the XDEBUG_MODE environment variable to the container.

This environment variable takes precedent, but does not change the value of xdebug.mode. For more information, see the xDebug documentation about modes.

Trac ticket: https://core.trac.wordpress.org/ticket/56022

#2 @desrosj
2 years ago

  • Owner set to desrosj
  • Status changed from new to assigned

afragen commented on PR #2832:


2 years ago
#3

Any reason not to include debug for step debugging?

desrosj commented on PR #2832:


2 years ago
#4

Any reason not to include debug for step debugging?

@afragen No reason other than I hadn't considered it. Since the environment is meant for local Core development, I think that's reasonable to include.

I looked into performance implications, and looks like `coverage` slows down Xdebug the most (though less on Xdebug 3.0). I've switched the default to develop,debug and updated the workflow to use the environment variable to change the mode to coverage.

desrosj commented on PR #2832:


2 years ago
#5

Any reason not to include debug for step debugging?

@afragen No reason other than I hadn't considered it. Since the environment is meant for local Core development, I think that's reasonable to include.

I looked into performance implications, and looks like `coverage` slows down Xdebug the most (though less on Xdebug 3.0). I've switched the default to develop,debug and updated the workflow to use the environment variable to change the mode to coverage.

#6 @desrosj
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 53552:

Build/Test Tools: Configure Xdebug modes in the local Docker environment.

One change in the update from Xdebug version 2.x to 3.x was a shift from enabling features to switching into modes.

When the version of Xdebug installed in the PHP 7.4 Docker container was updated from 2.x to 3.x, the code coverage reporting workflow stopped generating reports due to a lack of available coverage drivers.

This change adds the XDEBUG_MODE environment variable to the local Docker environment configuration to allow the active modes to be changed. This environment variable takes precedence over the xdebug.mode setting, but will not change the value of the xdebug.mode setting.

The LOCAL_PHP_XDEBUG_MODE environment variable has been added to the .env file and can be used to change the modes enabled in the Docker container. The code coverage reporting workflow uses this variable to enable the coverage mode, which is required for generating a test coverage report.

By default, debug and `debug modes are active, which enables the more commonly used features of Xdebug: development helpers and step debugging.

Props afragen, johnbillion, desrosj.
Fixes #56022.

This ticket was mentioned in Slack in #core by sergey. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.