diff options
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbase.cpp | 2 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 21 | ||||
-rw-r--r-- | tests/auto/shared.h | 7 |
3 files changed, 19 insertions, 11 deletions
diff --git a/tests/auto/blackbox/tst_blackboxbase.cpp b/tests/auto/blackbox/tst_blackboxbase.cpp index e484aab6a..3b07b9390 100644 --- a/tests/auto/blackbox/tst_blackboxbase.cpp +++ b/tests/auto/blackbox/tst_blackboxbase.cpp @@ -167,7 +167,7 @@ void TestBlackboxBase::initTestCase() QVERIFY(regularFileExists(qbsExecutableFilePath)); const SettingsPtr s = settings(); - if (!s->profiles().contains(profileName())) + if (profileName() != "none" && !s->profiles().contains(profileName())) QFAIL(QByteArray("The build profile '" + profileName().toLocal8Bit() + "' could not be found. Please set it up on your machine.")); diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 14086401e..ae7c8dd92 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -30,6 +30,7 @@ #include "../shared.h" #include <tools/hostosinfo.h> +#include <tools/preferences.h> #include <tools/profile.h> #include <QtCore/qjsondocument.h> @@ -46,19 +47,21 @@ TestBlackboxQt::TestBlackboxQt() : TestBlackboxBase (SRCDIR "/testdata-qt", "bla void TestBlackboxQt::validateTestProfile() { const SettingsPtr s = settings(); - if (!s->profiles().contains(profileName())) + if (profileName() != "none" && !s->profiles().contains(profileName())) QFAIL(QByteArray("The build profile '" + profileName().toLocal8Bit() + "' could not be found. Please set it up on your machine.")); - Profile buildProfile(profileName(), s.get()); const QStringList searchPaths - = buildProfile.value(QLatin1String("preferences.qbsSearchPaths")).toStringList(); - if (searchPaths.isEmpty()) - QFAIL(QByteArray("The build profile '" + profileName().toLocal8Bit() + - "' is not a valid Qt profile.")); - if (!QFileInfo(searchPaths.first()).isDir()) - QFAIL(QByteArray("The build profile '" + profileName().toLocal8Bit() + - "' points to an invalid qbs search path.")); + = qbs::Preferences(s.get(), profileName()).searchPaths( + QDir::cleanPath(QCoreApplication::applicationDirPath())); + for (const auto &searchPath : searchPaths) { + if (QFileInfo(searchPath + "/modules/Qt").isDir()) + return; + } + + QSKIP(QByteArray("The build profile '" + profileName().toLocal8Bit() + + "' is not a valid Qt profile and Qt was not found " + "in the global search paths.")); } void TestBlackboxQt::autoQrc() diff --git a/tests/auto/shared.h b/tests/auto/shared.h index 6a0caaa3c..8c4689e31 100644 --- a/tests/auto/shared.h +++ b/tests/auto/shared.h @@ -60,7 +60,12 @@ inline SettingsPtr settings() return SettingsPtr(new qbs::Settings(settingsDir)); } -inline QString profileName() { return QLatin1String("qbs_autotests"); } +inline QString profileName() +{ + const QString profile = QLatin1String(qgetenv("QBS_AUTOTEST_PROFILE")); + return !profile.isEmpty() ? profile : QLatin1String("none"); +} + inline QString relativeBuildDir(const QString &configurationName = QString()) { return !configurationName.isEmpty() ? configurationName : QLatin1String("default"); |