diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 66b305c338e4c3dd0d19a989882c74dd7595a8ae..989c8a057b70a0f4f164e6e5016ecec3fd2d7d88 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -81,7 +81,8 @@ TYPO3 core test runner. Execute acceptance, unit, functional and other test suit a docker based test environment. Handles execution of single test files, sending xdebug information to a local IDE and more. -Successfully tested with docker version 18.06.1-ce and docker-compose 1.21.2. +Recommended docker version is >=20.10 for xdebug break pointing to work reliably, and +a recent docker-compose (tested >=1.21.2) is needed. Usage: $0 [options] [file] diff --git a/Build/testing-docker/local/docker-compose.yml b/Build/testing-docker/local/docker-compose.yml index 8f2c48bac636c17e0ec91b4fc1abde48eec354ff..54e5f2c740d485e1e7e38ce2587ca8a409abf152 100644 --- a/Build/testing-docker/local/docker-compose.yml +++ b/Build/testing-docker/local/docker-compose.yml @@ -40,16 +40,17 @@ services: stop_grace_period: 1s volumes: - ${CORE_ROOT}:${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" \ php -S web:8000 -t ${CORE_ROOT} else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ php -S web:8000 -t ${CORE_ROOT} fi " @@ -99,6 +100,8 @@ services: - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -116,10 +119,9 @@ services: XDEBUG_MODE=\"off\" \ $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -155,6 +157,8 @@ services: - /etc/passwd:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -172,10 +176,9 @@ services: XDEBUG_MODE=\"off\" \ $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -214,6 +217,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -231,10 +236,9 @@ services: XDEBUG_MODE=\"off\" \ $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -270,6 +274,8 @@ services: - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -280,10 +286,9 @@ services: XDEBUG_MODE=\"off\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=mysql --xml reports.xml --html reports.html else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=mysql --xml reports.xml --html reports.html fi " @@ -319,6 +324,8 @@ services: - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -329,10 +336,9 @@ services: XDEBUG_MODE=\"off\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml ${EXTRA_TEST_OPTIONS} --env=mysql --xml reports.xml --html reports.html else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml ${EXTRA_TEST_OPTIONS} --env=mysql --xml reports.xml --html reports.html fi " @@ -368,6 +374,8 @@ services: - ${HOST_HOME}:${HOST_HOME} - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -378,10 +386,9 @@ services: XDEBUG_MODE=\"off\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml ${EXTRA_TEST_OPTIONS} --env=postgresql --xml reports.xml --html reports.html else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml ${EXTRA_TEST_OPTIONS} --env=postgresql --xml reports.xml --html reports.html fi " @@ -404,6 +411,8 @@ services: - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -414,10 +423,9 @@ services: XDEBUG_MODE=\"off\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml ${EXTRA_TEST_OPTIONS} --env=sqlite --xml reports.xml --html reports.html else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ bin/codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml ${EXTRA_TEST_OPTIONS} --env=sqlite --xml reports.xml --html reports.html fi " @@ -865,6 +873,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -880,10 +890,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -904,6 +913,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -914,10 +925,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -956,6 +966,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -971,10 +983,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -995,6 +1006,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1005,10 +1018,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -1050,6 +1062,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1065,10 +1079,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -1091,6 +1104,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1101,10 +1116,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -1143,6 +1157,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1158,10 +1174,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -1182,6 +1197,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1192,10 +1209,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -1224,6 +1240,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1239,10 +1257,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -1261,6 +1278,8 @@ services: typo3TestingRedisHost: redis4 typo3TestingMemcachedHost: memcached1-5 working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1271,10 +1290,9 @@ services: if [ ${PHP_XDEBUG_ON} -eq 0 ]; then XDEBUG_MODE=\"off\" $${COMMAND}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ $${COMMAND}; fi " @@ -1391,6 +1409,8 @@ services: - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1401,10 +1421,9 @@ services: XDEBUG_MODE=\"off\" \ vendor/phpunit/phpunit/phpunit -c Build/phpunit/UnitTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ vendor/phpunit/phpunit/phpunit -c Build/phpunit/UnitTests.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE}; fi " @@ -1418,6 +1437,8 @@ services: - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1428,10 +1449,9 @@ services: XDEBUG_MODE=\"off\" \ vendor/phpunit/phpunit/phpunit -c Build/phpunit/UnitTestsDeprecated.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE}; else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` XDEBUG_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ vendor/phpunit/phpunit/phpunit -c Build/phpunit/UnitTestsDeprecated.xml ${EXTRA_TEST_OPTIONS} ${TEST_FILE}; fi " @@ -1464,6 +1484,8 @@ services: - ${PASSWD_PATH}:/etc/passwd:ro - /etc/group:/etc/group:ro working_dir: ${CORE_ROOT} + extra_hosts: + - "host.docker.internal:host-gateway" command: > /bin/sh -c " if [ ${SCRIPT_VERBOSE} -eq 1 ]; then @@ -1474,10 +1496,9 @@ services: XDEBUG_MODE=\"off\" \ vendor/phpunit/phpunit/phpunit -c Build/phpunit/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_MODE=\"debug,develop\" \ XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ + XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \ vendor/phpunit/phpunit/phpunit -c Build/phpunit/UnitTests.xml --order-by=random ${EXTRA_TEST_OPTIONS} ${PHPUNIT_RANDOM} ${TEST_FILE}; fi "