diff options
author | Ari Parkkila <ari.parkkila@qt.io> | 2024-05-20 08:44:26 +0300 |
---|---|---|
committer | Ari Parkkila <ari.parkkila@qt.io> | 2024-05-21 09:17:44 +0300 |
commit | e13760ae97f91ef45840cefe62c78fdc3d903bba (patch) | |
tree | ae83d331406b94def0ca6edb5b4f6d01b3e7753b | |
parent | dcd4f6f8465f0b784d6c0a6218826be58d13272c (diff) |
ptests: Update test environment for non and root user
Export LANG only if it has not yet been defined for the current user.
Check that HOME directory exists and is writable before running tests.
For example "ptest" user is created without home directory by default.
Webengine tests expect --no-sandbox when running as root so export
environment variable to disable sandbox.
Task-number: QTBUG-118680
Change-Id: I7f40378f92e089bfb3279270ead0b92b309eeb47
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
-rw-r--r-- | recipes-qt/qt6/ptest/run-ptest | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/recipes-qt/qt6/ptest/run-ptest b/recipes-qt/qt6/ptest/run-ptest index 0294585..67fe83b 100644 --- a/recipes-qt/qt6/ptest/run-ptest +++ b/recipes-qt/qt6/ptest/run-ptest @@ -5,8 +5,22 @@ if [ ! -s tst_list ]; then exit 0 fi -export LANG=C.UTF-8 -export QT_QPA_PLATFORM=offscreen +if [ -z "$LANG" ]; then + export LANG=C.UTF-8 +fi +if [ -z "$QT_QPA_PLATFORM" ]; then + export QT_QPA_PLATFORM=offscreen +fi +if [ $UID -ne 0 ]; then + if [ ! -w ${HOME} ]; then + echo "Home directory should be writable, run as root:" + echo "usermod -d /home/${USER} ${USER} && mkhomedir_helper ${USER}" + fi +fi +if [ $UID -eq 0 ]; then + export QTWEBENGINE_DISABLE_SANDBOX=1 +fi + for test in $(cat tst_list); do ( cd $(dirname ${test}) |