aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-03-16 22:15:51 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2020-03-18 16:29:07 +0000
commit6e7faeedbc24f496e6521fd380f6fc4fb39d6df2 (patch)
tree1e0b3fd4b7df40b3ab756c521a363c657ad2fd5f /tests/auto/blackbox
parentdcd57b60f8a79a2ee9c46cb5fddf60846302d375 (diff)
Make Library.qbs configurable
Move all tag installation code to the Library.qbs to make it possible to switch between dynamic/static libraries in user code. Also, add test for the LoadableModule item. Change-Id: I947977e5974f9c37d27be6ccd7ad3d117a05af18 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/blackbox')
-rw-r--r--tests/auto/blackbox/testdata/install-locations/install-locations.qbs6
-rw-r--r--tests/auto/blackbox/testdata/install-locations/theplugin.cpp3
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp17
3 files changed, 24 insertions, 2 deletions
diff --git a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs
index 8a97f74a1..044ecf710 100644
--- a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs
+++ b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs
@@ -23,4 +23,10 @@ Project {
Depends { name: "cpp" }
files: "thelib.cpp"
}
+ LoadableModule {
+ name: "theplugin"
+ install: true
+ Depends { name: "cpp" }
+ files: "theplugin.cpp"
+ }
}
diff --git a/tests/auto/blackbox/testdata/install-locations/theplugin.cpp b/tests/auto/blackbox/testdata/install-locations/theplugin.cpp
new file mode 100644
index 000000000..ac1ede090
--- /dev/null
+++ b/tests/auto/blackbox/testdata/install-locations/theplugin.cpp
@@ -0,0 +1,3 @@
+#include "../dllexport.h"
+
+DLL_EXPORT void pluginFunc() {}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index ecb8bd1e9..87a14c853 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -4001,8 +4001,11 @@ void TestBlackbox::installLocations_data()
QTest::addColumn<QString>("binDir");
QTest::addColumn<QString>("dllDir");
QTest::addColumn<QString>("libDir");
- QTest::newRow("explicit values") << QString("bindir") << QString("dlldir") << QString("libdir");
- QTest::newRow("default values") << QString() << QString() << QString();
+ QTest::addColumn<QString>("pluginDir");
+ QTest::newRow("explicit values")
+ << QString("bindir") << QString("dlldir") << QString("libdir") << QString("pluginDir");
+ QTest::newRow("default values")
+ << QString() << QString() << QString() << QString();
}
void TestBlackbox::installLocations()
@@ -4011,6 +4014,7 @@ void TestBlackbox::installLocations()
QFETCH(QString, binDir);
QFETCH(QString, dllDir);
QFETCH(QString, libDir);
+ QFETCH(QString, pluginDir);
QbsRunParameters params("resolve");
if (!binDir.isEmpty())
params.arguments.push_back("products.theapp.installDir:" + binDir);
@@ -4018,6 +4022,8 @@ void TestBlackbox::installLocations()
params.arguments.push_back("products.thelib.installDir:" + dllDir);
if (!libDir.isEmpty())
params.arguments.push_back("products.thelib.importLibInstallDir:" + libDir);
+ if (!pluginDir.isEmpty())
+ params.arguments.push_back("products.theplugin.installDir:" + pluginDir);
QCOMPARE(runQbs(params), 0);
const bool isWindows = m_qbsStdout.contains("is windows");
const bool isMac = m_qbsStdout.contains("is mac");
@@ -4025,6 +4031,8 @@ void TestBlackbox::installLocations()
QVERIFY(isWindows || isMac || isUnix);
QCOMPARE(runQbs(QbsRunParameters(QStringList("--clean-install-root"))), 0);
const QString dllFileName = isWindows ? "thelib.dll" : isMac ? "thelib" : "libthelib.so";
+ const QString pluginFileName =
+ isWindows ? "theplugin.dll" : isMac ? "theplugin" : "libtheplugin.so";
const QString appFileName = isWindows ? "theapp.exe" : "theapp";
if (binDir.isEmpty())
binDir = isMac ? "/Applications" : "/bin";
@@ -4032,9 +4040,12 @@ void TestBlackbox::installLocations()
dllDir = isMac ? "/Library/Frameworks" : isWindows ? "/bin" : "/lib";
if (libDir.isEmpty())
libDir = "/lib";
+ if (pluginDir.isEmpty())
+ pluginDir = dllDir;
if (isMac) {
binDir += "/theapp.app/Contents/MacOS";
dllDir += "/thelib.framework";
+ pluginDir += "/theplugin.bundle/Contents/MacOS";
}
const QString installRoot = QDir::currentPath() + "/default/install-root";
const QString installPrefix = isWindows ? QString() : "/usr/local";
@@ -4047,6 +4058,8 @@ void TestBlackbox::installLocations()
const QString libFilePath = fullInstallPrefix + libDir + "/thelib.lib";
QVERIFY2(QFile::exists(libFilePath), qPrintable(libFilePath));
}
+ const QString pluginFilePath = fullInstallPrefix + pluginDir + '/' + pluginFileName;
+ QVERIFY2(QFile::exists(pluginFilePath), qPrintable(pluginFilePath));
}
void TestBlackbox::inputsFromDependencies()