From ecf83d667cf4d5c5ea118af508a667d2f4ffe3f0 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 7 Dec 2022 15:13:48 +0100 Subject: [PATCH] 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 7a02b39f265f743879832a8ea5ad48767166cb31 Change-Id: I017b5a8f98b41ef6884c43d319858dcb16f17fba Reviewed-by: hjk --- src/libs/utils/stringtable.cpp | 14 +++----------- src/plugins/autotest/autotestplugin.cpp | 2 -- src/plugins/autotest/autotestunittests.cpp | 5 ----- src/plugins/autotest/autotestunittests.h | 1 - 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/libs/utils/stringtable.cpp b/src/libs/utils/stringtable.cpp index 90c97d7ba40..f53a1dd2127 100644 --- a/src/libs/utils/stringtable.cpp +++ b/src/libs/utils/stringtable.cpp @@ -11,10 +11,9 @@ #include #include -// FIXME: Re-create in better location? -//#ifdef WITH_TESTS -//#include -//#endif +// FIXME: 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. namespace Utils::StringTable { @@ -116,13 +115,6 @@ static inline bool isQStringInUse(const QString &string) void StringTablePrivate::GC(QFutureInterface &futureInterface) { -//#ifdef WITH_TESTS -// if (ExtensionSystem::PluginManager::isScenarioRunning("TestStringTable")) { -// if (ExtensionSystem::PluginManager::finishScenario()) -// QThread::sleep(5); -// } -//#endif - int initialSize = 0; bytesSaved = 0; QElapsedTimer timer; diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index 3c9fbbcad5b..98fff3472dc 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -283,8 +283,6 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri dd = new AutotestPluginPrivate; #ifdef WITH_TESTS - ExtensionSystem::PluginManager::registerScenario("TestStringTable", - [] { return dd->m_loadProjectScenario(); }); ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface", [] { return dd->m_loadProjectScenario(); }); #endif diff --git a/src/plugins/autotest/autotestunittests.cpp b/src/plugins/autotest/autotestunittests.cpp index 24b76567680..f2cf192ab30 100644 --- a/src/plugins/autotest/autotestunittests.cpp +++ b/src/plugins/autotest/autotestunittests.cpp @@ -291,11 +291,6 @@ static int executeScenario(const QString &scenario) return QProcess::execute(data.m_executable, data.m_args + additionalArgs); } -void AutoTestUnitTests::testStringTable() -{ - QCOMPARE(executeScenario("TestStringTable"), 0); -} - void AutoTestUnitTests::testModelManagerInterface() { QCOMPARE(executeScenario("TestModelManagerInterface"), 0); diff --git a/src/plugins/autotest/autotestunittests.h b/src/plugins/autotest/autotestunittests.h index 9be2433b37a..374477cd892 100644 --- a/src/plugins/autotest/autotestunittests.h +++ b/src/plugins/autotest/autotestunittests.h @@ -33,7 +33,6 @@ private slots: void testCodeParserGTest_data(); void testCodeParserBoostTest(); void testCodeParserBoostTest_data(); - void testStringTable(); void testModelManagerInterface(); private: