diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-30 10:35:01 +0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-08-03 20:26:58 +0000 |
commit | 22eb4bacaedab1612977fc23c5720a86179d1b04 (patch) | |
tree | 9281ed2c3e30a66ddee95675989476a7cbb76bdf /tests/auto/corelib/plugin | |
parent | dc8d4fe30f2f88982166b5c593f90deb3964fb52 (diff) |
Enable QPluginLoader test for static builds
The majority of tests use QPluginLoader::setFileName implicitly, which
refuses to do any work in static builds. Therefore the majority of tests
are skipped. But in the future we'll get tests here that for example use
QPluginLoader::staticPlugins() and for that we want to include the
sub-directory in the build and test run.
Change-Id: Ib8ec274e22ac8050feaca8967eb8626b53876b92
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/plugin')
-rw-r--r-- | tests/auto/corelib/plugin/plugin.pro | 3 | ||||
-rw-r--r-- | tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp | 31 |
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro index b094c24e55..240608fddf 100644 --- a/tests/auto/corelib/plugin/plugin.pro +++ b/tests/auto/corelib/plugin/plugin.pro @@ -11,6 +11,5 @@ qtConfig(library): SUBDIRS += \ contains(CONFIG, static) { message(Disabling tests requiring shared build of Qt) SUBDIRS -= qfactoryloader \ - qplugin \ - qpluginloader + qplugin } diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index f34741281c..8e3ea91c40 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -140,6 +140,10 @@ void tst_QPluginLoader::cleanup() void tst_QPluginLoader::errorString() { +#if !defined(QT_SHARED) + QSKIP("This test requires Qt to create shared libraries."); +#endif + const QString unknown(QLatin1String("Unknown error")); { @@ -224,6 +228,9 @@ void tst_QPluginLoader::errorString() void tst_QPluginLoader::loadHints() { +#if !defined(QT_SHARED) + QSKIP("This test requires Qt to create shared libraries."); +#endif QPluginLoader loader; QCOMPARE(loader.loadHints(), (QLibrary::LoadHints)0); //Do not crash loader.setLoadHints(QLibrary::ResolveAllSymbolsHint); @@ -233,6 +240,9 @@ void tst_QPluginLoader::loadHints() void tst_QPluginLoader::deleteinstanceOnUnload() { +#if !defined(QT_SHARED) + QSKIP("This test requires Qt to create shared libraries."); +#endif for (int pass = 0; pass < 2; ++pass) { QPluginLoader loader1; loader1.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin @@ -268,6 +278,9 @@ void tst_QPluginLoader::deleteinstanceOnUnload() void tst_QPluginLoader::loadDebugObj() { +#if !defined(QT_SHARED) + QSKIP("This test requires a shared build of Qt, as QPluginLoader::setFileName is a no-op in static builds"); +#endif #if defined (__ELF__) QVERIFY(QFile::exists(QFINDTESTDATA("elftest/debugobj.so"))); QPluginLoader lib1(QFINDTESTDATA("elftest/debugobj.so")); @@ -277,6 +290,9 @@ void tst_QPluginLoader::loadDebugObj() void tst_QPluginLoader::loadCorruptElf() { +#if !defined(QT_SHARED) + QSKIP("This test requires a shared build of Qt, as QPluginLoader::setFileName is a no-op in static builds"); +#endif #if defined (__ELF__) if (sizeof(void*) == 8) { QVERIFY(QFile::exists(QFINDTESTDATA("elftest/corrupt1.elf64.so"))); @@ -377,6 +393,9 @@ void tst_QPluginLoader::loadMachO() #if defined (Q_OS_UNIX) void tst_QPluginLoader::loadGarbage() { +#if !defined(QT_SHARED) + QSKIP("This test requires a shared build of Qt, as QPluginLoader::setFileName is a no-op in static builds"); +#endif for (int i=0; i<5; i++) { const QString name = QLatin1String("elftest/garbage") + QString::number(i + 1) + QLatin1String(".so"); QPluginLoader lib(QFINDTESTDATA(name)); @@ -388,6 +407,9 @@ void tst_QPluginLoader::loadGarbage() void tst_QPluginLoader::relativePath() { +#if !defined(QT_SHARED) + QSKIP("This test requires Qt to create shared libraries."); +#endif // Windows binaries run from release and debug subdirs, so we can't rely on the current dir. const QString binDir = QFINDTESTDATA("bin"); QVERIFY(!binDir.isEmpty()); @@ -402,6 +424,9 @@ void tst_QPluginLoader::relativePath() void tst_QPluginLoader::absolutePath() { +#if !defined(QT_SHARED) + QSKIP("This test requires Qt to create shared libraries."); +#endif // Windows binaries run from release and debug subdirs, so we can't rely on the current dir. const QString binDir = QFINDTESTDATA("bin"); QVERIFY(!binDir.isEmpty()); @@ -416,6 +441,9 @@ void tst_QPluginLoader::absolutePath() void tst_QPluginLoader::reloadPlugin() { +#if !defined(QT_SHARED) + QSKIP("This test requires Qt to create shared libraries."); +#endif QPluginLoader loader; loader.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin loader.load(); // not recommended, instance() should do the job. @@ -451,6 +479,9 @@ void tst_QPluginLoader::preloadedPlugin_data() void tst_QPluginLoader::preloadedPlugin() { +#if !defined(QT_SHARED) + QSKIP("This test requires Qt to create shared libraries."); +#endif // check that using QPluginLoader does not interfere with QLibrary QFETCH(QString, libname); QLibrary lib(libname); |