Make it possible to preserve the library/plugin path in tst_selftest

If QT_PRESERVE_TESTLIB_PATH is set, then LD_LIBRARY_PATH and
QT_PLUGIN_PATH won't be filtered out for the sub-tests started by
tst_selftest.

Change-Id: Ic43ba9b4d882ee36b2f7495b1c880f26aefd2629
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
This commit is contained in:
Christian Strømme 2016-02-10 19:02:40 +01:00 committed by Christian Stromme
parent b6a824d0a3
commit d392826959

View File

@ -543,6 +543,7 @@ static QProcessEnvironment processEnvironment()
static QProcessEnvironment result;
if (result.isEmpty()) {
const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
const bool preserveLibPath = qEnvironmentVariableIsSet("QT_PRESERVE_TESTLIB_PATH");
foreach (const QString &key, systemEnvironment.keys()) {
const bool useVariable = key == QLatin1String("PATH") || key == QLatin1String("QT_QPA_PLATFORM")
#if defined(Q_OS_QNX)
@ -557,6 +558,8 @@ static QProcessEnvironment processEnvironment()
#ifdef __COVERAGESCANNER__
|| key == QLatin1String("QT_TESTCOCOON_ACTIVE")
#endif
|| ( preserveLibPath && (key == QLatin1String("QT_PLUGIN_PATH")
|| key == QLatin1String("LD_LIBRARY_PATH")))
;
if (useVariable)
result.insert(key, systemEnvironment.value(key));