summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-10-17 14:55:44 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-10-21 11:11:24 +0000
commit1353ac64cf542dcd0b174e2e77e9c37d86fcba39 (patch)
treedd8758dad62e048f76ae04e8b96ccc0b7876b14d
parent02af2595540e7666b6aad1991599763230af339d (diff)
Add test for cpp.generateLinkerMapFile property
This test cover only the applications using the MSVC and GCC-like toolchains yet. Other toolchains and a product types can be added later if it will required. Change-Id: I37db96015774447e1e30b503d9853599be0177f2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--tests/auto/blackbox/testdata/generate-linker-map-file/generate-linker-map-file.qbs25
-rw-r--r--tests/auto/blackbox/testdata/generate-linker-map-file/main.cpp29
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp19
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
4 files changed, 74 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/generate-linker-map-file/generate-linker-map-file.qbs b/tests/auto/blackbox/testdata/generate-linker-map-file/generate-linker-map-file.qbs
new file mode 100644
index 000000000..815e64853
--- /dev/null
+++ b/tests/auto/blackbox/testdata/generate-linker-map-file/generate-linker-map-file.qbs
@@ -0,0 +1,25 @@
+Project {
+ CppApplication {
+ name: "app-map"
+ files: ["main.cpp"]
+ cpp.generateLinkerMapFile: true
+ }
+ CppApplication {
+ name: "app-nomap"
+ files: ["main.cpp"]
+ cpp.generateLinkerMapFile: false
+ }
+ CppApplication {
+ name: "app-nomap-default"
+ files: ["main.cpp"]
+ }
+
+ Probe {
+ id: toolchainProbe
+ property bool isUsed: qbs.toolchain.contains("msvc")
+ || qbs.toolchain.contains("gcc")
+ configure: {
+ console.info("use test: " + isUsed);
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/generate-linker-map-file/main.cpp b/tests/auto/blackbox/testdata/generate-linker-map-file/main.cpp
new file mode 100644
index 000000000..e4e2a1671
--- /dev/null
+++ b/tests/auto/blackbox/testdata/generate-linker-map-file/main.cpp
@@ -0,0 +1,29 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qbs.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+int main() { return 0; }
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index f65d462d2..d04ed91d8 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -6615,6 +6615,25 @@ void TestBlackbox::generatedArtifactAsInputToDynamicRule()
QVERIFY2(!m_qbsStdout.contains("generating"), m_qbsStdout.constData());
}
+void TestBlackbox::generateLinkerMapFile()
+{
+ QDir::setCurrent(testDataDir + "/generate-linker-map-file");
+ QCOMPARE(runQbs(), 0);
+ const bool isUsed = m_qbsStdout.contains("use test: true");
+ const bool isNotUsed = m_qbsStdout.contains("use test: false");
+ QVERIFY(isUsed != isNotUsed);
+ if (isUsed) {
+ QVERIFY(QFile::exists(relativeProductBuildDir("app-map")
+ + "/app-map.map"));
+ QVERIFY(!QFile::exists(relativeProductBuildDir("app-nomap")
+ + "/app-nomap.map"));
+ QVERIFY(!QFile::exists(relativeProductBuildDir("app-nomap-default")
+ + "/app-nomap-default.map"));
+ } else {
+ QSKIP("Unsupported toolchain. Skipping.");
+ }
+}
+
void TestBlackbox::generator()
{
QFETCH(QString, inputFile);
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 382c65389..3a66b6962 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -119,6 +119,7 @@ private slots:
void fileDependencies();
void fileTagsFilterMerging();
void generatedArtifactAsInputToDynamicRule();
+ void generateLinkerMapFile();
void generator();
void generator_data();
void groupsInModules();