diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-01-31 16:36:17 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-01-31 16:36:17 +0100 |
commit | 028a2d908f269958331610b21f86cb03f1957b98 (patch) | |
tree | 4fefc28e07411b169412fd7670b039d65f44571c /tests/auto | |
parent | 606c5cd196e3345b42931306481fe8691f5bb9b6 (diff) | |
parent | 764fd1f6ea3f317ad4b50a865ab56b8a8c93080f (diff) |
Merge 1.10 into 1.11
Change-Id: I2d6cac6f24144c2c7e463ef7eed2e2c109f50bbf
Diffstat (limited to 'tests/auto')
10 files changed, 84 insertions, 14 deletions
diff --git a/tests/auto/blackbox/testdata/moved-file-dependency/main.cpp b/tests/auto/blackbox/testdata/moved-file-dependency/main.cpp new file mode 100644 index 000000000..3e89e9f26 --- /dev/null +++ b/tests/auto/blackbox/testdata/moved-file-dependency/main.cpp @@ -0,0 +1,3 @@ +#include <theheader.h> + +int main() {} diff --git a/tests/auto/blackbox/testdata/moved-file-dependency/moved-file-dependency.qbs b/tests/auto/blackbox/testdata/moved-file-dependency/moved-file-dependency.qbs new file mode 100644 index 000000000..6252f98ed --- /dev/null +++ b/tests/auto/blackbox/testdata/moved-file-dependency/moved-file-dependency.qbs @@ -0,0 +1,6 @@ +import qbs + +CppApplication { + cpp.includePaths: ["subdir1", "subdir2"] + files: ["main.cpp"] +} diff --git a/tests/auto/blackbox/testdata/moved-file-dependency/subdir1/theheader.h b/tests/auto/blackbox/testdata/moved-file-dependency/subdir1/theheader.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/blackbox/testdata/moved-file-dependency/subdir1/theheader.h diff --git a/tests/auto/blackbox/testdata/plugin-dependency/helper.cpp b/tests/auto/blackbox/testdata/plugin-dependency/helper.cpp deleted file mode 100644 index 7ef66b24c..000000000 --- a/tests/auto/blackbox/testdata/plugin-dependency/helper.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "../dllexport.h" -#include <stdio.h> - -DLL_EXPORT void helper_hello() -{ - puts("helper says hello!"); -} diff --git a/tests/auto/blackbox/testdata/plugin-dependency/helper1.cpp b/tests/auto/blackbox/testdata/plugin-dependency/helper1.cpp new file mode 100644 index 000000000..72331da80 --- /dev/null +++ b/tests/auto/blackbox/testdata/plugin-dependency/helper1.cpp @@ -0,0 +1,16 @@ +#include <stdio.h> + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +#ifndef USING_HELPER2 +#error define USING_HELPER2 missing +#endif + +EXPORT void helper1_hello() +{ + puts("helper1 says hello!"); +} diff --git a/tests/auto/blackbox/testdata/plugin-dependency/helper2.cpp b/tests/auto/blackbox/testdata/plugin-dependency/helper2.cpp new file mode 100644 index 000000000..cdcdfc942 --- /dev/null +++ b/tests/auto/blackbox/testdata/plugin-dependency/helper2.cpp @@ -0,0 +1,7 @@ +#include "../dllexport.h" +#include <stdio.h> + +DLL_EXPORT void helper2_hello() +{ + puts("Hello from helper2!"); +} diff --git a/tests/auto/blackbox/testdata/plugin-dependency/main.cpp b/tests/auto/blackbox/testdata/plugin-dependency/main.cpp index 3d91b7161..d34c880ff 100644 --- a/tests/auto/blackbox/testdata/plugin-dependency/main.cpp +++ b/tests/auto/blackbox/testdata/plugin-dependency/main.cpp @@ -2,12 +2,12 @@ DLL_IMPORT void plugin3_hello(); DLL_IMPORT void plugin4_hello(); -DLL_IMPORT void helper_hello(); +DLL_IMPORT void helper1_hello(); int main() { plugin3_hello(); plugin4_hello(); - helper_hello(); + helper1_hello(); return 0; } diff --git a/tests/auto/blackbox/testdata/plugin-dependency/plugin-dependency.qbs b/tests/auto/blackbox/testdata/plugin-dependency/plugin-dependency.qbs index a12aceccd..3ae2f3c9a 100644 --- a/tests/auto/blackbox/testdata/plugin-dependency/plugin-dependency.qbs +++ b/tests/auto/blackbox/testdata/plugin-dependency/plugin-dependency.qbs @@ -15,7 +15,7 @@ Project { cpp.link: /*theCondition && */product.name === "myapp" // TODO: Make this work } Depends { name: "plugin4" } // supposed to be linked - Depends { name: "helper" } // supposed to be linked + Depends { name: "helper1" } // supposed to be linked } DynamicLibrary { name: "plugin1" @@ -54,8 +54,22 @@ Project { } } DynamicLibrary { - name: "helper" - files: ["helper.cpp"] + name: "helper1" + files: ["helper1.cpp"] Depends { name: "cpp" } + Depends { name: "helper2"; cpp.link: false } + Export { + Depends { name: "cpp" } + Depends { name: "helper2"; cpp.link: false } + } + } + DynamicLibrary { + name: "helper2" + files: ["helper2.cpp"] + Depends { name: "cpp" } + Export { + Depends { name: "cpp" } + cpp.defines: ["USING_HELPER2"] + } } } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 0dd185f8e..e01086cef 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -2461,18 +2461,21 @@ void TestBlackbox::pluginDependency() { QDir::setCurrent(testDataDir + "/plugin-dependency"); - // Build the plugin. - QCOMPARE(runQbs(QStringList{"--products", "plugin1,plugin2,plugin3,plugin4"}), 0); + // Build the plugins and the helper2 lib. + QCOMPARE(runQbs(QStringList{"--products", "plugin1,plugin2,plugin3,plugin4,helper2"}), 0); QVERIFY(m_qbsStdout.contains("plugin1")); QVERIFY(m_qbsStdout.contains("plugin2")); QVERIFY(m_qbsStdout.contains("plugin3")); QVERIFY(m_qbsStdout.contains("plugin4")); + QVERIFY(m_qbsStdout.contains("helper2")); + QVERIFY(!m_qbsStderr.contains("SOFT ASSERT")); // Build the app. Plugins 1 and 2 must not be linked. Plugin 3 must be linked. QCOMPARE(runQbs(QStringList{"--command-echo-mode", "command-line"}), 0); QByteArray output = m_qbsStdout + '\n' + m_qbsStderr; QVERIFY(!output.contains("plugin1")); QVERIFY(!output.contains("plugin2")); + QVERIFY(!output.contains("helper2")); // Check that the build dependency still works. QCOMPARE(runQbs(QStringLiteral("clean")), 0); @@ -5430,6 +5433,33 @@ void TestBlackbox::missingOverridePrefix() m_qbsStderr.constData()); } +void TestBlackbox::movedFileDependency() +{ + QDir::setCurrent(testDataDir + "/moved-file-dependency"); + const QString subdir2 = QDir::currentPath() + "/subdir2"; + QVERIFY(QDir::current().mkdir(subdir2)); + const QString oldHeaderFilePath = QDir::currentPath() + "/subdir1/theheader.h"; + const QString newHeaderFilePath = subdir2 + "/theheader.h"; + QCOMPARE(runQbs(), 0); + QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); + QCOMPARE(runQbs(), 0); + QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); + + QFile f(oldHeaderFilePath); + QVERIFY2(f.rename(newHeaderFilePath), qPrintable(f.errorString())); + QCOMPARE(runQbs(), 0); + QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); + QCOMPARE(runQbs(), 0); + QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); + + f.setFileName(newHeaderFilePath); + QVERIFY2(f.rename(oldHeaderFilePath), qPrintable(f.errorString())); + QCOMPARE(runQbs(), 0); + QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); + QCOMPARE(runQbs(), 0); + QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); +} + void TestBlackbox::badInterpreter() { if (!HostOsInfo::isAnyUnixHost()) diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index eef0af9d5..89807ce1e 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -150,6 +150,7 @@ private slots: void missingDependency(); void missingProjectFile(); void missingOverridePrefix(); + void movedFileDependency(); void multipleChanges(); void nestedGroups(); void nestedProperties(); |