Add TestStringTable scenario

This scenario is used for testing against regression in StringTable.
If the scenario went OK, the creator finishes and doesn't crash.
Later, this scenario will be invoked from additional test, so that
the second instance of creator will run and the test will
check if the subprocess finished OK. So it's going to be combined
with autotests in the follow up patch.

In order to test it, run creator with the following command line:
"-settingspath ~/.config -scenario TestStringTable". Make sure,
that you point settingspath to creator settings which have
proper kit with a toolchain and Qt setup.

The regression may be tested by restoring the
src/plugins/cpptools/stringtable.cpp to the parent of
f4ab1279fd and by applying on top of it
this patch (simple conflict may need to be resolved). In this case
running this scenario ends up with a crash (so, it confirms this test
fails on the old code form before the fix).

Change-Id: Icbb56233495047fd68bfb605fcd088f352a16323
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jarek Kobus
2021-04-28 15:59:18 +02:00
parent e2cf0b52a7
commit a3b5306147
7 changed files with 184 additions and 3 deletions

View File

@@ -35,6 +35,10 @@
#include <QThreadPool>
#include <QTimer>
#ifdef WITH_TESTS
#include <extensionsystem/pluginmanager.h>
#endif
using namespace CppTools::Internal;
enum {
@@ -145,6 +149,13 @@ static inline bool isQStringInUse(const QString &string)
void StringTablePrivate::GC(QFutureInterface<void> &futureInterface)
{
#ifdef WITH_TESTS
if (ExtensionSystem::PluginManager::isScenarioRunning("TestStringTable")) {
if (ExtensionSystem::PluginManager::finishScenario())
QThread::currentThread()->sleep(5);
}
#endif
int initialSize = 0;
QElapsedTimer timer;
if (DebugStringTable) {