forked from qt-creator/qt-creator
Fix issues with Meson tests
- set temporary directory for launcher - check for finding meson tool instead of crashing - use GUILESS_MAIN since it doesn't use gui Change-Id: I3f8de658d9ccbec3efb260cf2d58e27720e78d47 Reviewed-by: Alexis Jeandet <alexis.jeandet@member.fsf.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <utils/launcherinterface.h>
|
||||
#include <utils/singleton.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
@@ -56,7 +57,9 @@ static const QList<projectData> projectList{
|
||||
#define WITH_CONFIGURED_PROJECT(_source_dir, _build_dir, ...) \
|
||||
{ \
|
||||
QTemporaryDir _build_dir{"test-meson"}; \
|
||||
const auto _meson = MesonWrapper("name", *MesonWrapper::find()); \
|
||||
const auto tool = MesonWrapper::find(); \
|
||||
QVERIFY(tool.has_value()); \
|
||||
const auto _meson = MesonWrapper("name", *tool); \
|
||||
run_meson(_meson.setup(Utils::FilePath::fromString(_source_dir), \
|
||||
Utils::FilePath::fromString(_build_dir.path()))); \
|
||||
QVERIFY(isSetup(Utils::FilePath::fromString(_build_dir.path()))); \
|
||||
@@ -67,7 +70,9 @@ static const QList<projectData> projectList{
|
||||
{ \
|
||||
QTemporaryFile _intro_file; \
|
||||
_intro_file.open(); \
|
||||
const auto _meson = MesonWrapper("name", *MesonWrapper::find()); \
|
||||
const auto tool = MesonWrapper::find(); \
|
||||
QVERIFY(tool.has_value()); \
|
||||
const auto _meson = MesonWrapper("name", *tool); \
|
||||
run_meson(_meson.introspect(Utils::FilePath::fromString(_source_dir)), &_intro_file); \
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
@@ -79,6 +84,8 @@ class AMesonInfoParser : public QObject
|
||||
private slots:
|
||||
void initTestCase()
|
||||
{
|
||||
Utils::TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath()
|
||||
+ "/mesontest-XXXXXX");
|
||||
Utils::LauncherInterface::setPathToLauncher(qApp->applicationDirPath() + '/'
|
||||
+ QLatin1String(TEST_RELATIVE_LIBEXEC_PATH));
|
||||
}
|
||||
@@ -126,5 +133,5 @@ private slots:
|
||||
private:
|
||||
};
|
||||
|
||||
QTEST_MAIN(AMesonInfoParser)
|
||||
QTEST_GUILESS_MAIN(AMesonInfoParser)
|
||||
#include "testmesoninfoparser.moc"
|
||||
|
||||
@@ -296,6 +296,6 @@ private slots:
|
||||
void cleanupTestCase() {}
|
||||
};
|
||||
|
||||
QTEST_MAIN(AMesonOutputParser)
|
||||
QTEST_GUILESS_MAIN(AMesonOutputParser)
|
||||
|
||||
#include "testmesonparser.moc"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <utils/launcherinterface.h>
|
||||
#include <utils/singleton.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
@@ -50,6 +51,8 @@ class AMesonWrapper : public QObject
|
||||
private slots:
|
||||
void initTestCase()
|
||||
{
|
||||
Utils::TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath()
|
||||
+ "/mesontest-XXXXXX");
|
||||
Utils::LauncherInterface::setPathToLauncher(qApp->applicationDirPath() + '/'
|
||||
+ QLatin1String(TEST_RELATIVE_LIBEXEC_PATH));
|
||||
}
|
||||
@@ -120,5 +123,5 @@ private slots:
|
||||
private:
|
||||
};
|
||||
|
||||
QTEST_MAIN(AMesonWrapper)
|
||||
QTEST_GUILESS_MAIN(AMesonWrapper)
|
||||
#include "testmesonwrapper.moc"
|
||||
|
||||
@@ -108,5 +108,5 @@ private slots:
|
||||
void cleanupTestCase() {}
|
||||
};
|
||||
|
||||
QTEST_MAIN(ANinjaParser)
|
||||
QTEST_GUILESS_MAIN(ANinjaParser)
|
||||
#include "testninjaparser.moc"
|
||||
|
||||
Reference in New Issue
Block a user