summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-05-01 10:42:22 +0000
committerBenny Prijono <bennylp@teluu.com>2007-05-01 10:42:22 +0000
commite4d10ec39863e84681c5b685d8b46e9c7351f5b4 (patch)
tree13a15887b866bbdf7c24431e45ab7e8d0f22ce4d
parentf9b1f6fe23396291bc504e850dfe98ea5647ed9e (diff)
Ported PJLIB and PJLIB-TEST to Symbian!
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1238 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--build.symbian/00.bat3
-rw-r--r--build.symbian/01.bat3
-rw-r--r--build.symbian/pjlib_test.mmp1
-rw-r--r--pjlib/src/pjlib-test/errno.c2
-rw-r--r--pjlib/src/pjlib-test/ioq_tcp.c4
-rw-r--r--pjlib/src/pjlib-test/pool_perf.c35
-rw-r--r--pjlib/src/pjlib-test/sock.c7
-rw-r--r--pjlib/src/pjlib-test/sock_perf.c8
-rw-r--r--pjlib/src/pjlib-test/test.h20
9 files changed, 63 insertions, 20 deletions
diff --git a/build.symbian/00.bat b/build.symbian/00.bat
index 8f5b15a2..4889059f 100644
--- a/build.symbian/00.bat
+++ b/build.symbian/00.bat
@@ -1,4 +1,5 @@
rem set MWSym2Libraries=1
-set EPOCROOT=\Symbian\9.1\S60_3rd_MR_2\
+set EPOCROOT=\Symbian\9.1\S60_3rd\
+rem set EPOCROOT=\Symbian\9.1\S60_3rd_MR_2\
rem set EPOCROOT=\Symbian\UIQ3SDK\
bldmake bldfiles
diff --git a/build.symbian/01.bat b/build.symbian/01.bat
index df824732..2542ced9 100644
--- a/build.symbian/01.bat
+++ b/build.symbian/01.bat
@@ -1,5 +1,6 @@
rem set MWSym2Libraries=1
rem set MWSym2Libraries=\Symbian\9.1\S60_3rd\Epoc32\release\winscw\udeb
-set EPOCROOT=\Symbian\9.1\S60_3rd_MR_2\
+set EPOCROOT=\Symbian\9.1\S60_3rd\
+rem set EPOCROOT=\Symbian\9.1\S60_3rd_MR_2\
call abld build -v vs6 udeb
diff --git a/build.symbian/pjlib_test.mmp b/build.symbian/pjlib_test.mmp
index e4294b1a..e13d53ff 100644
--- a/build.symbian/pjlib_test.mmp
+++ b/build.symbian/pjlib_test.mmp
@@ -45,6 +45,7 @@ SOURCE util.c
SOURCE main_symbian.cpp
+DOCUMENT test.h
SYSTEMINCLUDE ..\pjlib\include
diff --git a/pjlib/src/pjlib-test/errno.c b/pjlib/src/pjlib-test/errno.c
index 6a8dc964..fd06af35 100644
--- a/pjlib/src/pjlib-test/errno.c
+++ b/pjlib/src/pjlib-test/errno.c
@@ -102,7 +102,7 @@ int errno_test(void)
/*
* Unix errors
*/
-# ifdef EINVAL
+# if defined(EINVAL) && !defined(PJ_SYMBIAN)
rc = PJ_STATUS_FROM_OS(EINVAL);
pj_set_os_error(rc);
diff --git a/pjlib/src/pjlib-test/ioq_tcp.c b/pjlib/src/pjlib-test/ioq_tcp.c
index 3ac086f2..fc280de3 100644
--- a/pjlib/src/pjlib-test/ioq_tcp.c
+++ b/pjlib/src/pjlib-test/ioq_tcp.c
@@ -536,7 +536,11 @@ on_error:
*/
static int compliance_test_2(void)
{
+#if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
+ enum { MAX_PAIR = 1, TEST_LOOP = 2 };
+#else
enum { MAX_PAIR = 4, TEST_LOOP = 2 };
+#endif
struct listener
{
diff --git a/pjlib/src/pjlib-test/pool_perf.c b/pjlib/src/pjlib-test/pool_perf.c
index 6fb341e0..c65b6e40 100644
--- a/pjlib/src/pjlib-test/pool_perf.c
+++ b/pjlib/src/pjlib-test/pool_perf.c
@@ -60,6 +60,35 @@ static int pool_test_pool()
return 0;
}
+/* Symbian doesn't have malloc()/free(), so we use new/delete instead */
+#if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0
+
+static int pool_test_malloc_free()
+{
+ int i; /* must be signed */
+
+ for (i=0; i<COUNT; ++i) {
+ p[i] = new char[sizes[i]];
+ if (!p[i]) {
+ PJ_LOG(3,(THIS_FILE," error: malloc failed to allocate %d bytes",
+ sizes[i]));
+ --i;
+ while (i >= 0)
+ delete [] p[i], --i;
+ return -1;
+ }
+ *p[i] = '\0';
+ }
+
+ for (i=0; i<COUNT; ++i) {
+ delete [] p[i];
+ }
+
+ return 0;
+}
+
+#else /* PJ_SYMBIAN */
+
static int pool_test_malloc_free()
{
int i; /* must be signed */
@@ -84,6 +113,8 @@ static int pool_test_malloc_free()
return 0;
}
+#endif /* PJ_SYMBIAN */
+
int pool_perf_test()
{
unsigned i;
@@ -140,6 +171,10 @@ int pool_perf_test()
best = pool_time, worst = pool_time2;
else
best = pool_time2, worst = pool_time;
+
+ /* avoid division by zero */
+ if (best==0) best=1;
+ if (worst==0) worst=1;
PJ_LOG(3, (THIS_FILE, "..pool speedup over malloc best=%dx, worst=%dx",
(int)(malloc_time/best),
diff --git a/pjlib/src/pjlib-test/sock.c b/pjlib/src/pjlib-test/sock.c
index 044b0f13..4ccad789 100644
--- a/pjlib/src/pjlib-test/sock.c
+++ b/pjlib/src/pjlib-test/sock.c
@@ -369,8 +369,11 @@ static int udp_test(void)
if (rc != 0)
goto on_error;
-// This test will fail on S60 3rd Edition MR2
-#if 0
+ /* Disable this test on Symbian since UDP connect()/send() failed
+ * with S60 3rd edition (including MR2).
+ * See http://www.pjsip.org/trac/ticket/264
+ */
+#if !defined(PJ_SYMBIAN) || PJ_SYMBIAN==0
/* connect() the sockets. */
rc = pj_sock_connect(cs, &dstaddr, sizeof(dstaddr));
if (rc != 0) {
diff --git a/pjlib/src/pjlib-test/sock_perf.c b/pjlib/src/pjlib-test/sock_perf.c
index 1fa12082..a5420af7 100644
--- a/pjlib/src/pjlib-test/sock_perf.c
+++ b/pjlib/src/pjlib-test/sock_perf.c
@@ -158,11 +158,17 @@ int sock_perf_test(void)
PJ_LOG(3,("", "...benchmarking socket "
"(2 sockets, packet=512, single threaded):"));
-
+
+ /* Disable this test on Symbian since UDP connect()/send() failed
+ * with S60 3rd edition (including MR2).
+ * See http://www.pjsip.org/trac/ticket/264
+ */
+#if !defined(PJ_SYMBIAN) || PJ_SYMBIAN==0
/* Benchmarking UDP */
rc = sock_producer_consumer(PJ_SOCK_DGRAM, 512, LOOP, &bandwidth);
if (rc != 0) return rc;
PJ_LOG(3,("", "....bandwidth UDP = %d KB/s", bandwidth));
+#endif
/* Benchmarking TCP */
rc = sock_producer_consumer(PJ_SOCK_STREAM, 512, LOOP, &bandwidth);
diff --git a/pjlib/src/pjlib-test/test.h b/pjlib/src/pjlib-test/test.h
index b30ba9f5..327fb0ee 100644
--- a/pjlib/src/pjlib-test/test.h
+++ b/pjlib/src/pjlib-test/test.h
@@ -21,9 +21,9 @@
#include <pj/types.h>
-#define GROUP_LIBC 0
-#define GROUP_OS 0
-#define GROUP_DATA_STRUCTURE 0
+#define GROUP_LIBC 1
+#define GROUP_OS 1
+#define GROUP_DATA_STRUCTURE 1
#define GROUP_NETWORK 1
#if defined(PJ_SYMBIAN)
# define GROUP_FILE 0
@@ -31,17 +31,13 @@
# define GROUP_FILE 1
#endif
-#if defined(PJ_SYMBIAN)
-# define INCLUDE_ERRNO_TEST 0
-#else
-# define INCLUDE_ERRNO_TEST GROUP_LIBC
-#endif
+#define INCLUDE_ERRNO_TEST GROUP_LIBC
#define INCLUDE_TIMESTAMP_TEST GROUP_OS
#define INCLUDE_EXCEPTION_TEST GROUP_LIBC
#define INCLUDE_RAND_TEST GROUP_LIBC
#define INCLUDE_LIST_TEST GROUP_DATA_STRUCTURE
#define INCLUDE_POOL_TEST GROUP_LIBC
-#define INCLUDE_POOL_PERF_TEST (PJ_HAS_MALLOC && GROUP_LIBC)
+#define INCLUDE_POOL_PERF_TEST GROUP_LIBC
#define INCLUDE_STRING_TEST GROUP_DATA_STRUCTURE
#define INCLUDE_FIFOBUF_TEST 0 // GROUP_DATA_STRUCTURE
#define INCLUDE_RBTREE_TEST GROUP_DATA_STRUCTURE
@@ -51,11 +47,7 @@
#define INCLUDE_SLEEP_TEST GROUP_OS
#define INCLUDE_THREAD_TEST (PJ_HAS_THREADS && GROUP_OS)
#define INCLUDE_SOCK_TEST GROUP_NETWORK
-#if defined(PJ_SYMBIAN)
-# define INCLUDE_SOCK_PERF_TEST 0
-#else
-# define INCLUDE_SOCK_PERF_TEST GROUP_NETWORK
-#endif
+#define INCLUDE_SOCK_PERF_TEST GROUP_NETWORK
#define INCLUDE_SELECT_TEST GROUP_NETWORK
#define INCLUDE_UDP_IOQUEUE_TEST GROUP_NETWORK
#define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK