summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlibrary
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qlibrary')
-rw-r--r--tests/auto/qlibrary/lib/lib.pro3
-rw-r--r--tests/auto/qlibrary/lib/mylib.c4
-rw-r--r--tests/auto/qlibrary/lib2/lib2.pro19
-rw-r--r--tests/auto/qlibrary/lib2/mylib.c4
-rw-r--r--tests/auto/qlibrary/qlibrary.pro1
-rw-r--r--tests/auto/qlibrary/tst/tst.pro12
-rw-r--r--tests/auto/qlibrary/tst_qlibrary.cpp69
7 files changed, 95 insertions, 17 deletions
diff --git a/tests/auto/qlibrary/lib/lib.pro b/tests/auto/qlibrary/lib/lib.pro
index 14b8783..25a50b5 100644
--- a/tests/auto/qlibrary/lib/lib.pro
+++ b/tests/auto/qlibrary/lib/lib.pro
@@ -19,7 +19,7 @@ win32: {
copy /Y $(DESTDIR_TARGET) ..\system.trolltech.test.mylib.dll && \
copy /Y $(DESTDIR_TARGET) ..\mylib_noextension
}
-unix: {
+unix:!symbian: {
QMAKE_POST_LINK = cp -f $(DESTDIR)$(TARGET) ../libmylib.so2 && \
cp -f $(DESTDIR)$(TARGET) ../system.trolltech.test.mylib.so
}
@@ -27,4 +27,5 @@ unix: {
#no special install rule for the library used by test
INSTALLS =
+symbian: TARGET.CAPABILITY=ALL -TCB
diff --git a/tests/auto/qlibrary/lib/mylib.c b/tests/auto/qlibrary/lib/mylib.c
index 1366b7c..5e98362 100644
--- a/tests/auto/qlibrary/lib/mylib.c
+++ b/tests/auto/qlibrary/lib/mylib.c
@@ -1,6 +1,6 @@
#include <qglobal.h>
-#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR)
+#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR) || defined(Q_OS_SYMBIAN)
#define LIB_EXPORT __declspec(dllexport)
#else
#define LIB_EXPORT
@@ -12,7 +12,7 @@
# define BORLAND_STDCALL
#endif
-LIB_EXPORT int BORLAND_STDCALL version()
+LIB_EXPORT int BORLAND_STDCALL mylibversion()
{
return 1;
}
diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro
index 718c5c6..724077a 100644
--- a/tests/auto/qlibrary/lib2/lib2.pro
+++ b/tests/auto/qlibrary/lib2/lib2.pro
@@ -19,11 +19,28 @@ win32: {
QMAKE_POST_LINK = copy /Y ..\mylib2.dll ..\mylib.dl2 && \
copy /Y ..\mylib2.dll ..\system.trolltech.test.mylib.dll
}
-unix: {
+
+unix:!symbian: {
QMAKE_POST_LINK = cp -f $(DESTDIR)$(TARGET) ../libmylib.so2 && \
cp -f $(DESTDIR)$(TARGET) ../system.trolltech.test.mylib.so
}
+symbian-abld: {
+ TARGET.CAPABILITY=ALL -TCB
+ QMAKE_POST_LINK = \
+ copy /Y $${EPOCROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${EPOCROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dl2 && \
+ copy /Y $${EPOCROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${EPOCROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\system.trolltech.test.mylib.dll && \
+ IF NOT "$(PLATFORM)==WINSCW" copy /Y $${EPOCROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll ..\tst\mylib.dl2
+}
+
+symbian-sbsv2: {
+ TARGET.CAPABILITY=ALL -TCB
+ QMAKE_POST_LINK = \
+ $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dl2 && \
+ $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/system.trolltech.test.mylib.dll && \
+ if test $(PLATFORM) != WINSCW;then $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${PWD}/../tst/mylib.dl2; fi
+}
+
#no special install rule for the library used by test
INSTALLS =
diff --git a/tests/auto/qlibrary/lib2/mylib.c b/tests/auto/qlibrary/lib2/mylib.c
index dd90f04..4046f1f 100644
--- a/tests/auto/qlibrary/lib2/mylib.c
+++ b/tests/auto/qlibrary/lib2/mylib.c
@@ -1,6 +1,6 @@
#include <qglobal.h>
-#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR)
+#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR)|| defined(Q_OS_SYMBIAN)
#define LIB_EXPORT __declspec(dllexport)
#else
#define LIB_EXPORT
@@ -12,7 +12,7 @@
# define BORLAND_STDCALL
#endif
-LIB_EXPORT int BORLAND_STDCALL version()
+LIB_EXPORT int BORLAND_STDCALL mylibversion()
{
return 2;
}
diff --git a/tests/auto/qlibrary/qlibrary.pro b/tests/auto/qlibrary/qlibrary.pro
index f3e646a..9ba49ee 100644
--- a/tests/auto/qlibrary/qlibrary.pro
+++ b/tests/auto/qlibrary/qlibrary.pro
@@ -1,3 +1,4 @@
+QT -= gui
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = lib \
diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/qlibrary/tst/tst.pro
index 67437a6..06c2cd8 100644
--- a/tests/auto/qlibrary/tst/tst.pro
+++ b/tests/auto/qlibrary/tst/tst.pro
@@ -16,8 +16,18 @@ wince*: {
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
+}else:symbian* {
+ binDep.sources = \
+ mylib.dll \
+ system.trolltech.test.mylib.dll
+ binDep.path = /sys/bin
+#mylib.dl2 nonstandard binary deployment will cause warning in emulator,
+#but it can be safely ignored.
+ custBinDep.sources = mylib.dl2
+ custBinDep.path = /sys/bin
+
+ DEPLOYMENT += binDep custBinDep
} else {
DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
-
diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp
index 3e7e3f3..bf326be 100644
--- a/tests/auto/qlibrary/tst_qlibrary.cpp
+++ b/tests/auto/qlibrary/tst_qlibrary.cpp
@@ -85,7 +85,7 @@
# define SUFFIX ".a"
# define PREFIX "lib"
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
# undef dll_VALID
# define dll_VALID true
# define SUFFIX ".dll"
@@ -100,8 +100,12 @@
static QString sys_qualifiedLibraryName(const QString &fileName)
{
+#if defined(Q_OS_SYMBIAN)
+ return PREFIX + fileName + SUFFIX;
+#else
QString currDir = QDir::currentPath();
return currDir + "/" + PREFIX + fileName + SUFFIX;
+#endif
}
//TESTED_CLASS=
@@ -187,13 +191,13 @@ void tst_QLibrary::version()
QFETCH( int, loadversion );
QFETCH( int, resultversion );
-#if !defined(Q_OS_AIX) && !defined(Q_OS_WIN)
+#if !defined(Q_OS_AIX) && !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
QString currDir = QDir::currentPath();
QLibrary library( currDir + QLatin1Char('/') + lib, loadversion );
bool ok = library.load();
QVERIFY(ok);
- VersionFunction fnVersion = (VersionFunction)library.resolve("version");
+ VersionFunction fnVersion = (VersionFunction)library.resolve("mylibversion");
QVERIFY(fnVersion);
QCOMPARE(fnVersion(), resultversion);
#else
@@ -209,7 +213,11 @@ void tst_QLibrary::load_data()
QTest::addColumn<QString>("lib");
QTest::addColumn<bool>("result");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+#endif
QTest::newRow( "ok00" ) << currDir + "/mylib" << (bool)true;
QTest::newRow( "notexist" ) << currDir + "/nolib" << (bool)false;
QTest::newRow( "badlibrary" ) << currDir + "/qlibrary.pro" << (bool)false;
@@ -218,7 +226,7 @@ void tst_QLibrary::load_data()
QTest::newRow("ok (libmylib ver. 1)") << currDir + "/libmylib" <<(bool)true;
#endif
-# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QTest::newRow( "ok01 (with suffix)" ) << currDir + "/mylib.dll" << (bool)true;
QTest::newRow( "ok02 (with non-standard suffix)" ) << currDir + "/mylib.dl2" << (bool)true;
QTest::newRow( "ok03 (with many dots)" ) << currDir + "/system.trolltech.test.mylib.dll" << (bool)true;
@@ -248,7 +256,12 @@ void tst_QLibrary::unload_data()
QTest::addColumn<QString>("lib");
QTest::addColumn<bool>("result");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+#endif
+
QTest::newRow( "mylib" ) << currDir + "/mylib" << (bool)TRUE;
#ifdef Q_WS_MAC
if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_3)
@@ -274,8 +287,12 @@ void tst_QLibrary::unload()
void tst_QLibrary::unload_after_implicit_load()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("SYMBIAN does not support symbols on non-STDDLL libraries.", SkipAll);
+#endif
+
QLibrary library( "./mylib" );
- void *p = library.resolve("version");
+ void *p = library.resolve("mylibversion");
QVERIFY(p); // Check if it was loaded
QVERIFY(library.isLoaded());
QVERIFY(library.unload());
@@ -289,14 +306,23 @@ void tst_QLibrary::resolve_data()
QTest::addColumn<QString>("symbol");
QTest::addColumn<bool>("goodPointer");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
- QTest::newRow( "ok00" ) << currDir + "/mylib" << QString("version") << (bool)TRUE;
+#endif
+
+ QTest::newRow( "ok00" ) << currDir + "/mylib" << QString("mylibversion") << (bool)TRUE;
QTest::newRow( "bad00" ) << currDir + "/mylib" << QString("nosym") << (bool)FALSE;
QTest::newRow( "bad01" ) << currDir + "/nolib" << QString("nosym") << (bool)FALSE;
}
void tst_QLibrary::resolve()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("SYMBIAN does not support symbols on non-STDDLL libraries.", SkipAll);
+#endif
+
typedef int (*testFunc)();
QFETCH( QString, lib );
QFETCH( QString, symbol );
@@ -347,7 +373,7 @@ void tst_QLibrary::isLibrary_data()
QTest::newRow("good (libmylib.so.1.0.0)") << QString("libmylib.so.1.0.0") << true;
QTest::newRow("bad (libmylib.1.0.0.foo)") << QString("libmylib.1.0.0.foo") << false;
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QTest::newRow("good (with many dots)" ) << "/system.trolltech.test.mylib.dll" << true;
#endif
}
@@ -367,10 +393,15 @@ void tst_QLibrary::errorString_data()
QTest::addColumn<bool>("success");
QTest::addColumn<QString>("errorString");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+
QString srcDir = SRCDIR;
if (srcDir.isEmpty())
srcDir = currDir;
+#endif
QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*");
QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error");
@@ -385,6 +416,8 @@ void tst_QLibrary::errorString_data()
QTest::newRow("bad load() with .dll suffix") << (int)Load << QString("nosuchlib.dll") << false << QString("Cannot load library nosuchlib.dll: The specified module could not be found.");
// QTest::newRow("bad unload") << (int)Unload << QString("nosuchlib.dll") << false << QString("QLibrary::unload_sys: Cannot unload nosuchlib.dll (The specified module could not be found.)");
#elif defined Q_OS_MAC
+#elif defined Q_OS_SYMBIAN
+ QTest::newRow("load invalid file") << (int)Load << "tst_qlibrary.exe" << false << QString("Cannot load library.*");
#else
QTest::newRow("load invalid file") << (int)Load << srcDir + "/library_path/invalid.so" << false << QString("Cannot load library.*");
#endif
@@ -397,6 +430,13 @@ void tst_QLibrary::errorString()
QFETCH(bool, success);
QFETCH(QString, errorString);
+#if defined(Q_OS_SYMBIAN)
+ if ( success )
+ {
+ QSKIP("SYMBIAN does not support symbols on non-STDDLL libraries.", SkipSingle );
+ }
+#endif
+
QLibrary lib;
if (!(operation & DontSetFileName)) {
lib.setFileName(fileName);
@@ -415,7 +455,7 @@ void tst_QLibrary::errorString()
ok = lib.load();
QCOMPARE(ok, true);
if (success) {
- ok = lib.resolve("version");
+ ok = lib.resolve("mylibversion");
} else {
ok = lib.resolve("nosuchsymbol");
}
@@ -446,9 +486,14 @@ void tst_QLibrary::loadHints_data()
}
#endif
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+#endif
+
lh |= QLibrary::ResolveAllSymbolsHint;
-# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QTest::newRow( "ok01 (with suffix)" ) << currDir + "/mylib.dll" << int(lh) << (bool)TRUE;
QTest::newRow( "ok02 (with non-standard suffix)" ) << currDir + "/mylib.dl2" << int(lh) << (bool)TRUE;
QTest::newRow( "ok03 (with many dots)" ) << currDir + "/system.trolltech.test.mylib.dll" << int(lh) << (bool)TRUE;
@@ -486,7 +531,6 @@ void tst_QLibrary::fileName_data()
QTest::addColumn<QString>("libName");
QTest::addColumn<QString>("expectedFilename");
- QString currDir = QDir::currentPath();
QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib"))
<< sys_qualifiedLibraryName(QLatin1String("mylib"));
#ifdef Q_WS_WIN
@@ -518,7 +562,12 @@ void tst_QLibrary::fileName()
void tst_QLibrary::multipleInstancesForOneLibrary()
{
+#if defined(Q_OS_SYMBIAN)
+ QString lib = "/mylib";
+#else
QString lib = QDir::currentPath() + "/mylib";
+#endif
+
QLibrary lib1(lib);
QLibrary lib2(lib);
QCOMPARE(lib1.isLoaded(), false);