forked from qt-creator/qt-creator
Add TestStringTable test
The TestStringTable tests the fix provided for a crash in StringTable
on shutdown.
Amends: f4ab1279fd
Task-number: QTCREATORBUG-25417
Change-Id: I5a4a7e4a20e1b9611682a976d38dee17d4603c5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -435,7 +435,9 @@ public:
|
||||
|
||||
void setArguments(const QStringList &args) { m_args = args; }
|
||||
|
||||
QString executable() const { return m_executable; }
|
||||
QStringList arguments() const { return m_args; }
|
||||
QString workingPath() const { return m_workingPath; }
|
||||
|
||||
int restartOrExit(int exitCode)
|
||||
{
|
||||
@@ -696,6 +698,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
restarter.setArguments(options.preAppArguments + PluginManager::argumentsForRestart()
|
||||
+ lastSessionArgument());
|
||||
const PluginManager::ProcessData processData = { restarter.executable(),
|
||||
options.preAppArguments + PluginManager::argumentsForRestart(), restarter.workingPath() };
|
||||
PluginManager::setCreatorProcessData(processData);
|
||||
|
||||
const PluginSpecSet plugins = PluginManager::plugins();
|
||||
PluginSpec *coreplugin = nullptr;
|
||||
|
@@ -881,6 +881,16 @@ void PluginManager::waitForScenarioFullyInitialized()
|
||||
}
|
||||
#endif
|
||||
|
||||
void PluginManager::setCreatorProcessData(const PluginManager::ProcessData &data)
|
||||
{
|
||||
d->m_creatorProcessData = data;
|
||||
}
|
||||
|
||||
PluginManager::ProcessData PluginManager::creatorProcessData()
|
||||
{
|
||||
return d->m_creatorProcessData;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
|
@@ -133,6 +133,15 @@ public:
|
||||
// void scenarioPointTriggered(const QVariant pointData); // ?? e.g. in StringTable::GC() -> post a call to quit into main thread and sleep for 5 seconds in the GC thread
|
||||
#endif
|
||||
|
||||
struct ProcessData {
|
||||
QString m_executable;
|
||||
QStringList m_args;
|
||||
QString m_workingPath;
|
||||
};
|
||||
|
||||
static void setCreatorProcessData(const ProcessData &data);
|
||||
static ProcessData creatorProcessData();
|
||||
|
||||
static void profilingReport(const char *what, const PluginSpec *spec = nullptr);
|
||||
|
||||
static QString platformName();
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "pluginspec.h"
|
||||
#include "pluginmanager.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
@@ -153,6 +154,8 @@ public:
|
||||
QMutex m_scenarioMutex;
|
||||
QWaitCondition m_scenarioWaitCondition;
|
||||
|
||||
PluginManager::ProcessData m_creatorProcessData;
|
||||
|
||||
private:
|
||||
PluginManager *q;
|
||||
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include <cpptools/cpptoolstestcase.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -46,6 +48,7 @@
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
using namespace Core;
|
||||
using namespace ExtensionSystem;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
@@ -304,5 +307,11 @@ void AutoTestUnitTests::testCodeParserBoostTest_data()
|
||||
<< QString(m_tmpDir->path() + "/simple_boost/simple_boost.qbs") << QString(".qbs");
|
||||
}
|
||||
|
||||
void AutoTestUnitTests::testStringTable()
|
||||
{
|
||||
const PluginManager::ProcessData data = PluginManager::creatorProcessData();
|
||||
QCOMPARE(QProcess::execute(data.m_executable, data.m_args + QStringList({ "-scenario", "TestStringTable" })), 0);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
|
@@ -55,6 +55,7 @@ private slots:
|
||||
void testCodeParserGTest_data();
|
||||
void testCodeParserBoostTest();
|
||||
void testCodeParserBoostTest_data();
|
||||
void testStringTable();
|
||||
|
||||
private:
|
||||
TestTreeModel *m_model = nullptr;
|
||||
|
Reference in New Issue
Block a user