summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/3rdparty/cycle_p.h17
-rw-r--r--src/testlib/qbenchmark.cpp1
-rw-r--r--src/testlib/qplaintestlogger.cpp10
-rw-r--r--src/testlib/qtest_global.h5
-rw-r--r--src/testlib/qtestcase.cpp7
-rw-r--r--src/testlib/qtestcase.h65
-rw-r--r--src/testlib/qtestnetworkservers.h86
-rw-r--r--src/testlib/testlib.pro2
8 files changed, 187 insertions, 6 deletions
diff --git a/src/testlib/3rdparty/cycle_p.h b/src/testlib/3rdparty/cycle_p.h
index b4b6876..547fdc1 100644
--- a/src/testlib/3rdparty/cycle_p.h
+++ b/src/testlib/3rdparty/cycle_p.h
@@ -491,4 +491,21 @@ INLINE_ELAPSED(inline)
#define HAVE_TICK_COUNTER
#endif
+/*----------------------------------------------------------------*/
+/* Symbian */
+#if defined(__SYMBIAN32__) && !defined(HAVE_TICK_COUNTER)
+#include <e32std.h>
+
+typedef TUint32 CycleCounterTicks;
+
+static inline CycleCounterTicks getticks(void)
+{
+ return User::FastCounter();
+}
+
+INLINE_ELAPSED(inline)
+
+#define HAVE_TICK_COUNTER
+#endif
+
#endif // QBENCHLIB_CYCLE_H
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index 7687fec..64594c1 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -219,6 +219,7 @@ void QTest::setIterationCountHint(int count)
{
QBenchmarkTestMethodData::current->adjustIterationCount(count);
}
+
/*! \internal
*/
void QTest::setIterationCount(int count)
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index 6f10d72..c408c1c 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -54,6 +54,10 @@
#include "windows.h"
#endif
+#if defined(Q_OS_SYMBIAN)
+#include <e32debug.h>
+#endif
+
#ifdef Q_OS_WINCE
#include <QtCore/QString>
#endif
@@ -159,6 +163,12 @@ namespace QTest {
// OutputDebugString is not threadsafe
OutputDebugStringA(str);
LeaveCriticalSection(&outputCriticalSection);
+#elif defined(Q_OS_SYMBIAN)
+ TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
+ HBufC* hbuffer = HBufC::NewL(ptr.Length());
+ hbuffer->Des().Copy(ptr);
+ RDebug::Print(_L("[QTestLib Message] %S"), hbuffer);
+ delete hbuffer;
#endif
QAbstractTestLogger::outputString(str);
}
diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h
index d6b0655..ebfdae1 100644
--- a/src/testlib/qtest_global.h
+++ b/src/testlib/qtest_global.h
@@ -62,9 +62,10 @@ QT_MODULE(Test)
# endif
#endif
-#if (defined (Q_CC_MSVC) && _MSC_VER < 1310) || defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3))
+#if (defined (Q_CC_MSVC) && _MSC_VER < 1310) || defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3)) || defined (Q_CC_NOKIAX86)
# define QTEST_NO_SPECIALIZATIONS
-#endif
+#endif
+
#if (defined Q_CC_HPACC) && (defined __ia64)
# ifdef Q_TESTLIB_EXPORT
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index b5200dc..27ba6da 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1279,7 +1279,7 @@ static void qInvokeTestMethods(QObject *testObject)
QTEST_ASSERT(metaObject);
QTestLog::startLogging();
-
+
QTestResult::setCurrentTestFunction("initTestCase");
QTestResult::setCurrentTestLocation(QTestResult::DataFunc);
QTestTable::globalTestTable();
@@ -1399,6 +1399,11 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
}
#endif
+#ifdef Q_OS_SYMBIAN
+//### FIX THIS temporary hack to delay execution of symbian os tests. Used to get emulator to stable state before running testcase
+ qSleep(3000);
+#endif
+
QTestResult::reset();
QTEST_ASSERT(testObject);
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 4e5deff..b104e93 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -119,11 +119,22 @@ class QTestData;
namespace QTest
{
- template <typename T>
+#ifndef Q_CC_NOKIAX86
+ template <typename T>
inline char *toString(const T &)
{
return 0;
}
+#else
+ // Nokia X86 compiler bug:
+ // does not export template specializations if parent template is inline
+ template <typename T>
+ Q_TESTLIB_EXPORT char *toString(const T &)
+ {
+ return 0;
+ }
+#endif
+
Q_TESTLIB_EXPORT char *toHexRepresentation(const char *ba, int length);
Q_TESTLIB_EXPORT char *toString(const char *);
@@ -168,6 +179,7 @@ namespace QTest
}
Q_TESTLIB_EXPORT QTestData &newRow(const char *dataTag);
+#ifndef Q_CC_NOKIAX86
template <typename T>
inline bool qCompare(T const &t1, T const &t2, const char *actual, const char *expected,
const char *file, int line)
@@ -177,6 +189,20 @@ namespace QTest
: compare_helper(false, "Compared values are not the same",
toString<T>(t1), toString<T>(t2), actual, expected, file, line);
}
+#else
+ // Nokia X86 compiler bug:
+ // does not export template specializations if parent template is inline
+ template <typename T>
+ Q_TESTLIB_EXPORT bool qCompare(T const &t1, T const &t2, const char *actual, const char *expected,
+ const char *file, int line)
+ {
+ return (t1 == t2)
+ ? compare_helper(true, "COMPARE()", file, line)
+ : compare_helper(false, "Compared values are not the same",
+ toString<T>(t1), toString<T>(t2), actual, expected, file, line);
+ }
+#endif
+
template <>
Q_TESTLIB_EXPORT bool qCompare<float>(float const &t1, float const &t2,
@@ -233,7 +259,7 @@ namespace QTest
return qCompare<qreal>(qreal(t1), t2, actual, expected, file, line);
}
-#elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE)
+#elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
template <>
inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual,
const char *expected, const char *file, int line)
@@ -289,6 +315,28 @@ namespace QTest
return compare_string_helper(t1, t2, actual, expected, file, line);
}
#else /* QTEST_NO_SPECIALIZATIONS */
+
+// In Synmbian we have QTEST_NO_SPECIALIZATIONS defined, but still float related specialization
+// Should be uses. If QTEST_NO_SPECIALIZATIONS is enabled we get ambiguous overload errors
+#if defined(QT_ARCH_SYMBIAN)
+ template <typename T1, typename T2>
+ bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int);
+
+ template <>
+ inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual,
+ const char *expected, const char *file, int line)
+ {
+ return qCompare<float>(float(t1), float(t2), actual, expected, file, line);
+ }
+
+ template <>
+ inline bool qCompare<double, qreal>(double const &t1, qreal const &t2, const char *actual,
+ const char *expected, const char *file, int line)
+ {
+ return qCompare<float>(float(t1), float(t2), actual, expected, file, line);
+ }
+#endif
+
inline bool qCompare(const char *t1, const char *t2, const char *actual,
const char *expected, const char *file, int line)
{
@@ -322,13 +370,24 @@ namespace QTest
return compare_string_helper(t1, t2, actual, expected, file, line);
}
+ // NokiaX86 and RVCT do not like implicitly comparing bool with int
+#ifndef QTEST_NO_SPECIALIZATIONS
+ template <>
+#endif
+ inline bool qCompare(bool const &t1, int const &t2,
+ const char *actual, const char *expected, const char *file, int line)
+ {
+ return qCompare<int>(int(t1), t2, actual, expected, file, line);
+ }
+
+
template <class T>
inline bool qTest(const T& actual, const char *elementName, const char *actualStr,
const char *expected, const char *file, int line)
{
return qCompare(actual, *static_cast<const T *>(QTest::qElementData(elementName,
qMetaTypeId<T>())), actualStr, expected, file, line);
- }
+ }
}
#undef QTEST_COMPARE_DECL
diff --git a/src/testlib/qtestnetworkservers.h b/src/testlib/qtestnetworkservers.h
new file mode 100644
index 0000000..4b11f27
--- /dev/null
+++ b/src/testlib/qtestnetworkservers.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_TESTNETWORKSERVERS_H
+#define QT_TESTNETWORKSERVERS_H
+
+#if defined(Q_OS_SYMBIAN) && !defined(Q_CC_NOKIAX86)
+#define FTP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define FTP_TEST_SERVER_IP_1 "10.215.7.68"
+#define FTPPROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define PROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define SOCKS5PROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HTTPPROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HTTP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HTTPS_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define NTLM_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define UDP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define TCP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define SSH_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define ECHO_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define DAYTIME_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define WILDCARD_TEST_SERVER_NAME_1 "netiks.wildcard.dev.troll.no"
+#define WILDCARD_TEST_SERVER_NAME_2 "netiks.*.troll.no"
+#define DOMAIN_TEST_SERVER_NAME_1 ".troll.no"
+#define DOMAIN_TEST_SERVER_NAME_2 "troll.no"
+#define INTERN_TEST_SERVER_NAME_1 "intern.nokia.troll.no"
+#define HOSTLOOKUP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HOSTLOOKUP_TEST_SERVER_IP "10.215.7.68"
+#else
+#define FTP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define FTP_TEST_SERVER_IP_1 "10.215.7.68"
+#define FTPPROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define PROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define SOCKS5PROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HTTPPROXY_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HTTP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HTTPS_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define NTLM_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define UDP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define TCP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define SSH_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define ECHO_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define DAYTIME_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define WILDCARD_TEST_SERVER_NAME_1 "aspiriniks.wildcard.dev.europe.nokia.com"
+#define WILDCARD_TEST_SERVER_NAME_2 "netiks.*.troll.no"
+#define INTERN_TEST_SERVER_NAME_1 "intern.nokia.troll.no"
+#define DOMAIN_TEST_SERVER_NAME_1 ".europe.nokia.com"
+#define DOMAIN_TEST_SERVER_NAME_2 "europe.nokia.com"
+#define HOSTLOOKUP_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define HOSTLOOKUP_TEST_SERVER_IP "10.215.7.68"
+#endif
+
+#define FTPS_TEST_SERVER_NAME_1 "aspiriniks.troll.no"
+#define FOO_TEST_SERVER_NAME_1 HOSTWILLNEVEREXIST_TEST_SERVER_NAME_1
+#define LOCALHOST_TEST_SERVER_NAME_1 "localhost"
+#define HTTP_TEST_SERVER_NAME_4 "www.ietf.org"
+#define NONEXISTING_TEST_SERVER_NAME_1 "this-host-will-never-exist.troll.no"
+#define NONEXISTING_TEST_SERVER_NAME_2 "fluke-nosuchhost.troll.no"
+#define NOSUCH_TEST_SERVER_NAME_1 "nosuchserver.troll.no"
+#define IMAP_TEST_SERVER_NAME_1 "fluke.troll.no"
+#define IMAP_TEST_SERVER_NAME_2 "imap.troll.no"
+#define IMAP_TEST_SERVER_NAME_3 "imap.trolltech.com"
+#define IMAPS_TEST_SERVER_NAME_1 "fluke.troll.no"
+#define HOSTNOTFOUND_TEST_SERVER_NAME_1 "hostnotfoundhostnotfound.troll.no"
+#define TIMEOUT_TEST_SERVER_NAME_1 "cisco.com"
+#define UMA_TEST_SERVER_NAME_1 "fluke.troll.no"
+#define HOSTWILLNEVEREXIST_TEST_SERVER_NAME_1 "this-host-will-never-exist.troll.no"
+
+#define QBYTEARRAY_DEBUG(ba, maxsize)\
+ printf( "ByteArray content (%d/%d bytes):\n", ba.size() <= maxsize ? ba.size() : maxsize , ba.size() ); \
+ printf( "===========================================================================\n" ); \
+ printf( ba.mid( 0, ba.size() <= maxsize ? ba.size() : maxsize ).constData() ); \
+ printf( "\n==========================================================================\n" );
+
+
+static const char *IFNAME = "Lab";
+
+#endif // QT_TESTNETWORKSERVERS_H
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 90bd92d..de42b6d 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -25,3 +25,5 @@ mac {
include(../qbase.pri)
QMAKE_TARGET_PRODUCT = QTestLib
QMAKE_TARGET_DESCRIPTION = Qt Unit Testing Library
+
+symbian:TARGET.UID3=0x2001B2DF