BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJLIB Reference

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

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.