diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-29 10:19:43 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-29 11:41:44 +0000 |
commit | 49a54f5d20a7d49277d3d0ae4d3ff0cea457bf70 (patch) | |
tree | 38937bf6d402abaa2d359e40194ed20e2697750c /tests | |
parent | 65eb5b2b2b4aa67052d959a207d97c1987be1cb3 (diff) |
Fix TestBlackboxExamples for environments without Qt
The same way as TestBlackboxQt does.
Change-Id: Ic040eb3d4c0f5946ca24978090bf342121280260
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbase.cpp | 20 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbase.h | 5 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxexamples.cpp | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 18 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.h | 3 |
5 files changed, 26 insertions, 21 deletions
diff --git a/tests/auto/blackbox/tst_blackboxbase.cpp b/tests/auto/blackbox/tst_blackboxbase.cpp index 90afaabfc..a99b037c9 100644 --- a/tests/auto/blackbox/tst_blackboxbase.cpp +++ b/tests/auto/blackbox/tst_blackboxbase.cpp @@ -194,6 +194,26 @@ void TestBlackboxBase::initTestCase() QVERIFY(copyDllExportHeader(testSourceDir, testDataDir)); } +void TestBlackboxBase::validateTestProfile() +{ + const SettingsPtr s = settings(); + 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.")); + if (!m_needsQt) + return; + const QStringList qmakeFilePaths = Profile(profileName(), s.get()) + .value("moduleProviders.Qt.qmakeFilePaths").toStringList(); + if (!qmakeFilePaths.empty()) + return; + if (!findExecutable(QStringList{"qmake"}).isEmpty()) + return; + QSKIP(QByteArray("The build profile '" + profileName().toLocal8Bit() + + "' is not a valid Qt profile and Qt was not found " + "in the global search paths.")); + +} + QString TestBlackboxBase::findExecutable(const QStringList &fileNames) { const QStringList path = QString::fromLocal8Bit(qgetenv("PATH")) diff --git a/tests/auto/blackbox/tst_blackboxbase.h b/tests/auto/blackbox/tst_blackboxbase.h index 518cc80d0..ed9a233de 100644 --- a/tests/auto/blackbox/tst_blackboxbase.h +++ b/tests/auto/blackbox/tst_blackboxbase.h @@ -84,7 +84,9 @@ public slots: virtual void initTestCase(); protected: - virtual void validateTestProfile() { } + virtual void validateTestProfile(); + + void setNeedsQt() { m_needsQt = true; } int runQbs(const QbsRunParameters ¶ms = QbsRunParameters()); void rmDirR(const QString &dir); static QByteArray unifiedLineEndings(const QByteArray &ba); @@ -101,6 +103,7 @@ protected: QByteArray m_qbsStderr; QByteArray m_qbsStdout; + int m_needsQt = false; }; #endif // TST_BLACKBOXBASE_H diff --git a/tests/auto/blackbox/tst_blackboxexamples.cpp b/tests/auto/blackbox/tst_blackboxexamples.cpp index 1da56b311..b6a26b7f3 100644 --- a/tests/auto/blackbox/tst_blackboxexamples.cpp +++ b/tests/auto/blackbox/tst_blackboxexamples.cpp @@ -50,6 +50,7 @@ QStringList TestBlackboxExamples::collectExamples(const QString &dirPath) TestBlackboxExamples::TestBlackboxExamples() : TestBlackboxBase(SRCDIR "/../../../examples/", "blackbox-examples") { + setNeedsQt(); } void TestBlackboxExamples::baremetal_data() diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 595a173a2..f77509b4d 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -42,23 +42,7 @@ using qbs::Profile; TestBlackboxQt::TestBlackboxQt() : TestBlackboxBase (SRCDIR "/testdata-qt", "blackbox-qt") { -} - -void TestBlackboxQt::validateTestProfile() -{ - const SettingsPtr s = settings(); - 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.")); - const QStringList qmakeFilePaths = Profile(profileName(), s.get()) - .value("moduleProviders.Qt.qmakeFilePaths").toStringList(); - if (!qmakeFilePaths.empty()) - return; - if (!findExecutable(QStringList{"qmake"}).isEmpty()) - return; - QSKIP(QByteArray("The build profile '" + profileName().toLocal8Bit() + - "' is not a valid Qt profile and Qt was not found " - "in the global search paths.")); + setNeedsQt(); } void TestBlackboxQt::addQObjectMacroToGeneratedCppFile() diff --git a/tests/auto/blackbox/tst_blackboxqt.h b/tests/auto/blackbox/tst_blackboxqt.h index 4008b14ca..18c9d1a58 100644 --- a/tests/auto/blackbox/tst_blackboxqt.h +++ b/tests/auto/blackbox/tst_blackboxqt.h @@ -38,9 +38,6 @@ class TestBlackboxQt : public TestBlackboxBase public: TestBlackboxQt(); -protected: - void validateTestProfile() override; - private slots: void addQObjectMacroToGeneratedCppFile(); void autoQrc(); |