2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2022-04-01 14:15:30 +02:00
|
|
|
|
|
|
|
|
#include "processtestapp.h"
|
|
|
|
|
|
|
|
|
|
#include <app/app_version.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/launcherinterface.h>
|
2023-05-03 17:05:35 +02:00
|
|
|
#include <utils/process.h>
|
2022-04-01 14:15:30 +02:00
|
|
|
#include <utils/temporarydirectory.h>
|
|
|
|
|
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QScopeGuard>
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
#include <crtdbg.h>
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
|
{
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
// avoid crash reporter dialog
|
|
|
|
|
_set_error_mode(_OUT_TO_STDERR);
|
|
|
|
|
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
|
|
|
|
|
#endif
|
|
|
|
|
QCoreApplication app(argc, argv);
|
|
|
|
|
|
2023-06-07 09:39:30 +02:00
|
|
|
const QScopeGuard cleanup([] { Singleton::deleteAll(); });
|
2022-04-01 14:15:30 +02:00
|
|
|
|
|
|
|
|
TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/"
|
|
|
|
|
+ Core::Constants::IDE_CASED_ID + "-XXXXXX");
|
|
|
|
|
const QString libExecPath(qApp->applicationDirPath() + '/'
|
|
|
|
|
+ QLatin1String(TEST_RELATIVE_LIBEXEC_PATH));
|
|
|
|
|
LauncherInterface::setPathToLauncher(libExecPath);
|
|
|
|
|
SubProcessConfig::setPathToProcessTestApp(QLatin1String(PROCESS_TESTAPP));
|
|
|
|
|
|
|
|
|
|
QMetaObject::invokeMethod(&app, [] { ProcessTestApp::invokeSubProcess(); }, Qt::QueuedConnection);
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|