aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/tst_blackboxbaremetal.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2020-08-05 23:53:04 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2020-08-07 14:45:03 +0000
commit3c6ae1f54008ffba6a1e1d47f929d706df744729 (patch)
treeb7e89f2d9f13cd0dd231e6cc81c6136f04650ac8 /tests/auto/blackbox/tst_blackboxbaremetal.cpp
parent1d9803b7f69454ee13b1fa06d34616282a92d995 (diff)
baremetal: Add new 'generate-compiler-listing-files' test
This test checks the cpp.generateCompilerListingFiles property, which enables or disables generation for the compiler listing files. Take into account, that currently not all toolchains completely supports or implements this feature, and this test skips such toolchains. Change-Id: I533e6b2e5b4af5668cf24f851334b9530bc3a901 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'tests/auto/blackbox/tst_blackboxbaremetal.cpp')
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.cpp89
1 files changed, 50 insertions, 39 deletions
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
index 1f79ad5c7..9dc8bbab3 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
@@ -47,6 +47,15 @@ static bool extractUnsupportedToolset(const QByteArray &output,
return true;
}
+static QByteArray unsupportedToolsetMessage(const QByteArray &output)
+{
+ QByteArray toolchain;
+ QByteArray architecture;
+ extractUnsupportedToolset(output, toolchain, architecture);
+ return "Unsupported toolchain '" + toolchain
+ + "' for architecture '" + architecture + "'";
+}
+
TestBlackboxBareMetal::TestBlackboxBareMetal()
: TestBlackboxBase (SRCDIR "/testdata-baremetal", "blackbox-baremetal")
{
@@ -56,18 +65,12 @@ void TestBlackboxBareMetal::targetPlatform()
{
QDir::setCurrent(testDataDir + "/target-platform");
QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
- if (!m_qbsStdout.contains("unsupported toolset:")) {
- const bool hasNoPlatform = m_qbsStdout.contains("has no platform: true");
- QCOMPARE(hasNoPlatform, true);
- const bool hasNoOS = m_qbsStdout.contains("has no os: true");
- QCOMPARE(hasNoOS, true);
- } else {
- QByteArray toolchain;
- QByteArray architecture;
- extractUnsupportedToolset(m_qbsStdout, toolchain, architecture);
- QSKIP("Unsupported toolchain '" + toolchain
- + "' for architecture '" + architecture + "'");
- }
+ if (m_qbsStdout.contains("unsupported toolset:"))
+ QSKIP(unsupportedToolsetMessage(m_qbsStdout));
+ const bool hasNoPlatform = m_qbsStdout.contains("has no platform: true");
+ QCOMPARE(hasNoPlatform, true);
+ const bool hasNoOS = m_qbsStdout.contains("has no os: true");
+ QCOMPARE(hasNoOS, true);
}
void TestBlackboxBareMetal::application_data()
@@ -83,15 +86,9 @@ void TestBlackboxBareMetal::application()
QFETCH(QString, testPath);
QDir::setCurrent(testDataDir + testPath);
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 + "'");
- }
+ if (m_qbsStdout.contains("unsupported toolset:"))
+ QSKIP(unsupportedToolsetMessage(m_qbsStdout));
+ QCOMPARE(runQbs(), 0);
}
void TestBlackboxBareMetal::staticLibraryDependencies()
@@ -111,15 +108,9 @@ void TestBlackboxBareMetal::externalStaticLibraries()
{
QDir::setCurrent(testDataDir + "/external-static-libraries");
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 + "'");
- }
+ if (m_qbsStdout.contains("unsupported toolset:"))
+ QSKIP(unsupportedToolsetMessage(m_qbsStdout));
+ QCOMPARE(runQbs(), 0);
}
void TestBlackboxBareMetal::userIncludePaths()
@@ -144,15 +135,9 @@ void TestBlackboxBareMetal::preincludeHeaders()
{
QDir::setCurrent(testDataDir + "/preinclude-headers");
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 + "'");
- }
+ if (m_qbsStdout.contains("unsupported toolset:"))
+ QSKIP(unsupportedToolsetMessage(m_qbsStdout));
+ QCOMPARE(runQbs(), 0);
}
void TestBlackboxBareMetal::defines()
@@ -161,4 +146,30 @@ void TestBlackboxBareMetal::defines()
QCOMPARE(runQbs(), 0);
}
+void TestBlackboxBareMetal::compilerListingFiles_data()
+{
+ QTest::addColumn<QString>("testPath");
+ QTest::addColumn<bool>("generateListing");
+ QTest::newRow("do-not-generate-compiler-listing") << "/do-not-generate-compiler-listing" << false;
+ QTest::newRow("generate-compiler-listing") << "/generate-compiler-listing" << true;
+}
+
+void TestBlackboxBareMetal::compilerListingFiles()
+{
+ QFETCH(QString, testPath);
+ QFETCH(bool, generateListing);
+ QDir::setCurrent(testDataDir + testPath);
+ QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
+ if (m_qbsStdout.contains("unsupported toolset:"))
+ QSKIP(unsupportedToolsetMessage(m_qbsStdout));
+ QCOMPARE(runQbs(), 0);
+ const QString productName = testPath.mid(1);
+ const QString productBuildDir = relativeProductBuildDir(productName);
+ const QString hash = inputDirHash(".");
+ const QString mainListing = productBuildDir + "/" + hash + "/main.c.lst";
+ QCOMPARE(regularFileExists(mainListing), generateListing);
+ const QString fooListing = productBuildDir + "/" + hash + "/fun.c.lst";
+ QCOMPARE(regularFileExists(fooListing), generateListing);
+}
+
QTEST_MAIN(TestBlackboxBareMetal)