aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-08-11 13:52:46 -0700
committerJake Petroules <jake.petroules@qt.io>2017-08-16 17:41:12 +0000
commit89983bbd11aed13d2365daf41392a450afdd7b57 (patch)
tree0e1af02a3b74bb9ec58c232a020db60a3ee7eb36
parentb25a9153de8995b733248ab401e6a951f86e4210 (diff)
Allow overriding the Qbs autotest profile with an environment variable
The default profile is now "none", ensuring that Qbs autotests will use a clean environment by default. This means that development can be done entirely within Qt Creator without having to separately configure Qbs from the command line. It also has the advantage that switching test profiles is much easier, for example in order to allow running the entire test suite for a cross compile target. Change-Id: I17b06952b577bfef9818338b59dd638492612e24 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--tests/auto/blackbox/tst_blackboxbase.cpp2
-rw-r--r--tests/auto/blackbox/tst_blackboxqt.cpp21
-rw-r--r--tests/auto/shared.h7
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");