Commit a7ea630d authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Deal with xdebug 3

Adapt testing related docker-compose.yml to properly
work with xdebug 3.0. This is packaged in the testing
container images already and is the only version
compatible with PHP 8.

To spice up developers life, xdebug 3.0 drops important
config options in a non b/w compatible way, introduces
new ones, where some of them overwrite others, and does
further stuff like changing the default step debugger
port for no apparent reason.

Since xdebug can be such a pain, runTests.sh comes with
-x option, so it (hopefully) 'just works' for devs using
the script in testing context. The setup of course breaks
with xdebug 3.0 and is fixed with the patch.

As single advantage, it is now easier to disable xdebug,
so the 'prepared php.ini file without xdebug' hack in
the test container images can be dropped.

Change-Id: Id5810a5a6d988bfe5e814a6781d12d93baa97972
Resolves: #93599
Releases: master, 10.4, 9.5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68137


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Simon Gilli's avatarSimon Gilli <typo3@gilbertsoft.org>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Simon Gilli's avatarSimon Gilli <typo3@gilbertsoft.org>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent a465de29
......@@ -194,11 +194,11 @@ Options:
-x
Only with -s functional|unit|unitDeprecated|unitRandom
Send information to host instance for test or system under test break points. This is especially
useful if a local PhpStorm instance is listening on default xdebug port 9000. A different port
useful if a local PhpStorm instance is listening on default xdebug port 9003. A different port
can be selected with -y
-y <port>
Send xdebug information to a different port than default 9000 if an IDE like PhpStorm
Send xdebug information to a different port than default 9003 if an IDE like PhpStorm
is not listening on default port.
-o <number>
......@@ -228,7 +228,7 @@ Examples:
./Build/Scripts/runTests.sh
./Build/Scripts/runTests.sh -s unit
# Run all core units tests and enable xdebug (have a PhpStorm listening on port 9000!)
# Run all core units tests and enable xdebug (have a PhpStorm listening on port 9003!)
./Build/Scripts/runTests.sh -x
# Run unit tests in phpunit verbose mode with xdebug on PHP 8.0 and filter for test canRetrieveValueWithGP
......@@ -280,7 +280,7 @@ TEST_SUITE="unit"
DBMS="mariadb"
PHP_VERSION="7.4"
PHP_XDEBUG_ON=0
PHP_XDEBUG_PORT=9000
PHP_XDEBUG_PORT=9003
EXTRA_TEST_OPTIONS=""
SCRIPT_VERBOSE=0
PHPUNIT_RANDOM=""
......
......@@ -40,7 +40,7 @@ services:
stop_grace_period: 1s
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
command: php -n -c /etc/php/cli-no-xdebug/php.ini -S web:8000 -t ${CORE_ROOT}
command: php -dxdebug.mode=off -S web:8000 -t ${CORE_ROOT}
redis4:
image: redis:4-alpine
......@@ -54,7 +54,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
working_dir: ${CORE_ROOT}
command: php Build/Scripts/splitAcceptanceTests.php -v ${CHUNKS}
command: php -dxdebug.mode=off Build/Scripts/splitAcceptanceTests.php -v ${CHUNKS}
prepare_acceptance_backend_mariadb:
image: alpine:3.8
......@@ -100,7 +100,7 @@ services:
COMMAND=\"bin/codecept run Backend -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html\"
fi
mkdir -p typo3temp/var/tests/
$${COMMAND}
php -dxdebug.mode=off $${COMMAND}
"
prepare_acceptance_backend_mysql:
......@@ -147,7 +147,7 @@ services:
COMMAND=\"bin/codecept run Backend -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html\"
fi
mkdir -p typo3temp/var/tests/
$${COMMAND}
php -dxdebug.mode=off $${COMMAND}
"
prepare_acceptance_backend_postgres:
......@@ -197,7 +197,7 @@ services:
COMMAND=\"bin/codecept run Backend -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html\"
fi
mkdir -p typo3temp/var/tests/
$${COMMAND}
php -dxdebug.mode=off $${COMMAND}
"
prepare_acceptance_pagetree_mariadb:
......@@ -237,7 +237,7 @@ services:
set -x
fi
mkdir -p typo3temp/var/tests/ \
&& ./bin/codecept run PageTree -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html
&& php -dxdebug.mode=off bin/codecept run PageTree -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html
"
prepare_acceptance_installtool_mariadb:
......@@ -277,7 +277,7 @@ services:
set -x
fi
mkdir -p typo3temp/var/tests/ \
&& ./bin/codecept run InstallTool -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html
&& php -dxdebug.mode=off bin/codecept run InstallTool -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html
"
prepare_acceptance_install_mysql:
......@@ -317,7 +317,7 @@ services:
set -x
fi
mkdir -p typo3temp/var/tests/ \
&& ./bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=mysql --xml reports.xml --html reports.html
&& php -dxdebug.mode=off bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=mysql --xml reports.xml --html reports.html
"
prepare_acceptance_install_mariadb:
......@@ -357,7 +357,7 @@ services:
set -x
fi
mkdir -p typo3temp/var/tests/ \
&& ./bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=mysql --xml reports.xml --html reports.html
&& php -dxdebug.mode=off bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=mysql --xml reports.xml --html reports.html
"
prepare_acceptance_install_postgres:
......@@ -397,7 +397,7 @@ services:
set -x
fi
mkdir -p typo3temp/var/tests/ \
&& ./bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=postgresql --xml reports.xml --html reports.html
&& php -dxdebug.mode=off bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=postgresql --xml reports.xml --html reports.html
"
prepare_acceptance_install_sqlite:
......@@ -424,7 +424,7 @@ services:
set -x
fi
mkdir -p typo3temp/var/tests/ \
&& ./bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=sqlite --xml reports.xml --html reports.html
&& php -dxdebug.mode=off bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=sqlite --xml reports.xml --html reports.html
"
build_css:
......@@ -494,7 +494,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
php -n -c /etc/php/cli-no-xdebug/php.ini bin/php-cs-fixer fix -v ${CGLCHECK_DRY_RUN} --path-mode intersection \
php -dxdebug.mode=off bin/php-cs-fixer fix -v ${CGLCHECK_DRY_RUN} --path-mode intersection \
--config=Build/.php_cs typo3/
"
......@@ -512,7 +512,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
Build/Scripts/annotationChecker.php;
php -dxdebug.mode=off Build/Scripts/annotationChecker.php;
"
check_bom:
......@@ -546,7 +546,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
Build/Scripts/checkIntegrityComposer.php;
php -dxdebug.mode=off Build/Scripts/checkIntegrityComposer.php;
"
check_csv_fixtures:
......@@ -563,7 +563,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
Build/Scripts/checkIntegrityCsvFixtures.php;
php -dxdebug.mode=off Build/Scripts/checkIntegrityCsvFixtures.php;
"
fix_csv_fixtures:
......@@ -580,7 +580,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
Build/Scripts/checkIntegrityCsvFixtures.php --fix;
php -dxdebug.mode=off Build/Scripts/checkIntegrityCsvFixtures.php --fix;
"
check_exception_codes:
......@@ -614,7 +614,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
Build/Scripts/extensionScannerRstFileReferences.php;
php -dxdebug.mode=off Build/Scripts/extensionScannerRstFileReferences.php;
"
check_file_path_length:
......@@ -707,7 +707,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
Build/Scripts/validateRstFiles.php;
php -dxdebug.mode=off Build/Scripts/validateRstFiles.php;
"
check_xlf:
......@@ -810,7 +810,7 @@ services:
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
Build/Scripts/docBlockChecker.php;
php -dxdebug.mode=off Build/Scripts/docBlockChecker.php;
"
functional_split:
......@@ -819,7 +819,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
working_dir: ${CORE_ROOT}
command: php Build/Scripts/splitFunctionalTests.php -v ${CHUNKS}
command: php -dxdebug.mode=off Build/Scripts/splitFunctionalTests.php -v ${CHUNKS}
prepare_functional_mariadb:
image: alpine:3.8
......@@ -868,10 +868,13 @@ services:
COMMAND=\"vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE}\"
fi
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini $${COMMAND};
XDEBUG_MODE=\"off\" $${COMMAND};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" $${COMMAND};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
$${COMMAND};
fi
"
......@@ -922,10 +925,13 @@ services:
COMMAND=\"vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE}\"
fi
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini $${COMMAND};
XDEBUG_MODE=\"off\" $${COMMAND};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" $${COMMAND};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
$${COMMAND};
fi
"
......@@ -979,10 +985,13 @@ services:
COMMAND=\"vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml ${EXTRA_TEST_OPTIONS} --exclude-group not-mssql ${TEST_FILE}\"
fi
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini $${COMMAND};
XDEBUG_MODE=\"off\" $${COMMAND};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" $${COMMAND};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
$${COMMAND};
fi
"
......@@ -1033,10 +1042,13 @@ services:
COMMAND=\"vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml ${EXTRA_TEST_OPTIONS} --exclude-group not-postgres ${TEST_FILE}\"
fi
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini $${COMMAND};
XDEBUG_MODE=\"off\" $${COMMAND};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" $${COMMAND};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
$${COMMAND};
fi
"
......@@ -1075,10 +1087,13 @@ services:
COMMAND=\"vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml ${EXTRA_TEST_OPTIONS} --exclude-group not-sqlite ${TEST_FILE}\"
fi
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini $${COMMAND};
XDEBUG_MODE=\"off\" $${COMMAND};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" $${COMMAND};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
$${COMMAND};
fi
"
......@@ -1096,7 +1111,7 @@ services:
set -x
fi
php -v | grep '^PHP'
find typo3/ -name \\*.php -print0 | xargs -0 -n1 -P4 php -n -c /etc/php/cli-no-xdebug/php.ini -l >/dev/null
find typo3/ -name \\*.php -print0 | xargs -0 -n1 -P4 php -dxdebug.mode=off -l >/dev/null
"
lint_scss:
......@@ -1201,12 +1216,14 @@ services:
fi
php -v | grep '^PHP'
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
XDEBUG_MODE=\"off\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
fi
"
......@@ -1226,12 +1243,14 @@ services:
fi
php -v | grep '^PHP'
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsDeprecated.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
XDEBUG_MODE=\"off\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsDeprecated.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsDeprecated.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsDeprecated.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE};
fi
"
......@@ -1270,11 +1289,13 @@ services:
fi
php -v | grep '^PHP'
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -n -c /etc/php/cli-no-xdebug/php.ini \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml --order-by=random ${EXTRA_TEST_OPTIONS} ${PHPUNIT_RANDOM} ${TEST_FILE};
XDEBUG_MODE=\"off\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml --order-by=random ${EXTRA_TEST_OPTIONS} ${PHPUNIT_RANDOM} ${TEST_FILE};
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_CONFIG=\"remote_port=${PHP_XDEBUG_PORT} remote_enable=1 remote_host=$${DOCKER_HOST}\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml --order-by=random ${EXTRA_TEST_OPTIONS} ${PHPUNIT_RANDOM} ${TEST_FILE};
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml --order-by=random ${EXTRA_TEST_OPTIONS} ${PHPUNIT_RANDOM} ${TEST_FILE};
fi
"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment