AutoTestUnitTests: Remove TestStringTable scenario

Instead, we should provide tst_StringTable that would
run GC, make a sleep inside GC being run in other thread
and execute destructor of StringTable in main thread.
In this case the test should ensure that destructor of
StringTable waits for its internal thread to finish.

Amends 7a02b39f26

Change-Id: I017b5a8f98b41ef6884c43d319858dcb16f17fba
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-12-07 15:13:48 +01:00
parent 9a8d34ecf8
commit ecf83d667c
4 changed files with 3 additions and 19 deletions

View File

@@ -11,10 +11,9 @@
#include <QSet> #include <QSet>
#include <QTimer> #include <QTimer>
// FIXME: Re-create in better location? // FIXME: Provide tst_StringTable that would run GC, make a sleep inside GC being run in other
//#ifdef WITH_TESTS // thread and execute destructor of StringTable in main thread. In this case the test should
//#include <extensionsystem/pluginmanager.h> // ensure that destructor of StringTable waits for its internal thread to finish.
//#endif
namespace Utils::StringTable { namespace Utils::StringTable {
@@ -116,13 +115,6 @@ static inline bool isQStringInUse(const QString &string)
void StringTablePrivate::GC(QFutureInterface<void> &futureInterface) void StringTablePrivate::GC(QFutureInterface<void> &futureInterface)
{ {
//#ifdef WITH_TESTS
// if (ExtensionSystem::PluginManager::isScenarioRunning("TestStringTable")) {
// if (ExtensionSystem::PluginManager::finishScenario())
// QThread::sleep(5);
// }
//#endif
int initialSize = 0; int initialSize = 0;
bytesSaved = 0; bytesSaved = 0;
QElapsedTimer timer; QElapsedTimer timer;

View File

@@ -283,8 +283,6 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
dd = new AutotestPluginPrivate; dd = new AutotestPluginPrivate;
#ifdef WITH_TESTS #ifdef WITH_TESTS
ExtensionSystem::PluginManager::registerScenario("TestStringTable",
[] { return dd->m_loadProjectScenario(); });
ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface", ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface",
[] { return dd->m_loadProjectScenario(); }); [] { return dd->m_loadProjectScenario(); });
#endif #endif

View File

@@ -291,11 +291,6 @@ static int executeScenario(const QString &scenario)
return QProcess::execute(data.m_executable, data.m_args + additionalArgs); return QProcess::execute(data.m_executable, data.m_args + additionalArgs);
} }
void AutoTestUnitTests::testStringTable()
{
QCOMPARE(executeScenario("TestStringTable"), 0);
}
void AutoTestUnitTests::testModelManagerInterface() void AutoTestUnitTests::testModelManagerInterface()
{ {
QCOMPARE(executeScenario("TestModelManagerInterface"), 0); QCOMPARE(executeScenario("TestModelManagerInterface"), 0);

View File

@@ -33,7 +33,6 @@ private slots:
void testCodeParserGTest_data(); void testCodeParserGTest_data();
void testCodeParserBoostTest(); void testCodeParserBoostTest();
void testCodeParserBoostTest_data(); void testCodeParserBoostTest_data();
void testStringTable();
void testModelManagerInterface(); void testModelManagerInterface();
private: private: