1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <unistd.h>
33 #include <signal.h>
34 #include <errno.h>
35 #include <pthread.h>
36
37 #include "../util/pool.h"
38 #include "../public/nsapi.h"
39 #include "../util/plist.h"
40 #include "../util/date.h"
41 #include "../daemon/vfs.h"
42
43 #include "test.h"
44
45 #include "vfs.h"
46 #include "writer.h"
47 #include "xml.h"
48 #include "webdav.h"
49 #include "uri.h"
50 #include "object.h"
51 #include "io.h"
52 #include "event.h"
53
54 void register_pg_tests(
int argc,
char **argv, UcxTestSuite *suite);
55
56
57 void test() {
58
59 }
60
61
62 WSBool main_is_daemon(
void) {
63 return 0;
64 }
65
66 int main(
int argc,
char **argv) {
67 pool_init(
NULL,
NULL,
NULL);
68 pblock_init_default_keys();
69 vfs_init();
70
71
72
73 printf(
"%s",
"Webserver Test Suite\n====================\n\n");
74
75 UcxTestSuite* suite = ucx_test_suite_new();
76
77
78 ucx_test_register(suite, test_util_uri_escape_alphanum);
79 ucx_test_register(suite, test_util_uri_escape_space);
80 ucx_test_register(suite, test_util_uri_escape_latin);
81 ucx_test_register(suite, test_util_uri_escape_kanji);
82
83
84 ucx_test_register(suite, test_evhandler_create);
85 ucx_test_register(suite, test_event_send);
86 ucx_test_register(suite, test_event_send_multi);
87
88
89 ucx_test_register(suite, test_expr_parse_expr_value);
90 ucx_test_register(suite, test_expr_parse_expr_neg_value);
91 ucx_test_register(suite, test_expr_parse_expr_value_str);
92 ucx_test_register(suite, test_expr_parse_expr_value_bool);
93 ucx_test_register(suite, test_expr_parse_expr_value_var);
94 ucx_test_register(suite, test_expr_parse_expr_not_value);
95 ucx_test_register(suite, test_expr_parse_expr_sign_value);
96 ucx_test_register(suite, test_expr_parse_expr_compare2values);
97 ucx_test_register(suite, test_expr_parse_expr_compare2value_expr);
98 ucx_test_register(suite, test_expr_parse_expr_compare2expr_value);
99 ucx_test_register(suite, test_expr_parse_expr_bracket);
100 ucx_test_register(suite, test_expr_op_defined_simple);
101 ucx_test_register(suite, test_expr_op_defined);
102 ucx_test_register(suite, test_expr_op_file_exists_simple);
103 ucx_test_register(suite, test_expr_parse_expr_func_arg0);
104 ucx_test_register(suite, test_expr_parse_expr_func_arg1);
105 ucx_test_register(suite, test_expr_parse_expr_func_arg3);
106 ucx_test_register(suite, test_expr_parse_expr_func_expr1);
107 ucx_test_register(suite, test_expr_parse_expr_func_expr2);
108
109
110 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_hdronly_first);
111 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_hdronly);
112 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_hdronly_seq_fail);
113 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_hdr_data);
114 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_empty);
115 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_partial_first);
116 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_partial);
117 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_invalid);
118 ucx_test_register(suite, test_io_http_stream_parse_chunk_header_zero);
119 ucx_test_register(suite, test_io_httpstream_write);
120 ucx_test_register(suite, test_io_httpstream_chunked_write);
121 ucx_test_register(suite, test_io_httpstream_chunked_write_end);
122 ucx_test_register(suite, test_io_httpstream_chunked_write_xx);
123 ucx_test_register(suite, test_io_httpstream_chunked_write_partial_header);
124 ucx_test_register(suite, test_io_httpstream_chunked_write_partial_data);
125 ucx_test_register(suite, test_io_httpstream_chunked_write_partial_trailer);
126 ucx_test_register(suite, test_io_httpstream_chunked_write_partial_trailer_partial_header);
127 ucx_test_register(suite, test_io_httpstream_chunked_write_data_2x);
128 ucx_test_register(suite, test_io_httpstream_chunked_write_xx_limit);
129
130
131 ucx_test_register(suite, test_vfs_open);
132 ucx_test_register(suite, test_vfs_mkdir);
133 ucx_test_register(suite, test_vfs_opendir);
134 ucx_test_register(suite, test_vfs_readdir);
135 ucx_test_register(suite, test_vfs_unlink);
136 ucx_test_register(suite, test_vfs_rmdir);
137
138
139 ucx_test_register(suite, test_writer_putc);
140 ucx_test_register(suite, test_writer_flush);
141 ucx_test_register(suite, test_writer_put);
142
143
144 ucx_test_register(suite, test_wsxml_iterator);
145 ucx_test_register(suite, test_wsxml_get_required_namespaces);
146 ucx_test_register(suite, test_wsxml_write_nodes);
147 ucx_test_register(suite, test_wsxml_nslist2string);
148 ucx_test_register(suite, test_wsxml_string2nslist);
149
150
151 ucx_test_register(suite, test_webdav_plist_add);
152 ucx_test_register(suite, test_webdav_plist_size);
153 ucx_test_register(suite, test_propfind_parse);
154 ucx_test_register(suite, test_proppatch_parse);
155 ucx_test_register(suite, test_lock_parse);
156 ucx_test_register(suite, test_rqbody2buffer);
157 ucx_test_register(suite, test_webdav_plist_iterator);
158 ucx_test_register(suite, test_webdav_plist_iterator_remove_current);
159 ucx_test_register(suite, test_msresponse_addproperty);
160 ucx_test_register(suite, test_webdav_propfind_init);
161 ucx_test_register(suite, test_webdav_op_propfind_begin);
162 ucx_test_register(suite, test_webdav_op_propfind_children);
163 ucx_test_register(suite, test_proppatch_msresponse);
164 ucx_test_register(suite, test_msresponse_addproperty_with_errors);
165 ucx_test_register(suite, test_webdav_op_proppatch);
166 ucx_test_register(suite, test_webdav_vfs_op_do);
167 ucx_test_register(suite, test_webdav_delete);
168
169
170 ucx_test_register(suite, test_webdav_propfind);
171 ucx_test_register(suite, test_webdav_proppatch);
172 ucx_test_register(suite, test_webdav_put);
173
174
175 #ifdef ENABLE_POSTGRESQL
176 register_pg_tests(argc, argv, suite);
177 #endif
178
179
180 ucx_test_run(suite, stdout);
181 fflush(stdout);
182
183 return EXIT_SUCCESS;
184 }
185
186