diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-08-11 13:52:46 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-08-16 17:41:12 +0000 |
commit | 89983bbd11aed13d2365daf41392a450afdd7b57 (patch) | |
tree | 0e1af02a3b74bb9ec58c232a020db60a3ee7eb36 /tests/auto/blackbox/tst_blackboxqt.cpp | |
parent | b25a9153de8995b733248ab401e6a951f86e4210 (diff) | |
download | qbs-89983bbd11aed13d2365daf41392a450afdd7b57.tar.gz |
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>
Diffstat (limited to 'tests/auto/blackbox/tst_blackboxqt.cpp')
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
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() |