diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2022-02-12 19:07:16 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2022-02-21 13:38:51 +0000 |
commit | 7d83ab5bdf8026b142da22d5fa2627f405c1bca9 (patch) | |
tree | 8cad3028307be43647de43bd0f6530986d890816 /tests/auto/blackbox | |
parent | 5a7aac60df8000bd4c5ed255f69eaf4b9d5b92db (diff) | |
download | qbs-7d83ab5bdf8026b142da22d5fa2627f405c1bca9.tar.gz |
baremetal: Add test to check toolchain probes
Right now we don't have tests that could check the correctness of the
properties returned by toolchain probes.
For example, such as `architecture`, `targetPlatform`, `endianness`
and so forth. The number of returned parameters depends on the type
of toolchain.
This patch adds a test for the probe for the `watcom` toolchain and
can be used as a template for adding the tests for other probes in the
future.
Change-Id: I5ebda0deb7538f746406f5b0925bdd60fdb4c3fb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/blackbox')
4 files changed, 58 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata-baremetal/toolchain-probe/probes/watcom.qbs b/tests/auto/blackbox/testdata-baremetal/toolchain-probe/probes/watcom.qbs new file mode 100644 index 000000000..b7c92dc21 --- /dev/null +++ b/tests/auto/blackbox/testdata-baremetal/toolchain-probe/probes/watcom.qbs @@ -0,0 +1,34 @@ +import qbs.Probes + +Product { + id: product + condition: qbs.toolchainType === "watcom" + + Depends { name: "cpp" } + + Probes.WatcomProbe { + id: probe + compilerFilePath: cpp.compilerPath + enableDefinesByLanguage: cpp.enableCompilerDefinesByLanguage + _pathListSeparator: qbs.pathListSeparator + _toolchainInstallPath: cpp.toolchainInstallPath + _targetPlatform: qbs.targetPlatform + _targetArchitecture: qbs.architecture + } + + property bool dummy: { + if (!product.condition) + return; + if (!probe.found + || !probe.endianness + || !probe.compilerDefinesByLanguage + || !probe.environment + || !probe.includePaths + || (probe.includePaths.length === 0) + || (qbs.architecture !== probe.architecture) + || (qbs.targetPlatform !== probe.targetPlatform)) { + console.info("broken probe: %%" + qbs.toolchainType + "%%, %%" + + qbs.architecture + "%%"); + } + } +} diff --git a/tests/auto/blackbox/testdata-baremetal/toolchain-probe/toolchain-probe.qbs b/tests/auto/blackbox/testdata-baremetal/toolchain-probe/toolchain-probe.qbs new file mode 100644 index 000000000..5628e9b07 --- /dev/null +++ b/tests/auto/blackbox/testdata-baremetal/toolchain-probe/toolchain-probe.qbs @@ -0,0 +1,5 @@ +Project { + references: [ + "probes/watcom.qbs", + ] +} diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp index 740b9c463..5de30b4e1 100644 --- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp +++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp @@ -78,6 +78,15 @@ static QByteArray unsupportedToolsetMessage(const QByteArray &output) + "' for architecture '" + architecture + "'"; } +static QByteArray brokenProbeMessage(const QByteArray &output) +{ + QByteArray toolchain; + QByteArray architecture; + extractToolset(output, toolchain, architecture); + return "Broken probe for toolchain '" + toolchain + + "' for architecture '" + architecture + "'"; +} + TestBlackboxBareMetal::TestBlackboxBareMetal() : TestBlackboxBase (SRCDIR "/testdata-baremetal", "blackbox-baremetal") { @@ -292,4 +301,12 @@ void TestBlackboxBareMetal::compilerDefinesByLanguage() QCOMPARE(runQbs(params), 0); } +void TestBlackboxBareMetal::toolchainProbe() +{ + QDir::setCurrent(testDataDir + "/toolchain-probe"); + QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); + if (m_qbsStdout.contains("broken probe:")) + QFAIL(brokenProbeMessage(m_qbsStdout)); +} + QTEST_MAIN(TestBlackboxBareMetal) diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.h b/tests/auto/blackbox/tst_blackboxbaremetal.h index 8e9e29e8b..9c45fa63c 100644 --- a/tests/auto/blackbox/tst_blackboxbaremetal.h +++ b/tests/auto/blackbox/tst_blackboxbaremetal.h @@ -68,6 +68,8 @@ private slots: void compilerDefinesByLanguage(); + void toolchainProbe(); + private: }; |