aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/tst_blackboxbaremetal.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2021-01-29 16:06:44 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2021-02-02 08:15:11 +0000
commit0d0acf7d4dfaedce6d849d2db4613ca8a4e9952b (patch)
tree8b2a496cf87aeb2898acff9504c7acc91c7c94b8 /tests/auto/blackbox/tst_blackboxbaremetal.cpp
parent9c547478870237086578ebec430698f28e7c14e9 (diff)
baremetal: Improve detection of IAR compiler includes
The IAR compiler has an undocumented command line option `--IDE3`, which allows you to print a list of compiler include paths as: `$$TOOL_BEGIN $$VERSION "3" $$INC_BEGIN $$FILEPATH "<path\\to\\directory>" $$TOOL_END` Besides, the same approach is used in the IAR extension for the VSCode IDE. So we can use this approach to implement it the Qbs module as well. In addition, this commit contains an autotest to check the `cpp.compilerIncludePaths` property. Change-Id: I434dd630913e5afd6cba5b4e31e1021ee0c5fe31 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'tests/auto/blackbox/tst_blackboxbaremetal.cpp')
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
index 41f50a0ed..6d7590209 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
@@ -32,6 +32,7 @@
#include "../shared.h"
+#include <QtCore/qdir.h>
#include <QtCore/qregularexpression.h>
static bool extractToolset(const QByteArray &output,
@@ -47,6 +48,17 @@ static bool extractToolset(const QByteArray &output,
return true;
}
+static bool extractCompilerIncludePaths(const QByteArray &output, QStringList &compilerIncludePaths)
+{
+ const QRegularExpression re("%%([^%%]+)%%");
+ QRegularExpressionMatchIterator it = re.globalMatch(output);
+ if (!it.hasNext())
+ return false;
+ const QRegularExpressionMatch match = it.next();
+ compilerIncludePaths = match.captured(1).split(",");
+ return true;
+}
+
static QByteArray unsupportedToolsetMessage(const QByteArray &output)
{
QByteArray toolchain;
@@ -142,6 +154,22 @@ void TestBlackboxBareMetal::distributionIncludePaths()
QCOMPARE(runQbs(), 0);
}
+void TestBlackboxBareMetal::compilerIncludePaths()
+{
+ QDir::setCurrent(testDataDir + "/compiler-include-paths");
+ QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
+ if (!m_qbsStdout.contains("compilerIncludePaths:"))
+ QFAIL("No compiler include paths exists");
+
+ QStringList includePaths;
+ QVERIFY(extractCompilerIncludePaths(m_qbsStdout, includePaths));
+ QVERIFY(includePaths.count() > 0);
+ for (const auto &includePath : includePaths) {
+ const QDir dir(includePath);
+ QVERIFY(dir.exists());
+ }
+}
+
void TestBlackboxBareMetal::preincludeHeaders()
{
QDir::setCurrent(testDataDir + "/preinclude-headers");