Commit dc66c587 authored by Jochen Roth's avatar Jochen Roth Committed by Christian Kuhn
Browse files

[BUGFIX] runTests.sh: Fix macos user detection

Check for user in /etc/passwd, if it does not exist create
a temporary passwd to get values from.

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


Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 4cdee851
......@@ -38,6 +38,7 @@ nbproject
/Build/JavaScript
!/Build/typings/no-def*
/Build/testing-docker/local/.env
/Build/testing-docker/local/macos_passwd
/typo3/sysext/*/Resources/Private/TypeScript/*.js
/typo3/sysext/*/Resources/Public/JavaScript/*.js.map
typo3/sysext/core/Tests/Acceptance/AcceptanceTests-Job-*
......
......@@ -37,15 +37,14 @@ setUpDockerComposeDotEnv() {
echo "PHP_VERSION=${PHP_VERSION}" >> .env
echo "CHUNKS=${CHUNKS}" >> .env
echo "THISCHUNK=${THISCHUNK}" >> .env
echo "PASSWD_PATH=${PASSWD_PATH}" >> .env
}
# Options -a and -d depend on each other. The function
# validates input combinations and sets defaults.
handleDbmsAndDriverOptions() {
case ${DBMS} in
mariadb)
;&
mysql)
mysql|mariadb)
[ -z ${DATABASE_DRIVER} ] && DATABASE_DRIVER="mysqli"
if [ "${DATABASE_DRIVER}" != "mysqli" ] && [ "${DATABASE_DRIVER}" != "pdo_mysql" ]; then
echo "Invalid option -a ${DATABASE_DRIVER} with -d ${DBMS}" >&2
......@@ -63,16 +62,13 @@ handleDbmsAndDriverOptions() {
exit 1
fi
;;
postgres)
;&
sqlite)
postgres|sqlite)
if ! [ -z ${DATABASE_DRIVER} ]; then
echo "Invalid option -a ${DATABASE_DRIVER} with -d ${DBMS}" >&2
echo >&2
echo "call \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
DATABASE_DRIVER=""
;;
esac
}
......@@ -288,11 +284,13 @@ EXTRA_TEST_OPTIONS=""
SCRIPT_VERBOSE=0
PHPUNIT_RANDOM=""
CGLCHECK_DRY_RUN=""
DATABASE_DRIVER=""
MARIADB_VERSION="10.3"
MYSQL_VERSION="5.5"
POSTGRES_VERSION="10"
CHUNKS=0
THISCHUNK=0
PASSWD_PATH=/etc/passwd
# Option parsing
# Reset in case getopts has been used previously in the shell
......@@ -392,6 +390,20 @@ fi
# Move "7.4" to "php74", the latter is the docker container name
DOCKER_PHP_IMAGE=`echo "php${PHP_VERSION}" | sed -e 's/\.//'`
# Some scripts rely on a proper /etc/passwd that includes the user that runs the
# containers, for instance to determine users $HOME. yarn v1 is espcecially picky
# here since it fails if it can't write a .yarnrc file to users home ...
# MacOS in it's endless wisdom however decided that /etc/passwd is a stupid thing
# and does not write an entry for the standard user in it. In turn, stuff like yarn fails.
# As a solution, we detect if the user executing the script is within /etc/passwd
# and volume mount that file within containers. If not, we create a fake passwd file
# and mount that one.
[ -z ${USER} ] && USER=`id -u -n`
if [ `grep -c "^${USER}:" /etc/passwd` -ne 1 ]; then
echo "${USER}:x:$(id -u $USER):$(id -g $USER):$(id -gn $USER):${HOME}:/bin/bash" > macos_passwd
PASSWD_PATH="./macos_passwd"
fi
# Set $1 to first mass argument, this is the optional test file or test directory to execute
shift $((OPTIND - 1))
TEST_FILE=${1}
......
......@@ -82,7 +82,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -226,7 +226,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -266,7 +266,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -306,7 +306,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -346,7 +346,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -387,7 +387,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
command: >
/bin/sh -c "
......@@ -413,7 +413,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -431,7 +431,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}/Build
command: >
......@@ -449,7 +449,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}/Build
command: >
......@@ -467,7 +467,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -484,7 +484,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -502,7 +502,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -519,7 +519,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -536,7 +536,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -553,7 +553,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -570,7 +570,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -587,7 +587,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -604,7 +604,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -621,7 +621,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -638,7 +638,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -658,7 +658,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}/Build
command: >
......@@ -680,7 +680,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -697,7 +697,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -714,7 +714,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -731,7 +731,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -748,7 +748,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -767,7 +767,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -786,7 +786,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -842,7 +842,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
environment:
typo3DatabaseDriver: "${DATABASE_DRIVER}"
......@@ -896,7 +896,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
environment:
typo3DatabaseDriver: "${DATABASE_DRIVER}"
......@@ -951,7 +951,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
environment:
typo3DatabaseDriver: "${DATABASE_DRIVER}"
......@@ -1007,7 +1007,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
environment:
typo3DatabaseDriver: pdo_pgsql
......@@ -1053,7 +1053,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
environment:
typo3DatabaseDriver: pdo_sqlite
......@@ -1085,7 +1085,7 @@ services:
user: ${HOST_UID}
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -1103,7 +1103,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}/Build
command: >
......@@ -1121,7 +1121,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}/Build
command: >
......@@ -1139,7 +1139,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}/Build
command: >
......@@ -1172,7 +1172,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -1197,7 +1197,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......@@ -1222,7 +1222,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}/Build
command: >
......@@ -1241,7 +1241,7 @@ services:
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- ${PASSWD_PATH}:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
......
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