aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2021-03-31 17:40:10 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2021-04-01 15:14:59 +0000
commit517a121ac97032942220acae60f7b93d49d930f9 (patch)
tree5b6e0a102528e6dd1c3b7ab0364e7762d85cd462
parente7f204c4b82475f39c3f5a3870a7393857b1a29a (diff)
baremetal: Improve 'linker-map' test
We don't need in multiple test data instances (*.qbs) for each property, because we can pass the required properties from the C++ code directly. Change-Id: I3bc05db5f6c0d2533f9799cbadb830c0c687e1e5 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r--tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs11
-rw-r--r--tests/auto/blackbox/testdata-baremetal/generate-linker-map/main.c4
-rw-r--r--tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs (renamed from tests/auto/blackbox/testdata-baremetal/generate-linker-map/generate-linker-map.qbs)1
-rw-r--r--tests/auto/blackbox/testdata-baremetal/linker-map/main.c (renamed from tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/main.c)0
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.cpp21
5 files changed, 11 insertions, 26 deletions
diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs b/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs
deleted file mode 100644
index 0ff952b22..000000000
--- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs
+++ /dev/null
@@ -1,11 +0,0 @@
-import "../BareMetalApplication.qbs" as BareMetalApplication
-
-BareMetalApplication {
- condition: {
- console.info("current toolset: %%"
- + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
- return true;
- }
- cpp.generateLinkerMapFile: false
- files: ["main.c"]
-}
diff --git a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/main.c b/tests/auto/blackbox/testdata-baremetal/generate-linker-map/main.c
deleted file mode 100644
index 58fe69254..000000000
--- a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/main.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int main(void)
-{
- return 0;
-}
diff --git a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/generate-linker-map.qbs b/tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs
index a6ab5ba32..676221e11 100644
--- a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/generate-linker-map.qbs
+++ b/tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs
@@ -6,6 +6,5 @@ BareMetalApplication {
+ qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
return true;
}
- cpp.generateLinkerMapFile: true
files: ["main.c"]
}
diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/main.c b/tests/auto/blackbox/testdata-baremetal/linker-map/main.c
index 58fe69254..58fe69254 100644
--- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/main.c
+++ b/tests/auto/blackbox/testdata-baremetal/linker-map/main.c
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
index d32abf82a..a5feedd48 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
@@ -214,18 +214,20 @@ void TestBlackboxBareMetal::compilerListingFiles()
void TestBlackboxBareMetal::linkerMapFile_data()
{
- QTest::addColumn<QString>("testPath");
QTest::addColumn<bool>("generateMap");
- QTest::newRow("do-not-generate-linker-map") << "/do-not-generate-linker-map" << false;
- QTest::newRow("generate-linker-map") << "/generate-linker-map" << true;
+ QTest::newRow("do-not-generate-linker-map") << false;
+ QTest::newRow("generate-linker-map") << true;
}
void TestBlackboxBareMetal::linkerMapFile()
{
- QFETCH(QString, testPath);
QFETCH(bool, generateMap);
- QDir::setCurrent(testDataDir + testPath);
- QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
+ QDir::setCurrent(testDataDir + "/linker-map");
+
+ rmDirR(relativeBuildDir());
+ const QStringList args = {QStringLiteral("modules.cpp.generateLinkerMapFile:%1")
+ .arg(generateMap ? "true" : "false")};
+ QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0);
if (m_qbsStdout.contains("unsupported toolset:"))
QSKIP(unsupportedToolsetMessage(m_qbsStdout));
if (!m_qbsStdout.contains("current toolset:"))
@@ -236,11 +238,10 @@ void TestBlackboxBareMetal::linkerMapFile()
if (!extractToolset(m_qbsStdout, toolchain, architecture))
QFAIL("Unable to extract current toolset");
- QCOMPARE(runQbs(), 0);
- const QString productName = testPath.mid(1);
- const QString productBuildDir = relativeProductBuildDir(productName);
+ QCOMPARE(runQbs(QbsRunParameters(args)), 0);
+ const QString productBuildDir = relativeProductBuildDir("linker-map");
const auto extension = linkerMapFileExtension(toolchain, architecture);
- const QString linkerMap = productBuildDir + "/" + productName + extension;
+ const QString linkerMap = productBuildDir + "/linker-map" + extension;
QCOMPARE(regularFileExists(linkerMap), generateMap);
}