11#! /usr/bin/env bash
22
33#
4- # TYPO3 core test runner based on docker.
4+ # TYPO3 core test runner based on docker or podman
55#
66
7+ trap ' cleanUp;exit 2' SIGINT
8+
79waitFor () {
810 local HOST=${1}
911 local PORT=${2}
@@ -19,14 +21,21 @@ waitFor() {
1921 done;
2022 "
2123 ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name wait-for-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG=" ${XDEBUG_CONFIG} " ${IMAGE_ALPINE} /bin/sh -c " ${TESTCOMMAND} "
24+ if [[ $? -gt 0 ]]; then
25+ kill -SIGINT -$$
26+ fi
2227}
2328
2429cleanUp () {
2530 ATTACHED_CONTAINERS=$( ${CONTAINER_BIN} ps --filter network=${NETWORK} --format=' {{.Names}}' )
2631 for ATTACHED_CONTAINER in ${ATTACHED_CONTAINERS} ; do
27- ${CONTAINER_BIN} rm -f ${ATTACHED_CONTAINER} > /dev/null
32+ ${CONTAINER_BIN} kill ${ATTACHED_CONTAINER} > /dev/null
2833 done
29- ${CONTAINER_BIN} network rm ${NETWORK} > /dev/null
34+ if [ ${CONTAINER_BIN} = " docker" ]; then
35+ ${CONTAINER_BIN} network rm ${NETWORK} > /dev/null
36+ else
37+ ${CONTAINER_BIN} network rm -f ${NETWORK} > /dev/null
38+ fi
3039}
3140
3241handleDbmsOptions () {
@@ -40,8 +49,8 @@ handleDbmsOptions() {
4049 echo " Use \" .Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
4150 exit 1
4251 fi
43- [ -z " ${DBMS_VERSION} " ] && DBMS_VERSION=" 10.3 "
44- if ! [[ ${DBMS_VERSION} =~ ^(10.3 | 10. 4| 10.5| 10.6| 10.7| 10.8| 10.9| 10.10| 10.11| 11.0| 11.1)$ ]]; then
52+ [ -z " ${DBMS_VERSION} " ] && DBMS_VERSION=" 10.4 "
53+ if ! [[ ${DBMS_VERSION} =~ ^(10.4| 10.5| 10.6| 10.7| 10.8| 10.9| 10.10| 10.11| 11.0| 11.1)$ ]]; then
4554 echo " Invalid combination -d ${DBMS} -i ${DBMS_VERSION} " >&2
4655 echo >&2
4756 echo " Use \" .Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -57,7 +66,7 @@ handleDbmsOptions() {
5766 exit 1
5867 fi
5968 [ -z " ${DBMS_VERSION} " ] && DBMS_VERSION=" 8.0"
60- if ! [[ ${DBMS_VERSION} =~ ^(8.0)$ ]]; then
69+ if ! [[ ${DBMS_VERSION} =~ ^(8.0| 8.1 | 8.2 | 8.3 )$ ]]; then
6170 echo " Invalid combination -d ${DBMS} -i ${DBMS_VERSION} " >&2
6271 echo >&2
6372 echo " Use \" .Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -72,7 +81,7 @@ handleDbmsOptions() {
7281 exit 1
7382 fi
7483 [ -z " ${DBMS_VERSION} " ] && DBMS_VERSION=" 10"
75- if ! [[ ${DBMS_VERSION} =~ ^(10| 11| 12| 13| 14| 15)$ ]]; then
84+ if ! [[ ${DBMS_VERSION} =~ ^(10| 11| 12| 13| 14| 15| 16 )$ ]]; then
7685 echo " Invalid combination -d ${DBMS} -i ${DBMS_VERSION} " >&2
7786 echo >&2
7887 echo " Use \" .Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -105,22 +114,13 @@ handleDbmsOptions() {
105114cleanBuildFiles () {
106115 echo -n " Clean builds ... "
107116 rm -rf \
117+ .cache \
108118 Build/JavaScript \
109119 Build/node_modules \
110120 Documentation-GENERATED-temp
111121 echo " done"
112122}
113123
114- cleanCacheFiles () {
115- echo -n " Clean caches ... "
116- rm -rf \
117- .cache \
118- Build/.cache \
119- Build/composer/.cache/ \
120- .php-cs-fixer.cache
121- echo " done"
122- }
123-
124124cleanTestFiles () {
125125 # test related
126126 echo -n " Clean test related files ... "
@@ -136,11 +136,18 @@ cleanTestFiles() {
136136 echo " done"
137137}
138138
139- cleanRenderedDocumentationFiles () {
140- echo -n " Clean rendered documentation files ... "
141- rm -rf \
142- typo3/sysext/* /Documentation-GENERATED-temp
143- echo " done"
139+ getPhpImageVersion () {
140+ case ${1} in
141+ 8.1)
142+ echo -n " 2.12"
143+ ;;
144+ 8.2)
145+ echo -n " 1.12"
146+ ;;
147+ 8.3)
148+ echo -n " 1.13"
149+ ;;
150+ esac
144151}
145152
146153loadHelp () {
@@ -155,56 +162,20 @@ Usage: $0 [options] [file]
155162Options:
156163 -s <...>
157164 Specifies the test suite to run
158- - acceptance: main application acceptance tests
159- - acceptanceInstall: installation acceptance tests, only with -d mariadb|postgres|sqlite
160- - buildCss: execute scss to css builder
161- - buildJavascript: execute typescript to javascript builder
162- - cgl: test and fix all core php files
163- - cglGit: test and fix latest committed patch for CGL compliance
164- - cglHeader: test and fix file header for all core php files
165- - cglHeaderGit: test and fix latest committed patch for CGL file header compliance
166- - checkAnnotations: check php code for allowed annotations
167- - checkBom: check UTF-8 files do not contain BOM
168- - checkComposer: check composer.json files for version integrity
169- - checkExceptionCodes: test core for duplicate exception codes
170- - checkExtensionScannerRst: test all .rst files referenced by extension scanner exist
171- - checkFilePathLength: test core file paths do not exceed maximum length
172- - checkGitSubmodule: test core git has no sub modules defined
173- - checkGruntClean: Verify "grunt build" is clean. Warning: Executes git commands! Usually used in CI only.
174- - checkIsoDatabase: Verify "updateIsoDatabase.php" does not change anything.
175- - checkNamespaceIntegrity: Verify namespace integrity in class and test code files are in good shape.
176- - checkPermissions: test some core files for correct executable bits
177- - checkRst: test .rst files for integrity
178- - checkTestClassFinal: check test case classes are final
179- - checkTestMethodsPrefix: check tests methods do not start with "test"
165+ - buildDocumentation: test build the documentation
180166 - clean: clean up build, cache and testing related files and folders
181- - cleanBuild: clean up build related files and folders
182- - cleanCache: clean up cache related files and folders
183- - cleanRenderedDocumentation: clean up rendered documentation files and folders (Documentation-GENERATED-temp)
184- - cleanTests: clean up test related files and folders
185- - composerInstall: "composer install"
186- - composerInstallMax: "composer update", with no platform.php config.
187- - composerInstallMin: "composer update --prefer-lowest", with platform.php set to PHP version x.x.0.
188- - composerTestDistribution: "composer update" in Build/composer to verify core dependencies
189- - composerValidate: "composer validate"
190- - functional: PHP functional tests
191- - functionalDeprecated: deprecated PHP functional tests
192- - lintPhp: PHP linting
193- - lintScss: SCSS linting
194- - lintTypescript: TS linting
195- - lintHtml: HTML linting
196- - listExceptionCodes: list core exception codes in JSON format
197- - phpstan: phpstan tests
198- - phpstanGenerateBaseline: regenerate phpstan baseline, handy after phpstan updates
199- - unit (default): PHP unit tests
200- - unitDeprecated: deprecated PHP unit tests
201- - unitJavascript: JavaScript unit tests
202- - unitRandom: PHP unit tests in random order, add -o <number> to use specific seed
167+ - composerInstallPackage: install a package with composer
168+ - lintXliff: test XLIFF language files
169+
170+ -b <docker|podman>
171+ Container environment:
172+ - podman (default)
173+ - docker
203174
204175 -p <8.1|8.2|8.3>
205176 Specifies the PHP minor version to be used
206- - 8.1 (default) : use PHP 8.1
207- - 8.2: use PHP 8.2
177+ - 8.1: use PHP 8.1
178+ - 8.2 (default) : use PHP 8.2
208179 - 8.3: use PHP 8.3
209180
210181 -q
@@ -221,16 +192,13 @@ Options:
221192
222193Examples:
223194 # Run install a package with composer
224- ./Build/Scripts/additionalTests.sh -p 8.1 -s composerInstallPackage "typo3/cms-core:12.4"
225-
226- # Linting scss files
227- ./Build/Scripts/additionalTests.sh -s lintScss
228-
229- # Linting typescript files
230- ./Build/Scripts/additionalTests.sh -s lintTypescript
195+ ./Build/Scripts/additionalTests.sh -p 8.2 -s composerInstallPackage "typo3/cms-core:13.0"
231196
232197 # Test build the documentation
233198 ./Build/Scripts/additionalTests.sh -s buildDocumentation
199+
200+ # Test XLIFF language files
201+ ./Build/Scripts/additionalTests.sh -s lintXliff
234202EOF
235203}
236204
398366# Suite execution
399367case ${TEST_SUITE} in
400368 buildDocumentation)
401- mkdir -p Documentation-GENERATED-temp
402- COMMAND=" [ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; /ALL/Menu/mainmenu.sh makehtml;"
403- ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} -v ${CORE_ROOT} :/PROJECT:ro -v ${CORE_ROOT} /Documentation-GENERATED-temp:/RESULT --name build-documentation-${SUFFIX} --entrypoint " " ${IMAGE_DOCUMENTATION} /bin/sh -c " ${COMMAND} "
369+ ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} -v ${CORE_ROOT} :/project ghcr.io/typo3-documentation/render-guides:latest render Documentation
404370 SUITE_EXIT_CODE=$?
405371 ;;
406372 clean)
407373 cleanBuildFiles
408- cleanCacheFiles
409- cleanRenderedDocumentationFiles
410374 cleanTestFiles
411375 ;;
412376 composerInstallPackage)
413377 COMMAND=" [ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; composer require -W -n ${COMPOSER_PARAMETER} ${COMPOSER_PACKAGE} ;"
414378 ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-require-package-${SUFFIX} -w ${CORE_ROOT} -e COMPOSER_CACHE_DIR=${CORE_ROOT} /Build/.cache/composer ${IMAGE_PHP} /bin/sh -c " ${COMMAND} "
415379 SUITE_EXIT_CODE=$?
416380 ;;
417- lintPhp)
418- COMMAND=" [ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; php -v | grep '^PHP'; find Classes/ -name \\ *.php -print0 | xargs -0 -n1 -P4 php -dxdebug.mode=off -l > /dev/null;"
419- ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-php-${SUFFIX} -w ${CORE_ROOT} ${IMAGE_PHP} /bin/sh -c " ${COMMAND} "
420- SUITE_EXIT_CODE=$?
421- ;;
422- lintScss)
423- COMMAND=" [ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; cd Build; npm ci || exit 1; npm run lint:css;"
424- ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-css-${SUFFIX} -w ${CORE_ROOT} -e HOME=${CORE_ROOT} /.cache ${IMAGE_NODEJS} /bin/sh -c " ${COMMAND} "
425- SUITE_EXIT_CODE=$?
426- ;;
427- lintTypescript)
428- COMMAND=" [ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; cd Build; npm ci || exit 1; npm run lint:ts;"
429- ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-typescript-${SUFFIX} -w ${CORE_ROOT} -e HOME=${CORE_ROOT} /.cache ${IMAGE_NODEJS} /bin/sh -c " ${COMMAND} "
430- SUITE_EXIT_CODE=$?
431- ;;
432381 lintXliff)
433382 COMMAND=" [ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; xmllint --schema /xliff-core-1.2-strict.xsd --noout *.xlf;"
434383 ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-xliff-${SUFFIX} -w ${CORE_ROOT} /Resources/Private/Language ${IMAGE_XLIFF} /bin/sh -c " ${COMMAND} "
0 commit comments