Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
Benny Prijono | a771a51 | 2007-02-19 01:13:53 +0000 | [diff] [blame] | 3 | * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | #ifndef __PJLIB_TEST_H__ |
| 20 | #define __PJLIB_TEST_H__ |
| 21 | |
| 22 | #include <pj/types.h> |
| 23 | |
Benny Prijono | f260e46 | 2007-04-30 21:03:32 +0000 | [diff] [blame^] | 24 | #define GROUP_LIBC 0 |
| 25 | #define GROUP_OS 0 |
| 26 | #define GROUP_DATA_STRUCTURE 0 |
Benny Prijono | 63ab356 | 2006-07-08 19:46:43 +0000 | [diff] [blame] | 27 | #define GROUP_NETWORK 1 |
Benny Prijono | f260e46 | 2007-04-30 21:03:32 +0000 | [diff] [blame^] | 28 | #if defined(PJ_SYMBIAN) |
| 29 | # define GROUP_FILE 0 |
| 30 | #else |
| 31 | # define GROUP_FILE 1 |
| 32 | #endif |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 33 | |
Benny Prijono | f260e46 | 2007-04-30 21:03:32 +0000 | [diff] [blame^] | 34 | #if defined(PJ_SYMBIAN) |
| 35 | # define INCLUDE_ERRNO_TEST 0 |
| 36 | #else |
| 37 | # define INCLUDE_ERRNO_TEST GROUP_LIBC |
| 38 | #endif |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 39 | #define INCLUDE_TIMESTAMP_TEST GROUP_OS |
| 40 | #define INCLUDE_EXCEPTION_TEST GROUP_LIBC |
| 41 | #define INCLUDE_RAND_TEST GROUP_LIBC |
| 42 | #define INCLUDE_LIST_TEST GROUP_DATA_STRUCTURE |
| 43 | #define INCLUDE_POOL_TEST GROUP_LIBC |
| 44 | #define INCLUDE_POOL_PERF_TEST (PJ_HAS_MALLOC && GROUP_LIBC) |
| 45 | #define INCLUDE_STRING_TEST GROUP_DATA_STRUCTURE |
| 46 | #define INCLUDE_FIFOBUF_TEST 0 // GROUP_DATA_STRUCTURE |
| 47 | #define INCLUDE_RBTREE_TEST GROUP_DATA_STRUCTURE |
| 48 | #define INCLUDE_TIMER_TEST GROUP_DATA_STRUCTURE |
| 49 | #define INCLUDE_ATOMIC_TEST GROUP_OS |
Benny Prijono | f260e46 | 2007-04-30 21:03:32 +0000 | [diff] [blame^] | 50 | #define INCLUDE_MUTEX_TEST (PJ_HAS_THREADS && GROUP_OS) |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 51 | #define INCLUDE_SLEEP_TEST GROUP_OS |
Benny Prijono | f260e46 | 2007-04-30 21:03:32 +0000 | [diff] [blame^] | 52 | #define INCLUDE_THREAD_TEST (PJ_HAS_THREADS && GROUP_OS) |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 53 | #define INCLUDE_SOCK_TEST GROUP_NETWORK |
Benny Prijono | f260e46 | 2007-04-30 21:03:32 +0000 | [diff] [blame^] | 54 | #if defined(PJ_SYMBIAN) |
| 55 | # define INCLUDE_SOCK_PERF_TEST 0 |
| 56 | #else |
| 57 | # define INCLUDE_SOCK_PERF_TEST GROUP_NETWORK |
| 58 | #endif |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 59 | #define INCLUDE_SELECT_TEST GROUP_NETWORK |
Benny Prijono | 63ab356 | 2006-07-08 19:46:43 +0000 | [diff] [blame] | 60 | #define INCLUDE_UDP_IOQUEUE_TEST GROUP_NETWORK |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 61 | #define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK |
Benny Prijono | f260e46 | 2007-04-30 21:03:32 +0000 | [diff] [blame^] | 62 | #define INCLUDE_IOQUEUE_PERF_TEST (PJ_HAS_THREADS && GROUP_NETWORK) |
| 63 | #define INCLUDE_IOQUEUE_UNREG_TEST (PJ_HAS_THREADS && GROUP_NETWORK) |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 64 | #define INCLUDE_FILE_TEST GROUP_FILE |
| 65 | |
| 66 | #define INCLUDE_ECHO_SERVER 0 |
| 67 | #define INCLUDE_ECHO_CLIENT 0 |
| 68 | |
| 69 | |
| 70 | #define ECHO_SERVER_MAX_THREADS 2 |
| 71 | #define ECHO_SERVER_START_PORT 65000 |
| 72 | #define ECHO_SERVER_ADDRESS "compaq.home" |
| 73 | #define ECHO_SERVER_DURATION_MSEC (60*60*1000) |
| 74 | |
| 75 | #define ECHO_CLIENT_MAX_THREADS 6 |
| 76 | |
| 77 | PJ_BEGIN_DECL |
| 78 | |
| 79 | extern int errno_test(void); |
| 80 | extern int timestamp_test(void); |
| 81 | extern int exception_test(void); |
| 82 | extern int rand_test(void); |
| 83 | extern int list_test(void); |
| 84 | extern int pool_test(void); |
| 85 | extern int pool_perf_test(void); |
| 86 | extern int string_test(void); |
| 87 | extern int fifobuf_test(void); |
| 88 | extern int timer_test(void); |
| 89 | extern int rbtree_test(void); |
| 90 | extern int atomic_test(void); |
| 91 | extern int mutex_test(void); |
| 92 | extern int sleep_test(void); |
| 93 | extern int thread_test(void); |
| 94 | extern int sock_test(void); |
| 95 | extern int sock_perf_test(void); |
| 96 | extern int select_test(void); |
| 97 | extern int udp_ioqueue_test(void); |
Benny Prijono | 5accbd0 | 2006-03-30 16:32:18 +0000 | [diff] [blame] | 98 | extern int udp_ioqueue_unreg_test(void); |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 99 | extern int tcp_ioqueue_test(void); |
| 100 | extern int ioqueue_perf_test(void); |
| 101 | extern int file_test(void); |
| 102 | |
| 103 | extern int echo_server(void); |
| 104 | extern int echo_client(int sock_type, const char *server, int port); |
| 105 | |
| 106 | extern int echo_srv_sync(void); |
| 107 | extern int udp_echo_srv_ioqueue(void); |
| 108 | extern int echo_srv_common_loop(pj_atomic_t *bytes_counter); |
| 109 | |
| 110 | extern pj_pool_factory *mem; |
| 111 | |
| 112 | extern int test_main(void); |
| 113 | extern void app_perror(const char *msg, pj_status_t err); |
| 114 | extern pj_status_t app_socket(int family, int type, int proto, int port, |
| 115 | pj_sock_t *ptr_sock); |
| 116 | extern pj_status_t app_socketpair(int family, int type, int protocol, |
| 117 | pj_sock_t *server, pj_sock_t *client); |
Benny Prijono | 42c5b9e | 2006-05-10 19:24:40 +0000 | [diff] [blame] | 118 | extern int null_func(void); |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 119 | |
| 120 | //#define TRACE_(expr) PJ_LOG(3,expr) |
| 121 | #define TRACE_(expr) |
Benny Prijono | 42c5b9e | 2006-05-10 19:24:40 +0000 | [diff] [blame] | 122 | #define HALT(msg) { PJ_LOG(3,(THIS_FILE,"%s halted",msg)); for(;;) sleep(1); } |
Benny Prijono | 5dcb38d | 2005-11-21 01:55:47 +0000 | [diff] [blame] | 123 | |
| 124 | PJ_END_DECL |
| 125 | |
| 126 | #endif /* __PJLIB_TEST_H__ */ |
| 127 | |