summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2021-06-09 09:22:27 +0200
committerChristian Stenger <christian.stenger@qt.io>2021-06-09 12:24:39 +0000
commit093f3479ce19ad559d3a07263a23de6fa3e60c09 (patch)
treec5697c29a23dd77221f3785ae2bcabc28912b3cb /src
parentfed5a44be168895b4fa5dc4ede52cec631beb7c9 (diff)
downloadqt-creator-093f3479ce19ad559d3a07263a23de6fa3e60c09.tar.gz
Fix execution of scenario
There are different ways of having a settingspath for QC. If the settingspath is not provided for starting QC we may use the global settings or a temporarily created settings folder. To correctly run the test scenario from inside a plugin unit test we need to have the same environment and settings. Change-Id: I5dcc61e162258a0af8d3c8df2e63255d0e35f464 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/app/main.cpp6
-rw-r--r--src/libs/extensionsystem/pluginmanager.h1
-rw-r--r--src/plugins/autotest/autotestunittests.cpp5
3 files changed, 10 insertions, 2 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 57b4281c51..b10eea891c 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -698,8 +698,12 @@ int main(int argc, char **argv)
}
restarter.setArguments(options.preAppArguments + PluginManager::argumentsForRestart()
+ lastSessionArgument());
+ // if settingspath is not provided we need to pass on the settings in use
+ const QString settingspath = options.preAppArguments.contains(QLatin1String(SETTINGS_OPTION))
+ ? QString() : options.settingsPath;
const PluginManager::ProcessData processData = { restarter.executable(),
- options.preAppArguments + PluginManager::argumentsForRestart(), restarter.workingPath() };
+ options.preAppArguments + PluginManager::argumentsForRestart(), restarter.workingPath(),
+ settingspath};
PluginManager::setCreatorProcessData(processData);
const PluginSpecSet plugins = PluginManager::plugins();
diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h
index 17be0dbfbe..bd93d3d78f 100644
--- a/src/libs/extensionsystem/pluginmanager.h
+++ b/src/libs/extensionsystem/pluginmanager.h
@@ -137,6 +137,7 @@ public:
QString m_executable;
QStringList m_args;
QString m_workingPath;
+ QString m_settingsPath;
};
static void setCreatorProcessData(const ProcessData &data);
diff --git a/src/plugins/autotest/autotestunittests.cpp b/src/plugins/autotest/autotestunittests.cpp
index 6ae27bd70d..e395e71379 100644
--- a/src/plugins/autotest/autotestunittests.cpp
+++ b/src/plugins/autotest/autotestunittests.cpp
@@ -310,7 +310,10 @@ void AutoTestUnitTests::testCodeParserBoostTest_data()
void AutoTestUnitTests::testStringTable()
{
const PluginManager::ProcessData data = PluginManager::creatorProcessData();
- QCOMPARE(QProcess::execute(data.m_executable, data.m_args + QStringList({ "-scenario", "TestStringTable" })), 0);
+ QStringList additionalArgs{ "-scenario", "TestStringTable" };
+ if (!data.m_args.contains("-settingspath") && !data.m_settingsPath.isEmpty())
+ additionalArgs << "-settingspath" << data.m_settingsPath;
+ QCOMPARE(QProcess::execute(data.m_executable, data.m_args + additionalArgs), 0);
}
} // namespace Internal