diff options
Diffstat (limited to 'pjlib/src')
-rw-r--r-- | pjlib/src/pjlib-test/errno.c | 2 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_tcp.c | 4 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/pool_perf.c | 35 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/sock.c | 7 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/sock_perf.c | 8 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/test.h | 20 |
6 files changed, 58 insertions, 18 deletions
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 |