diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2020-07-03 14:20:00 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2020-07-07 12:16:16 +0000 |
commit | bf05d78e4f169ea5dfb1daec19d25998b70456b2 (patch) | |
tree | 1f9e1b5a9ed61f83e49f5df1010cd3e08c8658ca | |
parent | d1990eb219beb3f28f3da9e1219ae0afd7558ef5 (diff) |
baremetal: Add 'one-object-asm-application' test for KEIL MCS51
This commit adds an auto-test which compiles an application
using one asm-source main module to check that an assembler
does work correctly.
Change-Id: I38d512f62bab2e96781405632822f81c13673064
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
3 files changed, 47 insertions, 1 deletions
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/mcs51-keil.asm b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/mcs51-keil.asm new file mode 100644 index 000000000..ba48fac90 --- /dev/null +++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/mcs51-keil.asm @@ -0,0 +1,7 @@ +PUBLIC main + +MAIN_SEG SEGMENT CODE + RSEG MAIN_SEG +main: + RET +END diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs new file mode 100644 index 000000000..89e71edeb --- /dev/null +++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs @@ -0,0 +1,14 @@ +import "../BareMetalApplication.qbs" as BareMetalApplication + +BareMetalApplication { + condition: { + if (qbs.toolchainType === "keil") { + if (qbs.architecture === "mcs51") + return true; + } + console.info("unsupported toolset: %%" + + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); + return false; + } + files: [qbs.architecture + "-" + qbs.toolchainType + ".asm"] +} diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp index cd24d0af5..a80a1ad8f 100644 --- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp +++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp @@ -32,6 +32,21 @@ #include "../shared.h" +#include <QtCore/qregularexpression.h> + +static bool extractUnsupportedToolset(const QByteArray &output, + QByteArray &toolchain, QByteArray &architecture) +{ + const QRegularExpression re("%%(\\w+)%%, %%(\\w+)%%"); + QRegularExpressionMatchIterator it = re.globalMatch(output); + if (!it.hasNext()) + return false; + const QRegularExpressionMatch match = it.next(); + toolchain = match.captured(1).toLocal8Bit(); + architecture = match.captured(2).toLocal8Bit(); + return true; +} + TestBlackboxBareMetal::TestBlackboxBareMetal() : TestBlackboxBase (SRCDIR "/testdata-baremetal", "blackbox-baremetal") { @@ -42,13 +57,23 @@ void TestBlackboxBareMetal::application_data() QTest::addColumn<QString>("testPath"); QTest::newRow("one-object-application") << "/one-object-application"; QTest::newRow("two-object-application") << "/two-object-application"; + QTest::newRow("one-object-asm-application") << "/one-object-asm-application"; } void TestBlackboxBareMetal::application() { QFETCH(QString, testPath); QDir::setCurrent(testDataDir + testPath); - QCOMPARE(runQbs(), 0); + QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); + if (!m_qbsStdout.contains("unsupported toolset:")) { + QCOMPARE(runQbs(), 0); + } else { + QByteArray toolchain; + QByteArray architecture; + extractUnsupportedToolset(m_qbsStdout, toolchain, architecture); + QSKIP("Unsupported toolchain '" + toolchain + + "' for architecture '" + architecture + "'"); + } } void TestBlackboxBareMetal::staticLibraryDependencies() |