tst_qplugin{,loader}: make it pass on Macs

Debug builds were broken.

WARNING: tst_QPluginLoader::errorString() testdata bin/libtst_qpluginloaderlib.dylib could not be located!

$ ls -l bin
total 112
-rwxr-xr-x 1 tjmaciei staff 77296 Sep 14 08:46 libtheplugin_debug.dylib
-rwxr-xr-x 1 tjmaciei staff 33408 Sep 14 08:46 libtst_qpluginloaderlib_debug.dylib

Change-Id: I42eb903a916645db9900fffd16a4bb0a51ef967c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 60b0b0dedd87ab4f8a842e7f1650d5c96e731c38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2021-09-14 08:50:18 -07:00 committed by Qt Cherry-pick Bot
parent d786f9736b
commit 4d93d2e0f2

View File

@ -53,11 +53,11 @@
# define bundle_VALID true # define bundle_VALID true
# define dylib_VALID true # define dylib_VALID true
# define so_VALID true # define so_VALID true
//# ifdef QT_NO_DEBUG # ifdef QT_NO_DEBUG
# define SUFFIX ".dylib" # define SUFFIX ".dylib"
//# else # else
//# define SUFFIX "_debug.dylib" # define SUFFIX "_debug.dylib"
//#endif # endif
# define PREFIX "lib" # define PREFIX "lib"
#elif defined(Q_OS_HPUX) && !defined(__ia64) #elif defined(Q_OS_HPUX) && !defined(__ia64)
@ -427,7 +427,7 @@ void tst_QPluginLoader::relativePath()
const QString binDir = QFINDTESTDATA("bin"); const QString binDir = QFINDTESTDATA("bin");
QVERIFY(!binDir.isEmpty()); QVERIFY(!binDir.isEmpty());
QCoreApplication::addLibraryPath(binDir); QCoreApplication::addLibraryPath(binDir);
QPluginLoader loader("theplugin"); QPluginLoader loader("theplugin" SUFFIX);
loader.load(); // not recommended, instance() should do the job. loader.load(); // not recommended, instance() should do the job.
PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance()); PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance());
QVERIFY(instance); QVERIFY(instance);
@ -444,7 +444,7 @@ void tst_QPluginLoader::absolutePath()
const QString binDir = QFINDTESTDATA("bin"); const QString binDir = QFINDTESTDATA("bin");
QVERIFY(!binDir.isEmpty()); QVERIFY(!binDir.isEmpty());
QVERIFY(QDir::isAbsolutePath(binDir)); QVERIFY(QDir::isAbsolutePath(binDir));
QPluginLoader loader(binDir + "/theplugin"); QPluginLoader loader(binDir + "/" PREFIX "theplugin" SUFFIX);
loader.load(); // not recommended, instance() should do the job. loader.load(); // not recommended, instance() should do the job.
PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance()); PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance());
QVERIFY(instance); QVERIFY(instance);