aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();